about summary refs log tree commit diff stats
path: root/modules/home/wms/river/default.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-23 13:31:11 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-23 13:33:40 +0200
commitfd9b0ecef4142a62b45404700ba1cff488f84a73 (patch)
treeef6c1f74f05a2220a41ccff4b0890c39229f32f7 /modules/home/wms/river/default.nix
parentrefactor(pkgs): Categorize into `by-name` shards (diff)
downloadnixos-config-fd9b0ecef4142a62b45404700ba1cff488f84a73.tar.gz
nixos-config-fd9b0ecef4142a62b45404700ba1cff488f84a73.zip
refactor(modules/home): Setup as "normal" NixOS module
Diffstat (limited to 'modules/home/wms/river/default.nix')
-rw-r--r--modules/home/wms/river/default.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/modules/home/wms/river/default.nix b/modules/home/wms/river/default.nix
new file mode 100644
index 00000000..36a9ca74
--- /dev/null
+++ b/modules/home/wms/river/default.nix
@@ -0,0 +1,76 @@
+{
+  pkgs,
+  sysLib,
+  river_init_lesser,
+  nixosConfig,
+  system,
+  ...
+}: let
+  inherit (nixosConfig.networking) hostName;
+  mappings =
+    if hostName == "tiamat"
+    then ''
+      err_fail riverctl keyboard-layout 'us-modified'
+      err_fail river_init_lesser ~/.config/river/res/moonlander.ron
+    ''
+    else if hostName == "lahmu" || hostName == "apzu" || hostName == "mammun" || hostName == "isimud"
+    then ''
+      err_fail riverctl keyboard-layout 'dvorak-modified'
+      err_fail river_init_lesser ~/.config/river/res/keys.ron
+    ''
+    else builtins.throw "Host not covered in river mappings";
+  screen_setup =
+    if hostName == "lahmu"
+    then ''
+      err_fail wlr-randr --output Virtual-1 --mode 1920x1080
+    ''
+    else if hostName == "tiamat"
+    then ''
+      err_fail wlr-randr --output DP-2 --pos 2560,0
+      err_fail wlr-randr --output DP-1 --scale 1.5 --pos 0,0
+      err_fail gammastep &
+    ''
+    else if hostName == "apzu" || hostName == "mammun" || hostName == "isimud"
+    then ''
+      err_fail gammastep &
+    ''
+    else builtins.throw "Host not covered in river screen setup";
+  env_vars = "XDG_CURRENT_DESKTOP=river DESKTOP_SESSION=river";
+  init_scr = pkgs.substituteAll {
+    src = ./init.sh;
+    inherit mappings screen_setup env_vars;
+  };
+in {
+  home.sessionVariables = {
+    WM = "river";
+    XDG_CURRENT_DESKTOP = "river";
+    DESKTOP_SESSION = "river";
+  };
+
+  xdg.configFile."river/init".source =
+    sysLib.writeShellScript {
+      name = "river_init";
+      src = init_scr;
+      keepPath = true;
+      dependencies = builtins.attrValues {
+        river_init_lesser = river_init_lesser.packages.${system}.default;
+        inherit
+          (pkgs)
+          dash
+          river
+          glib # gnome lib
+          gammastep
+          wlr-randr
+          yambar
+          mako
+          swaybg
+          swayidle
+          swaylock
+          alacritty
+          ;
+      };
+    }
+    + /bin/river_init;
+
+  xdg.configFile."river/res".source = ./res;
+}