diff --git a/modules/common/configuration.nix b/modules/common/configuration.nix index cb2a757..eba6347 100644 --- a/modules/common/configuration.nix +++ b/modules/common/configuration.nix @@ -61,24 +61,32 @@ !include ${config.sops.templates."nix-github-token.conf".path} ''; - #Set root password - users.users.root = { - hashedPasswordFile = config.sops.secrets."root-hashedPassword".path; - }; + users = { + # With mutableUsers = false, update-users-groups.pl enforces hashedPasswordFile + # on every activation regardless of whether the account already exists in + # /etc/shadow. The default (true) only applies hashedPasswordFile to newly- + # created accounts — which means a freshly-built proxmox disk image (where + # activation runs without a usable sops key, so both accounts land in shadow + # with ‘!’) will never have its passwords fixed by subsequent boots. + mutableUsers = false; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.${vars.primaryUser} = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - packages = with pkgs; [ - tree - ]; - hashedPasswordFile = config.sops.secrets."nixos-hashedPassword".path; - openssh.authorizedKeys.keys = [ - vars.adminSshKey - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICMJhrfFayLBG+gWtO6oAvgambw5nWWgztiTFEaaaVRH debian@surface" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGygkCljN6uKpdJbHTOQtn8ZnH+wKXDLAwrDFbLrE/65 nixos@nixos" - ]; + users.root = { + hashedPasswordFile = config.sops.secrets."root-hashedPassword".path; + }; + + users.${vars.primaryUser} = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + tree + ]; + hashedPasswordFile = config.sops.secrets."nixos-hashedPassword".path; + openssh.authorizedKeys.keys = [ + vars.adminSshKey + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICMJhrfFayLBG+gWtO6oAvgambw5nWWgztiTFEaaaVRH debian@surface" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGygkCljN6uKpdJbHTOQtn8ZnH+wKXDLAwrDFbLrE/65 nixos@nixos" + ]; + }; };