clan-core/clanModules/root-password/default.nix
Johannes Kirschbauer 87559613ed
All checks were successful
checks / checks (pull_request) Successful in 4m7s
checks / checks-impure (pull_request) Successful in 1m50s
docs: add clan modules readme support
2024-04-17 12:52:04 +02:00

21 lines
637 B
Nix

{ pkgs, config, ... }:
{
users.mutableUsers = false;
users.users.root.hashedPasswordFile =
config.clanCore.facts.services.root-password.secret.password-hash.path;
sops.secrets."${config.clanCore.machineName}-password-hash".neededForUsers = true;
clanCore.facts.services.root-password = {
secret.password = { };
secret.password-hash = { };
generator.path = with pkgs; [
coreutils
xkcdpass
mkpasswd
];
generator.script = ''
xkcdpass --numwords 3 --delimiter - --count 1 > $secrets/password
cat $secrets/password | mkpasswd -s -m sha-512 > $secrets/password-hash
'';
};
}