about summary refs log tree commit diff
path: root/home/modules/programs
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-01-21 23:33:10 +0900
committersefidel <contact@sefidel.net>2022-01-21 23:42:17 +0900
commit82f572050b832d1fd246bd8115128c184b081bd0 (patch)
tree305413fa35cc2de027082a02680ba7ab474b76c1 /home/modules/programs
parent5f5e6a4d6b32812ee78e1330c3e7a671c89818f2 (diff)
downloadnixrc-82f572050b832d1fd246bd8115128c184b081bd0.tar.gz
nixrc-82f572050b832d1fd246bd8115128c184b081bd0.zip
zellij: provide default layout option
Diffstat (limited to 'home/modules/programs')
-rw-r--r--home/modules/programs/zellij/default.nix32
1 files changed, 22 insertions, 10 deletions
diff --git a/home/modules/programs/zellij/default.nix b/home/modules/programs/zellij/default.nix
index cd048f8..1729768 100644
--- a/home/modules/programs/zellij/default.nix
+++ b/home/modules/programs/zellij/default.nix
@@ -1,12 +1,17 @@
 { config, lib, pkgs, ... }:
 
 with lib;
+with lib.types;
 
 let
-
   cfg = config.programs.zellij;
   yamlFormat = pkgs.formats.yaml { };
 
+  prim = oneOf [ bool int str ];
+  primOrPrimAttrs = either prim (attrsOf prim);
+  entry = either prim (listOf primOrPrimAttrs);
+  entryOrAttrsOf = t: either entry (attrsOf t);
+  entries = entryOrAttrsOf (entryOrAttrsOf entry);
 in
 {
   meta.maintainers = with lib.maintainers; [ boppyt ];
@@ -22,15 +27,7 @@ in
     };
 
     settings = mkOption {
-      type = with types;
-        let
-          prim = oneOf [ bool int str ];
-          primOrPrimAttrs = either prim (attrsOf prim);
-          entry = either prim (listOf primOrPrimAttrs);
-          entryOrAttrsOf = t: either entry (attrsOf t);
-          entries = entryOrAttrsOf (entryOrAttrsOf entry);
-        in
-        attrsOf entries // { description = "zellij configuration"; };
+      type = attrsOf entries // { description = "zellij configuration"; };
       default = { };
       description = ''
         Configuration written to
@@ -45,6 +42,17 @@ in
         }
       '';
     };
+
+    defaultLayout = mkOption {
+      type = attrsOf entries // { description = "zellij default pane layout"; };
+      default = { };
+      description = ''
+        Configuration written to
+        <filename>$XDG_CONFIG_HOME/zellij/layout/default.yaml</filename>. See <link
+        xlink:href="https://zellij.dev/documentation/layouts.html"/>
+        for a list of available options.
+      '';
+    };
   };
 
   config = mkIf cfg.enable {
@@ -54,5 +62,9 @@ in
     xdg.configFile."zellij/config.yaml" = mkIf (cfg.settings != { }) {
       source = yamlFormat.generate "zellij-config" cfg.settings;
     };
+
+    xdg.configFile."zellij/layout/default.yaml" = mkIf (cfg.defaultLayout != { }) {
+      source = yamlFormat.generate "zellij-layout" cfg.defaultLayout;
+    };
   };
 }