-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
nix-env doesn't auto-create per-user profile? #414
Comments
I think it would make most sense if |
@edolstra any thoughts on this? Would you accept a PR as described above? |
It would be totally nice to have a more verbose error message as suggested. |
The way NixOS handles it is to create the profile directory from the system login script. Compare the nix-profile.sh linked above (which is the one from the deb) with this bit of the nixos shell module: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/shell.nix#L23-L62 It handles non-root users rather differently. It seems to me that the deb setup is incorrect except in the case of single-user nix installs - which is what the packages claim to support, after all. On my ubuntu systems I've replaced /etc/profile.d/nix.sh with a tweaked version that seems to be working well for me: https://gist.github.com/benley/e4a91e8425993e7d6668 |
Use the same logic as NixOS' profile and environment setup. Closes NixOS#414
@benley thanks for the pointers, I made a PR for a better nix-only version. |
+1 |
Use the same logic as NixOS' profile and environment setup. Closes NixOS#414
The error in the case that a user lacks a writeable profile is still awful:
It would be great if this could be a bit more descriptive, as suggested by @wmertens. |
I just installed NixOS 18.04, upgraded to 19.03, then added a user via |
@markasoftware Were you able to fix this? |
@mbrgm Yes, actually, although I can't guarantee my problem was the same as yours! I discovered that the problem was in how I was switching users. After adding the new user to |
The stdenv phases don’t actually do anything (at least not anymore), and our justfile doesn’t behave the same as our docs. This patch removes the stdenv phases from the docs, documents our usage of just, and makes `just setup` heed `$mesonFlags`. Fixes NixOS#413. Fixes NixOS#414. Change-Id: Ieb0b2a8ae420526238b5f9a73d7849ec6919995d
If your nix-env was originally set up by https://github.com/NixOS/nix/blob/master/scripts/nix-profile.sh.in#L5-L9 then your
~/.nix-profile
will point to/nix/var/nix/profiles/default
.If you then use
nix-env -i ...
and you don't have write access to that directory, it will fail to update your environment instead of creating a new environment under/nix/var/nix/profiles/per-user/$USER/
.It will also not give you any indication of what's happening, all you get is
error: opening lock file ‘/nix/var/nix/profiles/default.lock’: Permission denied
Is this expected behavior? If so, what would be the best way to improve the error message?
The text was updated successfully, but these errors were encountered: