blob: 1729768a0b786eabe2d349d6e385e75a8f1ae081 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
{ 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 ];
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 = 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;
}
'';
};
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 {
home.packages = [ cfg.package ];
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;
};
};
}
|