blob: 341e04853fdd7662995bfca71f4fcee5ae2d98b9 (
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
{
lib,
flake-parts-lib,
inputs,
...
}:
let
inherit (lib) mkOption mkPackageOption types;
inherit (flake-parts-lib) mkPerSystemOption;
in
{
options.perSystem = mkPerSystemOption (
{ pkgs, config, ... }:
{
options = {
weznix = {
wezterm = mkPackageOption pkgs "wezterm" { };
configDirectory = mkOption {
type = types.str;
default = "~/.config/wezterm";
description = ''
Location of wezterm config directory (see config.weznix.wrapConfig).
'';
};
luaPath = mkOption {
type = types.path;
description = ''
Path to wezterm config directory.
This path is copied into the nix store.
'';
};
mainFile = mkOption {
type = types.str;
default = "init";
apply = lib.removeSuffix ".lua";
description = "Name of the main *.lua file to load";
};
wrapConfig = mkOption {
type = types.either types.bool types.str;
default = "WEZDEV";
description = ''
true -> use config in nix store
false -> use config in ${config.weznix.configDirectory}
ENVVAR -> if $ENVVAR == 1
then use config in ${config.weznix.configDirectory}
else use config in nix store
'';
};
extraLuaInit = mkOption {
type = types.lines;
default = "";
description = ''
Extra lua code to place in the generated wezterm.lua.
This is likely unnecessary.
'';
};
extraPATH = mkOption {
type = types.listOf types.package;
default = [ ];
description = "Extra packages to add to wezterm's $PATH";
};
extraWrapperArgs = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Extra arguments to pass to `wrapProgram`";
};
pass = mkOption {
type = types.lazyAttrsOf types.anything;
default = { };
description = ''
Anything else to pass into the lua config.
These values can then be accessed in your lua config from the table `require('weznix')`.
'';
};
};
};
config = {
packages = {
weznix =
pkgs.callPackage ../pkgs/weznix.nix
{
inherit (config.weznix) wezterm;
nixToLua = import inputs.nixToLua;
}
{
inherit (config.weznix)
configDirectory
luaPath
wrapConfig
mainFile
extraLuaInit
extraPATH
extraWrapperArgs
pass
;
};
};
};
}
);
}
|