fix: only enable media services when needed
Some checks failed
Test action / kaas (push) Failing after 1s
Some checks failed
Test action / kaas (push) Failing after 1s
This commit is contained in:
parent
1ee8fa3407
commit
b2a0a2a26d
1 changed files with 7 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||||
|
|
||||||
cfg = config.${namespace}.services.media.servarr;
|
cfg = config.${namespace}.services.media.servarr;
|
||||||
|
anyEnabled = cfg |> lib.attrNames |> lib.length |> (l: l > 0);
|
||||||
in {
|
in {
|
||||||
options.${namespace}.services.media = {
|
options.${namespace}.services.media = {
|
||||||
servarr = mkOption {
|
servarr = mkOption {
|
||||||
|
|
@ -33,7 +34,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = mkIf anyEnabled {
|
||||||
services =
|
services =
|
||||||
cfg
|
cfg
|
||||||
|> lib.mapAttrsToList (service: {
|
|> lib.mapAttrsToList (service: {
|
||||||
|
|
@ -269,6 +270,11 @@ in {
|
||||||
};
|
};
|
||||||
groups.${service} = {};
|
groups.${service} = {};
|
||||||
}))
|
}))
|
||||||
|
|> lib.concat [
|
||||||
|
{
|
||||||
|
groups.media = {};
|
||||||
|
}
|
||||||
|
]
|
||||||
|> lib.mkMerge;
|
|> lib.mkMerge;
|
||||||
|
|
||||||
sops =
|
sops =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue