mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-17 15:28:33 +03:00
refactor: keep options/config top-level
This commit is contained in:
parent
f48d891b14
commit
dfbf5ddf9e
40
nix/lib.nix
40
nix/lib.nix
@ -55,23 +55,29 @@
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.${service} = lib.mkOption {
|
options = {
|
||||||
description = ''
|
services.${service} = lib.mkOption {
|
||||||
${service} service
|
description = ''
|
||||||
'';
|
${service} service
|
||||||
default = { };
|
'';
|
||||||
type = lib.types.attrsOf (lib.types.submoduleWith {
|
default = { };
|
||||||
specialArgs = { inherit pkgs; };
|
type = lib.types.attrsOf (lib.types.submoduleWith {
|
||||||
modules = [
|
specialArgs = { inherit pkgs; };
|
||||||
serviceModule
|
modules = [
|
||||||
mod
|
serviceModule
|
||||||
];
|
mod
|
||||||
});
|
];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
settings = {
|
||||||
|
imports =
|
||||||
|
lib.pipe config.services.${service} [
|
||||||
|
(lib.filterAttrs (_: cfg: cfg.enable))
|
||||||
|
(lib.mapAttrsToList (_: cfg: cfg.outputs.settings))
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config.settings.imports =
|
|
||||||
lib.pipe config.services.${service} [
|
|
||||||
(lib.filterAttrs (_: cfg: cfg.enable))
|
|
||||||
(lib.mapAttrsToList (_: cfg: cfg.outputs.settings))
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user