about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;
+    };
   };
 }