1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-20 07:12:41 +00:00

Merge pull request #1355 from toodeluna/fix/profile-name

fix: use correct username for profile
This commit is contained in:
Michael Hoang 2025-03-14 07:46:59 +09:00 committed by GitHub
commit 4d8a451649
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,14 +11,14 @@ let
group = import ./group.nix; group = import ./group.nix;
user = import ./user.nix; user = import ./user.nix;
toGID = v: { "${toString v.gid}" = v.name; }; toGID = n: v: { "${toString v.gid}" = n; };
toUID = v: { "${toString v.uid}" = v.name; }; toUID = n: v: { "${toString v.uid}" = n; };
isCreated = list: name: elem name list; isCreated = list: name: elem name list;
isDeleted = attrs: name: ! elem name (mapAttrsToList (n: v: v.name) attrs); isDeleted = attrs: name: ! elem name (mapAttrsToList (n: v: v.name) attrs);
gids = mapAttrsToList (n: toGID) (filterAttrs (n: v: isCreated cfg.knownGroups v.name) cfg.groups); gids = mapAttrsToList toGID (filterAttrs (n: v: isCreated cfg.knownGroups v.name) cfg.groups);
uids = mapAttrsToList (n: toUID) (filterAttrs (n: v: isCreated cfg.knownUsers v.name) cfg.users); uids = mapAttrsToList toUID (filterAttrs (n: v: isCreated cfg.knownUsers v.name) cfg.users);
createdGroups = mapAttrsToList (n: v: cfg.groups."${v}") cfg.gids; createdGroups = mapAttrsToList (n: v: cfg.groups."${v}") cfg.gids;
createdUsers = mapAttrsToList (n: v: cfg.users."${v}") cfg.uids; createdUsers = mapAttrsToList (n: v: cfg.users."${v}") cfg.uids;
@ -112,14 +112,14 @@ in
in in
!user.ignoreShellProgramCheck -> (s == shell || (shell == "bash" && s == "bash-interactive")) -> (config.programs.${shell}.enable == true); !user.ignoreShellProgramCheck -> (s == shell || (shell == "bash" && s == "bash-interactive")) -> (config.programs.${shell}.enable == true);
message = '' message = ''
users.users.${user.name}.shell is set to ${shell}, but users.users.${name}.shell is set to ${shell}, but
programs.${shell}.enable is not true. This will cause the ${shell} programs.${shell}.enable is not true. This will cause the ${shell}
shell to lack the basic Nix directories in its PATH and might make shell to lack the basic Nix directories in its PATH and might make
logging in as that user impossible. You can fix it with: logging in as that user impossible. You can fix it with:
programs.${shell}.enable = true; programs.${shell}.enable = true;
If you know what you're doing and you are fine with the behavior, If you know what you're doing and you are fine with the behavior,
set users.users.${user.name}.ignoreShellProgramCheck = true; set users.users.${name}.ignoreShellProgramCheck = true;
instead. instead.
''; '';
}) [ }) [
@ -331,7 +331,7 @@ in
environment.systemPackages = systemShells; environment.systemPackages = systemShells;
environment.etc = mapAttrs' (name: { packages, ... }: { environment.etc = mapAttrs' (name: { packages, ... }: {
name = "profiles/per-user/${name}"; name = "profiles/per-user/${cfg.users.${name}.name}";
value.source = pkgs.buildEnv { value.source = pkgs.buildEnv {
name = "user-environment"; name = "user-environment";
paths = packages; paths = packages;