modules/ascensions: allow specifying custom incantations

This commit is contained in:
Max Headroom 2023-09-03 21:19:50 +02:00
parent 72f3cead67
commit d51e5e4847

View file

@ -34,7 +34,7 @@ let
}; };
}; };
runIncantations = f: with pkgs; f rec { builtinIncantations = with pkgs; rec {
execShellWith = extraPackages: script: writeShellScript "incantation" '' execShellWith = extraPackages: script: writeShellScript "incantation" ''
export PATH='${makeBinPath ([ coreutils ] ++ extraPackages)}' export PATH='${makeBinPath ([ coreutils ] ++ extraPackages)}'
${script} ${script}
@ -53,13 +53,23 @@ let
chmod = mode: target: "chmod -R ${escapeShellArgs [ mode target ]}"; chmod = mode: target: "chmod -R ${escapeShellArgs [ mode target ]}";
}; };
allIncantations = builtinIncantations // mapAttrs (_: mk: mk allIncantations) config.system.extraIncantations;
runIncantations = f: f allIncantations;
consul = config.services.consul.package; consul = config.services.consul.package;
in in
{ {
options.system.ascensions = mkOption { options.system = {
type = with types; attrsOf (submodule ascensionType); ascensions = mkOption {
default = {}; type = with types; attrsOf (submodule ascensionType);
default = {};
};
extraIncantations = mkOption {
type = with types; attrsOf (functionTo raw);
default = {};
};
}; };
config = { config = {