about summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/modules/programs/zellij/default.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/home/modules/programs/zellij/default.nix b/home/modules/programs/zellij/default.nix
new file mode 100644
index 0000000..7edcb11
--- /dev/null
+++ b/home/modules/programs/zellij/default.nix
@@ -0,0 +1,57 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  cfg = config.programs.zellij;
+  yamlFormat = pkgs.formats.yaml { };
+
+in
+{
+  meta.maintainers = with lib.maintainers; [ boppyt ];
+
+  options.programs.zellij = {
+    enable = mkEnableOption "Zellij, A terminal workspace with batteries included.";
+
+    package = mkOption {
+      type = types.package;
+      default = pkgs.zellij;
+      defaultText = literalExpression "pkgs.zellij";
+      description = "The zellij package to install";
+    };
+
+    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"; };
+      default = { };
+      description = ''
+        Configuration written to
+        <filename>$XDG_CONFIG_HOME/zellij/config.yaml</filename>. See <link
+        xlink:href="https://zellij.dev/documentation/configuration.html"/>
+        for a list of available options.
+      '';
+      example = literalExample ''
+        {
+          default-mode = "normal";
+          simplified-ui = true;
+        }
+      '';
+    };
+  };
+
+  config = mkIf cfg.enable {
+
+    home.packages = [ cfg.package ];
+
+    xdg.configFile."zellij/config.yaml" = mkIf (cfg.settings != { }) {
+      source = yamlFormat.generate "zellij-config" cfg.settings;
+    };
+  };
+}