{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nix/issues/414","labels_url":"https://api.github.com/repos/NixOS/nix/issues/414/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nix/issues/414/comments","events_url":"https://api.github.com/repos/NixOS/nix/issues/414/events","html_url":"https://github.com/NixOS/nix/issues/414","id":51687619,"number":414,"title":"nix-env doesn't auto-create per-user profile?","user":{"login":"wmertens","id":54934,"avatar_url":"https://avatars.githubusercontent.com/u/54934?v=3","gravatar_id":"","url":"https://api.github.com/users/wmertens","html_url":"https://github.com/wmertens","followers_url":"https://api.github.com/users/wmertens/followers","following_url":"https://api.github.com/users/wmertens/following{/other_user}","gists_url":"https://api.github.com/users/wmertens/gists{/gist_id}","starred_url":"https://api.github.com/users/wmertens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmertens/subscriptions","organizations_url":"https://api.github.com/users/wmertens/orgs","repos_url":"https://api.github.com/users/wmertens/repos","events_url":"https://api.github.com/users/wmertens/events{/privacy}","received_events_url":"https://api.github.com/users/wmertens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-12-11T13:41:30Z","updated_at":"2015-01-06T07:57:34Z","closed_at":null,"body":"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`.\r\n\r\nIf 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/`.\r\n\r\nIt 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`\r\n\r\nIs this expected behavior? If so, what would be the best way to improve the error message?"},"comment":{"url":"https://api.github.com/repos/NixOS/nix/issues/comments/68836406","html_url":"https://github.com/NixOS/nix/issues/414#issuecomment-68836406","issue_url":"https://api.github.com/repos/NixOS/nix/issues/414","id":68836406,"user":{"login":"benley","id":1432730,"avatar_url":"https://avatars.githubusercontent.com/u/1432730?v=3","gravatar_id":"","url":"https://api.github.com/users/benley","html_url":"https://github.com/benley","followers_url":"https://api.github.com/users/benley/followers","following_url":"https://api.github.com/users/benley/following{/other_user}","gists_url":"https://api.github.com/users/benley/gists{/gist_id}","starred_url":"https://api.github.com/users/benley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benley/subscriptions","organizations_url":"https://api.github.com/users/benley/orgs","repos_url":"https://api.github.com/users/benley/repos","events_url":"https://api.github.com/users/benley/events{/privacy}","received_events_url":"https://api.github.com/users/benley/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T07:57:34Z","updated_at":"2015-01-06T07:57:34Z","body":"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\r\n\r\nIt 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.\r\n\r\nOn 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"}}