-
Notifications
You must be signed in to change notification settings - Fork 6
/
module.nix
43 lines (38 loc) · 1.15 KB
/
module.nix
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
{ pkgs, config, lib, inputs'screenstub, ... }: with lib; let
cfg = config.programs.screenstub;
settingsFormat = pkgs.formats.yaml { };
settingsModule = { config, ... }: {
freeformType = settingsFormat.type;
};
screenstubPackage = pkgs.callPackage (inputs'screenstub + "/derivation.nix") (optionalAttrs (inputs'screenstub ? lib.crate) {
inherit (inputs'screenstub.lib) crate;
});
in {
options.programs.screenstub = with types; {
enable = mkEnableOption "screenstub";
package = mkOption {
type = package;
default = screenstubPackage;
};
finalPackage = mkOption {
type = package;
default = pkgs.writeShellScriptBin "screenstub" ''
exec ${getExe cfg.package} -c ${cfg.configFile} "$@"
'';
};
settings = mkOption {
type = submodule settingsModule;
default = { };
};
configFile = mkOption {
type = path;
default = settingsFormat.generate "screenstub.yml" cfg.settings;
defaultText = literalExpression "config.programs.screenstub.settings";
};
};
config = {
_module.args.inputs'screenstub = mkOptionDefault {
outPath = ./.;
};
};
}