about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--home-manager/wms/river/default.nix39
-rwxr-xr-xhome-manager/wms/river/init33
2 files changed, 39 insertions, 33 deletions
diff --git a/home-manager/wms/river/default.nix b/home-manager/wms/river/default.nix
index 79830487..1a43ef36 100644
--- a/home-manager/wms/river/default.nix
+++ b/home-manager/wms/river/default.nix
@@ -2,12 +2,47 @@
   pkgs,
   sysLib,
   river_init_lesser,
+  nixosConfig,
   ...
-}: {
+}: let
+  inherit (nixosConfig.networking) hostName;
+  mappings =
+    if hostName == "tiamat"
+    then ''
+      err_fail riverctl keyboard-layout 'us'
+      err_fail river_init_lesser ~/.config/river/res/moonlander.ron
+    ''
+    else if hostName == "lahmu" || hostName == "apzu" || hostName == "mammun"
+    then ''
+      err_fail riverctl keyboard-layout 'dvorak'
+      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"
+    then ''
+      err_fail gammastep &
+    ''
+    else builtins.throw "Host not covered in river screen setup";
+  init_scr = pkgs.substituteAll {
+    src = ./init;
+    inherit mappings screen_setup;
+  };
+in {
   xdg.configFile."river/init".source =
     sysLib.makeShellScriptWithLibraryAndKeepPath {
       name = "river_init";
-      script = ./init;
+      script = init_scr;
       dependencies = builtins.attrValues {
         river_init_lesser = river_init_lesser.legacyPackages.x86_64-linux.default;
         inherit
diff --git a/home-manager/wms/river/init b/home-manager/wms/river/init
index 9ea82edc..7105c949 100755
--- a/home-manager/wms/river/init
+++ b/home-manager/wms/river/init
@@ -20,22 +20,7 @@ err_fail export XDG_CURRENT_DESKTOP=river
 #}}}
 
 # Setup of mappings {{{
-case $(cat /etc/hostname) in
-    "lahmu")
-        err_fail riverctl keyboard-layout 'dvorak'
-        err_fail river_init_lesser ~/.config/river/res/keys.ron
-        ;;
-    "apzu")
-        err_fail riverctl keyboard-layout 'dvorak'
-        err_fail river_init_lesser ~/.config/river/res/keys.ron
-        ;;
-    "tiamat")
-        err_fail riverctl keyboard-layout 'us'
-        err_fail river_init_lesser ~/.config/river/res/moonlander.ron
-        ;;
-    *)
-        warning "Host not supported for keymapping"
-esac
+@mappings@
 # }}}
 
 # Setup of Rules {{{
@@ -68,21 +53,7 @@ err_fail riverctl input pointer-1133-49970-Logitech_Gaming_Mouse_G502 accel-prof
 # }}}
 
 # Setup of general apps {{{
-case $(cat /etc/hostname) in
-    "lahmu")
-        err_fail wlr-randr --output Virtual-1 --mode 1920x1080
-        ;;
-    "apzu")
-        err_fail gammastep &
-        ;;
-    "tiamat")
-        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 &
-        ;;
-    *)
-        warning "Host not supported for screen"
-esac
+@screen_setup@
 
 err_fail yambar &