feat(users): configure user password based on sops secret

This commit is contained in:
tux
2026-05-10 04:54:10 +05:30
parent 226b4cd974
commit bd6055cae5

View File

@@ -8,6 +8,9 @@
userEmail, userEmail,
... ...
}: }:
let
hasPasswordSecret = lib.hasAttrByPath [ "sops" "secrets" "tux-password" ] config;
in
{ {
programs.zsh.enable = true; programs.zsh.enable = true;
@@ -31,7 +34,8 @@
mutableUsers = false; mutableUsers = false;
defaultUserShell = pkgs.zsh; defaultUserShell = pkgs.zsh;
users.${userName} = { users.${userName} = {
hashedPasswordFile = config.sops.secrets.tux-password.path; hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path;
initialPassword = lib.mkIf (!hasPasswordSecret) userName;
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"networkmanager" "networkmanager"