Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#78828 - [nix] Conflicting environment variables and tmpfiles

Attached to Project: Community Packages
Opened by Éric (gileri) - Sunday, 18 June 2023, 21:00 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 20 June 2023, 04:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When installing the `nix` arch package, nix commands can be executed as root, but fail as unprivileged users.

$ nix-shell -p hello

warning: Nix search path entry '/nix/var/nix/profiles/per-user/twix/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/twix/channels' does not exist, ignoring
error:
… <borked>
at «none»:0: (source not available)

… while calling the 'import' builtin
at «string»:1:18:

1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (hello) ]; } ""
| ^

(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)

The upstream multi-user installation script [1] seem to create only the nix-daemon socket [2] and no other tmpfile, or environment variables.
By keeping only the nix-daemon tmpfile.d script, and removing everything else in tmpfiles.conf, user.environment.conf, user.tmpfiles.conf from the arch package, both root and unprivileged nix commands works.

Is there a reason to have those tmpfiles and environment variables as they are ?

PS: I'm pretty new to Nix, so please take this with a pinch of salt.

Additional info:
* package version(s) : nix 2.16.1-1
* see also :  FS#73120 


Steps to reproduce:
1. # pacman -S nix && systemctl enable --now nix-daemon
2. Apply tmpfiles and environment variables, or reboot
3. # nix-channel --add https://nixos.org/channels/nixpkgs-unstable && nix-channel --update
4. # nix-shell -p hello # Works fine as root
5. $ nix-shell -p hello # Fails as an user, see output above

[1] https://github.com/NixOS/nix/blob/master/scripts/install-systemd-multi-user.sh
[2] https://github.com/NixOS/nix/blob/master/misc/systemd/nix-daemon.conf.in
This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 20 June 2023, 04:59 GMT
Reason for closing:  Works for me
Additional comments about closing:  See comments
Comment by Toolybird (Toolybird) - Monday, 19 June 2023, 05:49 GMT
Looks like you forgot to add yourself to the "nix-users" group [1], then log out (or reboot) for it to take effect.

[1] https://wiki.archlinux.org/title/Nix#Configuration
Comment by Éric (gileri) - Tuesday, 20 June 2023, 04:58 GMT
Can you share what you did different, with a clean machine, from the bug report ?

I tested again, on a clean VM, and the error is present. But only if user.environment.conf is applied. In a TTY, as the NIX_PATH environment variable is not applied, it works. In a shell where user.environment.conf is applied, it will exhibit the original issue.
Comment by Toolybird (Toolybird) - Tuesday, 20 June 2023, 04:59 GMT
See also  FS#78507 . I have no idea what could be causing it. All I can tell you is, it works for me and 1 of the PM's. I just simply followed the Wiki. There is no bug apparent. The bug tracker is not for support. Please take any further discussion to the appropriate support channels (Forum/IRC/Mailing Lists/Reddit/etc). Thanks

Loading...