Refactor sops-nix override configuration

This commit is contained in:
Manuel Thalmann 2024-05-02 13:07:43 +02:00
parent 1a57b9d49b
commit 83bfad9a1b

View file

@ -26,8 +26,12 @@
}; };
config = { config = {
virtualisation =
let
extendVMConfig =
vmVariant: {
users.users = users.users =
with { inherit (config.virtualisation.vmVariantWithBootLoader.users) sopsPasswordOverride; }; with { inherit (vmVariant.users) sopsPasswordOverride; };
(lib.mkIf (lib.mkIf
sopsPasswordOverride.enable sopsPasswordOverride.enable
( (
@ -54,4 +58,14 @@
)) ))
(builtins.attrNames config.users.users))))); (builtins.attrNames config.users.users)))));
}; };
inherit (config.virtualisation)
vmVariant
vmVariantWithBootLoader
;
in {
vmVariant = extendVMConfig vmVariant;
vmVariantWithBootLoader = extendVMConfig vmVariantWithBootLoader;
};
};
} }