nixos/users-groups: allow changing default home directory (#357962)

authored by isabelroses.com and committed by GitHub bd604e35 dcf9c5e7

+10 -2
+9 -1
nixos/modules/config/users-groups.nix
··· 477 477 (mkIf config.isNormalUser { 478 478 group = mkDefault "users"; 479 479 createHome = mkDefault true; 480 - home = mkDefault "/home/${config.name}"; 480 + home = mkDefault "${cfg.defaultUserHome}/${config.name}"; 481 481 homeMode = mkDefault "700"; 482 482 useDefaultShell = mkDefault true; 483 483 isSystemUser = mkDefault false; ··· 750 750 a password or an SSH key. 751 751 752 752 WARNING: enabling this can lock you out of your system. Enable this only if you know what are you doing. 753 + ''; 754 + }; 755 + 756 + users.defaultUserHome = mkOption { 757 + type = types.str; 758 + default = "/home"; 759 + description = '' 760 + The default home directory for normal users. 753 761 ''; 754 762 }; 755 763
+1 -1
nixos/modules/programs/shadow.nix
··· 217 217 # /etc/default/useradd: configuration for useradd. 218 218 "default/useradd".source = pkgs.writeText "useradd" '' 219 219 GROUP=100 220 - HOME=/home 220 + HOME=${config.users.defaultUserHome} 221 221 SHELL=${utils.toShellPath config.users.defaultUserShell} 222 222 ''; 223 223 };