nixos/modules/dwm.nix
2024-11-29 19:46:27 -08:00

93 lines
2.2 KiB
Nix

{ lib, config, pkgs, inputs, ... }:
let
inherit (lib) getExe;
cfg = config.snowhawk.dwm;
in
{
options.snowhawk.dwm = {
enable = lib.mkEnableOption "dwm";
};
config = lib.mkIf cfg.enable {
# Enable the X11 windowing system.
services.xserver.enable = true;
# Configure keymap in X11
services.xserver = {
xkb = {
layout = "us";
variant = "";
};
};
services.xserver.windowManager.dwm = {
enable = true;
package = pkgs.dwm.overrideAttrs (oldAttrs: {
src = inputs.zdwm;
buildInputs = oldAttrs.buildInputs ++ [ pkgs.yajl ];
});
};
services.picom = {
enable = true;
fade = false;
};
systemd.user.services.xrootdatetime = {
script =
let
pamixer = getExe pkgs.pamixer;
xsetroot = getExe pkgs.xorg.xsetroot;
in
/* bash */ ''
function update_x_root() {
set +e # allow errors
mute="$(${pamixer} --default-source --get-mute)"
set -e # disallow errors
if [[ "$mute" == "true" ]]; then
mutedString="Mic Muted "
else
mutedString=""
fi
dateTime=$(date +"<-- %A, %B %d -- %H:%M -->")
${xsetroot} -name "$mutedString$dateTime"
}
trap update_x_root SIGUSR1
while true; do
sleep 1 &
wait
update_x_root
done
'';
wantedBy = [ "graphical-session.target" ];
after = [ "pipewire.service" ];
serviceConfig.Restart = "on-failure";
};
systemd.user.services.fehbg = {
script = ''
${getExe pkgs.feh} --no-fehbg --bg-scale '${inputs.backgrounds}/bg-none-nord.webp'
'';
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};
environment.variables.FREETYPE_PROPERTIES = "cff:no-stem-darkening=0 autofitter:no-stem-darkening=0";
environment.systemPackages = with pkgs; [
dmenu
xclip
];
home-manager.sharedModules = [
./home/dwm.nix
{ snowhawk.dwm.enable = lib.mkDefault true; }
];
};
}