Change:
# Install all the user shells environment.systemPackages = systemShells; <del> environment.etc = (mapAttrs' (name: { packages, ... }: { </del> <ins> environment.etc = (mapAttrs' (_: { packages, name, ... }: { </ins> name = "profiles/per-user/${name}"; value.source = pkgs.buildEnv { name = "user-environment";

Discussion:
If you set <name.packages to include a set of per-user packages, and proceed to define a value for , the packages will not be available on the user. Considering this example for a : You would expect nixos-rebuild to: a user named 'Bar' a home-folder named 'FooBar' cmatrix into the per-user folder : /etc/profiles/per-user/Bar/ However Instead of this, it will: a user named 'Bar' a home-folder named 'FooBar' cmatrix into the per-user folder : /etc/profiles/per-user/Foo/ As such, the per user folder Bar does not exist, and the user does not have the expected packages available A brief investigation shows the error appears to be Here : A few lines above the ${name} attribute is used however: This is using the attribute name () rather than the ( value to create the relevant folder. Metadata Please run and paste the result. system: host os: multi-user?: sandbox: version: nixpkgs: Maintainer information:
Great investigation work. Can you please open a PR with this change and reference this issue? Thanks!
The offending code is here. in it may fix if it this instead of $HOME to it's set to !!!!!!!!!!!!!!!!!!!! environment.profiles = [ "$" "/etc/profiles/per-user/${name}" ]; however getting this ${user) into scope is tricky... will require some nix foo..
Thank you Nixinator, I have been up against my head with this, I'm pretty green to nix. I'll go about testing a patch shortly :+1:
hey don't thank me , thank in the freenode nix IRC channel. He kindly provided this fix. Good luck with your first Pull request... I'd be interest what you thought about the contributors guide?
I'm having difficulty unfortunately; This line is resolving as 'Foo' rather than 'Bar' (as per my previous example) This line below resolves as 'Bar' (the correct result) I've just learnt the correct process to use nix repl to query the state of these variables, which is much better than nixos-rebuilding every time :smile:
any progress on this?
I've had to put it on my back-burner with the start of the year. I'm open to any suggestions; Though I haven't given up yet!

So: here's where I am at, for anyone who might come across this. My problem at this time is that is set incorrectly to the name of the attribute set that creates the user. by the line : This leads to the physical directory structure of /etc/profiles/ I'm not knowledgeable in Nix as a language enough to correctly understand how to fix this, but am actively researching it. What i do know is that by modifying the statement that sets the variable from: `` to: the user path is with a value equivalent to the <attribute-set- value (rather than using the "$USER" environmental variable - plus this was suggested by someone more knowledgeable than me. ~(this seems inherently more secure to me, however there may be unforeseen factors i'm not aware of; so any input here would be valued).~ Doing this is adding every user to the variable; rather than just the user of interest - but i've gained some knowledge about how maps and attributes are handled -_-;
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
actually introduced per user packages , maybe they can give some advice?
I'd love that I've started figuring out the code in question, and it makes some sense to me: This uses a list of users containing per-user packages, then appears to use the name within to generate the per-user path in the line i've been looking at. I've never used mapattrs', so i'm trying to understand the scope here somewhat.
The code for per-user packages wrongly uses the attribute name instead of the actual user name. This patch should fix the issue:
Wow, that is; absolutely amazing to me - learning Thank you so much
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
This issue has been mentioned on NixOS Discourse. There might be relevant details there: