summaryrefslogtreecommitdiff
path: root/hosts/ali/desktop-environment
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/ali/desktop-environment')
-rw-r--r--hosts/ali/desktop-environment/default.nix25
-rw-r--r--hosts/ali/desktop-environment/input.nix10
-rw-r--r--hosts/ali/desktop-environment/window-manager.nix38
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
+ ];
+}