Skip to content

Commit 6e3f785

Browse files
committed
feat(wrapperModules.iamb): init
1 parent 8c90cbe commit 6e3f785

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

maintainers/default.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,9 @@
111111
github = "allen-liaoo";
112112
githubId = 16383622;
113113
};
114+
aliaslion = {
115+
name = "aliaslion";
116+
github = "aliaslion";
117+
githubId = "122117018";
118+
};
114119
}

wrapperModules/i/iamb/module.nix

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
config,
3+
lib,
4+
wlib,
5+
pkgs,
6+
...
7+
}:
8+
{
9+
imports = [ wlib.modules.default ];
10+
options = {
11+
settings = lib.mkOption {
12+
type = wlib.types.structuredValueWith {
13+
nullable = false;
14+
typeName = "TOML";
15+
};
16+
default = { };
17+
description = ''
18+
Configuration of iamb.
19+
See {manpage}`iamb(5)` or <https://iamb.chat/configure.html>
20+
'';
21+
};
22+
23+
generatedConfig.output = lib.mkOption {
24+
type = lib.types.str;
25+
default = config.outputName;
26+
description = ''
27+
The derivation output for the config generated by this wrapper module
28+
'';
29+
};
30+
generatedConfig.placeholder = lib.mkOption {
31+
type = lib.types.str;
32+
default = "${placeholder config.generatedConfig.output}/${config.binName}-config";
33+
readOnly = true;
34+
description = ''
35+
The placeholder accessible in the wrapper derivation build script for the config generated by this wrapper module
36+
'';
37+
};
38+
};
39+
40+
config.package = lib.mkDefault pkgs.iamb;
41+
config.flags."--config-directory" = config.generatedConfig.placeholder;
42+
43+
config.passthru.generatedConfig = "${
44+
config.wrapper.${config.generatedConfig.output}
45+
}/${config.binName}-config";
46+
47+
config.constructFiles.config = {
48+
relPath = "${config.binName}-config/iamb/config.toml";
49+
output = config.generatedConfig.output;
50+
content = builtins.toJSON config.settings;
51+
builder = ''${pkgs.remarshal}/bin/json2toml "$1" "$2"'';
52+
};
53+
config.meta.maintainers = [ wlib.maintainers.aliaslion ];
54+
}

0 commit comments

Comments
 (0)