The string returned by confstr(_CS_PATH)[*1], which is also the
output of the command 'getconf PATH'[*2], contains a default path
that is guaranteed to find (at least) all POSIX standard utilities.
The current value is:
/run/current-system/sw/bin:/bin:/usr/bin
The default profile binaries directory is not in it. This is a problem
because the default NixOS installation lacks several mandatory standard
POSIX utilities. The command recommended by the system's error message
for a missing command to install a missing package foo is 'nix-env -iA
nixos.foo'. When this is done as root, the corresponding binaries are
installed for all users in /nix/var/nix/profiles/default/bin.
This commit fixes these problems as follows:
pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch:
- CS_PATH: Add default profile path '/nix/var/nix/profiles/default/bin'
at the end.
- Retain /bin:/usr/bin; it is necessary for third-party sytems that use
nixpkgs, linking against the nixpkgs version of glibc. It is retained
*before* the profile directory to avoid overriding native system
utilities on these systems (at least those that in fact store them in
/bin and /usr/bin).
[*1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/confstr.html
[*2] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/getconf.html
Fixes: https://github.com/NixOS/nixpkgs/issues/65512