Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion nixos/modules/config/users-groups.nix
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,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 @@ -655,6 +655,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