nixos/modules/users/root.nix

18 lines
667 B
Nix
Raw Normal View History

{ bootstrape ? false }: { pkgs, ... }@inputs:
2023-06-09 20:54:03 +08:00
{
config =
{
users =
{
users.root = { shell = inputs.pkgs.zsh; }
// (if bootstrape then { password = "0"; }
else { passwordFile = inputs.config.sops.secrets."password/root".path; });
2023-06-09 20:54:03 +08:00
mutableUsers = false;
};
2023-06-27 23:14:33 +08:00
# root password in initrd: 0000
# currently not working, might work in the future
# boot.initrd.secrets.${builtins.toString inputs.config.sops.secrets."password/root".path}
# = builtins.toFile "root-password" "$y$j9T$EHgd1EmvM54fIkuDnrAM41$WNhog3VSAdrQXljA4I7Coy8W6iRQFQ3CLOKEH6IZzJ/";
} // (if !bootstrape then { sops.secrets."password/root".neededForUsers = true; } else {});
2023-06-09 20:54:03 +08:00
}