From 354982cf37b249108e4fd0fd68588df02149b6b7 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 2 May 2024 04:50:36 +0200 Subject: [PATCH] Set default password for `build-vm-with-bootloader` --- lib/modules/custom-build-vm.nix | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/modules/custom-build-vm.nix b/lib/modules/custom-build-vm.nix index 00936a2..12f2e16 100644 --- a/lib/modules/custom-build-vm.nix +++ b/lib/modules/custom-build-vm.nix @@ -124,7 +124,31 @@ in { ; in { vmVariant = extendVMConfig vmVariant; - vmVariantWithBootLoader = extendVMConfig vmVariantWithBootLoader; + vmVariantWithBootLoader = + (extendVMConfig vmVariantWithBootLoader) // + # Overwrite users with `hashedPasswordFile`s as `sops-nix` does not seem to work with `build-vm-with-bootloader` + { + users.users = builtins.listToAttrs ( + builtins.map ( + name: { + inherit name; + + value = { + hashedPasswordFile = lib.mkVMOverride null; + password = lib.mkVMOverride "test"; + }; + }) + (builtins.filter + ( + name: + let + user = config.users.users.${name}; + in + ( + (user.hashedPasswordFile != null) + )) + (builtins.attrNames config.users.users))); + }; }; system.build =