FS#79516 - [nix] inconsistent `user.environment.conf` with upstream

Attached to Project: Arch Linux
Opened by Bryan Lai (bryango) - Wednesday, 30 August 2023, 09:34 GMT
Last edited by Toolybird (Toolybird) - Thursday, 31 August 2023, 02:13 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Caleb Maclennan (alerque)
George Rawlinson (rawlinsong)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

I believe the packaged `user.environment.conf`: https://gitlab.archlinux.org/archlinux/packaging/packages/nix/-/blob/main/user.environment.conf is originally included to ease the user setup process. However, since then the upstream installation has improved and `user.environment.conf` is now outdated.

Additional info:
* package version(s): `nix: 2.17.0-1`

- incorrect `NIX_PATH`: the default user channel is changed to be `~/.nix-defexpr/channels -> ~/.local/state/nix/profiles/channels`. This works _without_ setting `NIX_PATH`. Our `user.environment.conf` sets `nixpkgs=/nix/var/nix/profiles/per-user/$USER/channels/nixpkgs` instead, which is deprecated some time ago.

The new standard is documented here: https://nixos.org/manual/nix/stable/command-ref/nix-env#user-channel-link
`NIX_PATH` fallback is documented here: https://nixos.org/manual/nix/stable/command-ref/env-common.html#env-NIX_PATH

The wrong `NIX_PATH` will cause the new standard `~/.local/state/nix/profiles/channels` to be ignored and trigger warnings.

- unnecessary `PATH`: this is now automatically set via `/etc/profile.d/nix-daemon.sh`: https://github.com/NixOS/nix/blob/master/scripts/nix-profile-daemon.sh.in. Setting `PATH` again results in duplicated entries.


Resolution:

In our `user.environment.conf`: https://gitlab.archlinux.org/archlinux/packaging/packages/nix/-/blob/main/user.environment.conf,

- remove `PATH`. This should just work.
- remove `NIX_PATH`. This is a bit subtle; I am not sure if removing this will break old installs that have not yet migrated to the current standard. If this is the case, then one can keep `NIX_PATH` but include `$HOME/.local/state/nix/profiles/channels`.

I think it's best to leave everything to the upstream `/etc/profile.d/nix-daemon.sh`. I have removed `user.environment.conf` entirely with `~/.config/environment.d/nix-daemon.conf -> /dev/null` and things have been working smoothly for me.



This task depends upon

Closed by  Toolybird (Toolybird)
Thursday, 31 August 2023, 02:13 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#78828 
Comment by Toolybird (Toolybird) - Wednesday, 30 August 2023, 22:01 GMT
Have you looked at  FS#78828 ? It all seems very closely related so this is more than likely a dupe.
Comment by Bryan Lai (bryango) - Thursday, 31 August 2023, 01:25 GMT
Oh my indeed this is closely related! I did search for existing bugs with: https://bugs.archlinux.org/index.php?string=%5Bnix%5D&project=1&search_name=&type%5B%5D=&sev%5B%5D=&pri%5B%5D=&due%5B%5D=&reported%5B%5D=&cat%5B%5D=&status%5B%5D=&percent%5B%5D=&opened=&dev=&closed=&duedatefrom=&duedateto=&changedfrom=&changedto=&openedfrom=&openedto=&closedfrom=&closedto=&do=index

and I don't understand why that didn't show up...

Please feel free to close it if it's considered duplicated. The additional information is that setting `PATH` is also unnecessary. I will also comment there.

Update: Awesome! After the project & category change the other bug is now visible to me. I guess this is a fallout of the community / extra merge.

Loading...