diff options
author | Linnnus <[email protected]> | 2025-03-23 22:05:01 +0000 |
---|---|---|
committer | Linnnus <[email protected]> | 2025-03-23 22:05:01 +0000 |
commit | 7f8c32c8295610ec7e5b8e387ea52cfa88250496 (patch) | |
tree | c1ce2d9c30b4597b199df1baa0f889b737444d16 /hosts/ali/desktop-environment | |
parent | 94743c25a092fa9aa19182542b2d2026c6f88b1e (diff) |
hosts/ali: Init
Diffstat (limited to 'hosts/ali/desktop-environment')
-rw-r--r-- | hosts/ali/desktop-environment/default.nix | 25 | ||||
-rw-r--r-- | hosts/ali/desktop-environment/input.nix | 10 | ||||
-rw-r--r-- | hosts/ali/desktop-environment/window-manager.nix | 38 |
3 files changed, 73 insertions, 0 deletions
diff --git a/hosts/ali/desktop-environment/default.nix b/hosts/ali/desktop-environment/default.nix new file mode 100644 index 0000000..ce9e3bd --- /dev/null +++ b/hosts/ali/desktop-environment/default.nix @@ -0,0 +1,25 @@ +# This module configures a desktop environment specific to this host. +{pkgs,...}: +{ + imports = [ + ./window-manager.nix + ./input.nix + ]; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + + # TODO: We should be able to add "intel" driver? + videoDrivers = ["fbdev"]; + }; + + + # Enable sound. + # hardware.pulseaudio.enable = true; + # OR + # services.pipewire = { + # enable = true; + # pulse.enable = true; + # }; +} diff --git a/hosts/ali/desktop-environment/input.nix b/hosts/ali/desktop-environment/input.nix new file mode 100644 index 0000000..63cddca --- /dev/null +++ b/hosts/ali/desktop-environment/input.nix @@ -0,0 +1,10 @@ +{ + # Configure keymap in X11 + services.xserver.xkb.layout = "dk"; + services.xserver.xkb.options = "caps:escape"; + + console.useXkbConfig = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; +} diff --git a/hosts/ali/desktop-environment/window-manager.nix b/hosts/ali/desktop-environment/window-manager.nix new file mode 100644 index 0000000..d36fc14 --- /dev/null +++ b/hosts/ali/desktop-environment/window-manager.nix @@ -0,0 +1,38 @@ +{pkgs, ...}: { + services.xserver.windowManager.dwm.enable = true; + + # FIXME: Deduplicate this with omar's config (noting the difference in BAT0 vs BAT1). + # Show battery and clock in status bar. This is a background daemon which + # updates the root window, which DWM uses for status. + systemd.user.services.dwm-battery = { + description = "Battery status update"; + partOf = ["graphical-session.target"]; + wantedBy = ["graphical-session.target"]; + + serviceConfig.ExecStart = pkgs.writeShellScript "dwm-battery" '' + while true; do + echo -n "$(date +%H:%M) - "; + + # See: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power + case "$(cat /sys/class/power_supply/BAT1/status)" in + Charging) echo -n "🔋 " ;; + Discharging) echo -n "🪫 " ;; + "Not charging") echo -n "🪫 " ;; + Full) echo -n "🔋 " ;; + Unknown) echo -n "? " ;; + ""|*) echo -n "?? " ;; + esac + + echo -n "$(cat /sys/class/power_supply/BAT1/capacity)%" + + echo + sleep 5 + done | ${pkgs.dwm-setstatus}/bin/dwm-setstatus + ''; + }; + + environment.systemPackages = with pkgs; [ + st + dmenu + ]; +} |