Skip to content

Commit

Permalink
nixos/users-groups: allow changing default home directory
Browse files Browse the repository at this point in the history
  • Loading branch information
2xsaiko committed Dec 6, 2024
1 parent 7c4b748 commit a7ee8aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion nixos/modules/config/users-groups.nix
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ let
(mkIf config.isNormalUser {
group = mkDefault "users";
createHome = mkDefault true;
home = mkDefault "/home/${config.name}";
home = mkDefault "${cfg.defaultHome}/${config.name}";
homeMode = mkDefault "700";
useDefaultShell = mkDefault true;
isSystemUser = mkDefault false;
Expand Down Expand Up @@ -621,6 +621,14 @@ in {
'';
};

users.defaultHome = mkOption {
type = types.str;
default = "/home";
description = ''
The default home directory for normal users.
'';
};

# systemd initrd
boot.initrd.systemd.users = mkOption {
description = ''
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/programs/shadow.nix
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ in
# /etc/default/useradd: configuration for useradd.
"default/useradd".source = pkgs.writeText "useradd" ''
GROUP=100
HOME=/home
HOME=${config.users.defaultHome}
SHELL=${utils.toShellPath config.users.defaultUserShell}
'';
};
Expand Down

0 comments on commit a7ee8aa

Please sign in to comment.