Skip to content

Commit eab3157

Browse files
committed
modules/halloy: init
1 parent 61424c8 commit eab3157

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

modules/halloy/module.nix

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
config,
3+
wlib,
4+
lib,
5+
...
6+
}:
7+
let
8+
tomlFmt = config.pkgs.formats.toml { };
9+
in
10+
{
11+
_class = "wrapper";
12+
options = {
13+
settings = lib.mkOption {
14+
type = tomlFmt.type;
15+
default = { };
16+
};
17+
"config.toml" = lib.mkOption {
18+
type = wlib.types.file config.pkgs;
19+
default.path = tomlFmt.generate "halloy-config" config.settings;
20+
};
21+
extraFiles = lib.mkOption {
22+
type = lib.types.listOf (
23+
lib.types.submodule {
24+
options = {
25+
name = lib.mkOption {
26+
type = lib.types.nonEmptyStr;
27+
description = "File name in the halloy config directory";
28+
};
29+
file = lib.mkOption {
30+
type = wlib.types.file config.pkgs;
31+
description = "File or path to add in the halloy config directory";
32+
};
33+
};
34+
}
35+
);
36+
default = [ ];
37+
description = "Additional files to be placed in the config directory";
38+
};
39+
};
40+
config = {
41+
env = {
42+
XDG_CONFIG_HOME = toString (
43+
config.pkgs.linkFarm "halloy-merged-config" (
44+
map
45+
(a: {
46+
inherit (a) path;
47+
name = "halloy/" + a.name;
48+
})
49+
(
50+
let
51+
entry = name: path: { inherit name path; };
52+
in
53+
[ (entry "config.toml" config."config.toml".path) ]
54+
++ (map (f: {
55+
inherit (f) name;
56+
path = f.file.path;
57+
}) config.extraFiles)
58+
)
59+
)
60+
);
61+
};
62+
package = config.pkgs.halloy;
63+
meta = {
64+
maintainers = [
65+
{
66+
name = "holly";
67+
github = "hollymlem";
68+
githubId = 35699052;
69+
}
70+
];
71+
};
72+
};
73+
}

0 commit comments

Comments
 (0)