Refactor default sops override config
This commit is contained in:
parent
9e3fad7501
commit
b8c3cbc2b1
|
@ -78,17 +78,10 @@ in {
|
||||||
virtualisation =
|
virtualisation =
|
||||||
let
|
let
|
||||||
extendVMConfig =
|
extendVMConfig =
|
||||||
vmVariant: overrideSops: {
|
vmVariant: {
|
||||||
# Prevent GRUB2 errors in `nixos-rebuild build-vm-with-bootloader`
|
# Prevent GRUB2 errors in `nixos-rebuild build-vm-with-bootloader`
|
||||||
boot.loader.efi.efiSysMountPoint = lib.mkVMOverride "/boot";
|
boot.loader.efi.efiSysMountPoint = lib.mkVMOverride "/boot";
|
||||||
|
|
||||||
# Override passwords backed by `sops-nix` as `nixos-rebuild build-vm-with-bootloader`
|
|
||||||
# does not seem to play along well with `sops-nix`
|
|
||||||
users.sopsPasswordOverride = lib.mkIf overrideSops {
|
|
||||||
enable = true;
|
|
||||||
password = "admin";
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
# Enable root permissions to get access to the `/etc/ssh` directory
|
# Enable root permissions to get access to the `/etc/ssh` directory
|
||||||
runAsRoot = lib.mkIf vmVariant.virtualisation.sharedHostKeys true;
|
runAsRoot = lib.mkIf vmVariant.virtualisation.sharedHostKeys true;
|
||||||
|
|
|
@ -32,7 +32,14 @@
|
||||||
virtualisation =
|
virtualisation =
|
||||||
let
|
let
|
||||||
extendVMConfig =
|
extendVMConfig =
|
||||||
vmVariant: {
|
vmVariant: overrideSops: {
|
||||||
|
# Override passwords backed by `sops-nix` as `nixos-rebuild build-vm-with-bootloader`
|
||||||
|
# does not seem to play along well with `sops-nix`
|
||||||
|
users.sopsPasswordOverride = lib.mkIf overrideSops {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
password = lib.mkDefault "admin";
|
||||||
|
};
|
||||||
|
|
||||||
users.users =
|
users.users =
|
||||||
with { inherit (vmVariant.users) sopsPasswordOverride; };
|
with { inherit (vmVariant.users) sopsPasswordOverride; };
|
||||||
(lib.mkIf
|
(lib.mkIf
|
||||||
|
@ -67,8 +74,8 @@
|
||||||
vmVariantWithBootLoader
|
vmVariantWithBootLoader
|
||||||
;
|
;
|
||||||
in {
|
in {
|
||||||
vmVariant = extendVMConfig vmVariant;
|
vmVariant = extendVMConfig vmVariant false;
|
||||||
vmVariantWithBootLoader = extendVMConfig vmVariantWithBootLoader;
|
vmVariantWithBootLoader = extendVMConfig vmVariantWithBootLoader true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in a new issue