Although sys-apps/nix works well, it sets the start of PATH to $HOME/.nix-profile/{bin/sbin}. Depending on what is installed via Nix, this causes the Nix profile to override equivalent installed programs. While this is required for Nix, this is bad for using tools within Gentoo. For example, consider a Gentoo system with clang v4, GCC v4.9.4, and GCC 5.4.0 installed. If one installs clang v3.9.1 using Nix, then Nix' symlinks prevent the system's programs from being used. This is acceptable if one is using clang v3.9.1 --but if one is using clang v4 or GCC v4/5 then Nix' binaries (e.g,, ar, etc.) will be used --not the systems. Worse Nix' symlinks are not 100%, e.g., clang++ is defined but not clang++-3.9 which means to use clang++-3.9 from Nix one actually has to use clang++ although one can run clang-3.9. This can result in a user easily running the wrong compiler tool. It may also cause issues running build scripts within a user's account when the system tools are desired. These issues can be avoided by not setting the PATH in /etc/profile.d/nix.sh and instead do something like the following: In /etc/profile.d/nix.sh define the following two functions: function enable_nix() { # Add Nix profile dirs to PATH } function disable_nix() { # Remove Nix profile dirs from PATH } so one can type "enable_nix" or "disable_nix" on the command line to turn on or off the ability to use nix. The default should be that nix is off and let the user turn it on manually or in their .profile / .bashrc / .zshrc etc. In this way, the user will enable nix when he/she wants to use it --but it is otherwise disabled.
Thanks for the report Paul! It sounds like it makes sense but I would not do that change downstream. Can you file a feature request upstream and try to settle on a design solution that suits both you and upstream? There is a lot of issues though thus might take a while to sort it out https://github.com/nixos/nix/issues I can suggest a few workarounds: Option 1: Disable profile.d population as 'USE=-etc_profile sys-apps/nix' and add needed code to uer's .rc files Option 2: write a patch agains nix's nix.sh and drop it to /etc/portage/patches/sys-apps/nix (https://wiki.gentoo.org/wiki//etc/portage/patches) Thanks!
I found at my tinderbox images something like this i ´n the error lgos : inderbox@mr-fox ~ $ cat logs/* stat: cannot read file system information for '%u': No such file or directory WARNING: bad ownership on /nix/var/nix/profiles/per-user/root stat: cannot read file system information for '%u': No such file or directory WARNING: bad ownership on /nix/var/nix/gcroots/per-user/root stat: cannot read file system information for '%u': No such file or directory WARNING: bad ownership on /nix/var/nix/profiles/per-user/root stat: cannot read file system information for '%u': No such file or directory WARNING: bad ownership on /nix/var/nix/gcroots/per-user/root
(In reply to Toralf Förster from comment #2) > I found at my tinderbox images something like this i ´n the error lgos : > > inderbox@mr-fox ~ $ cat logs/* > stat: cannot read file system information for '%u': No such file or directory > WARNING: bad ownership on /nix/var/nix/profiles/per-user/root > stat: cannot read file system information for '%u': No such file or directory > WARNING: bad ownership on /nix/var/nix/gcroots/per-user/root > stat: cannot read file system information for '%u': No such file or directory > WARNING: bad ownership on /nix/var/nix/profiles/per-user/root > stat: cannot read file system information for '%u': No such file or directory > WARNING: bad ownership on /nix/var/nix/gcroots/per-user/root This is a bit different bug. Fixed it as: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49ad8d2c53d2f21f4867e147b6ad97cbcb706c79