From 260335ada9bf01919f467e6609a8c993c77f2892 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 23 Jan 2026 22:47:27 +0000 Subject: [PATCH] glibc: Fix _CS_PATH to include default profile 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 --- .../libraries/glibc/fix_path_attribute_in_getconf.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch b/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch index 714e49db5607..d9733257d34a 100644 --- a/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch +++ b/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch @@ -3,4 +3,4 @@ diff -ubr glibc-2.17-orig/sysdeps/unix/confstr.h glibc-2.17/sysdeps/unix/confstr +++ glibc-2.17/sysdeps/unix/confstr.h 2013-06-03 22:04:39.469376740 +0200 @@ -1 +1 @@ -#define CS_PATH "/bin:/usr/bin" -+#define CS_PATH "/run/current-system/sw/bin:/bin:/usr/bin" ++#define CS_PATH "/run/current-system/sw/bin:/bin:/usr/bin:/nix/var/nix/profiles/default/bin"