diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 9eec21cbf21b..6137d47e91a2 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -89,6 +89,13 @@ rec { # is why we use the more obscure "bfd" and not "binutils" for this # choice. else "bfd"; + # The standard lib directory name that non-nixpkgs binaries distributed + # for this platform normally assume. + libDir = if final.isLinux then + if final.isx86_64 || final.isMips64 || final.isPower64 + then "lib64" + else "lib" + else null; extensions = lib.optionalAttrs final.hasSharedLibraries { sharedLibrary = if final.isDarwin then ".dylib" diff --git a/pkgs/os-specific/linux/nix-ld/default.nix b/pkgs/os-specific/linux/nix-ld/default.nix index 5eebe6773147..bb6489ecdb17 100644 --- a/pkgs/os-specific/linux/nix-ld/default.nix +++ b/pkgs/os-specific/linux/nix-ld/default.nix @@ -5,11 +5,7 @@ , ninja , nixosTests }: -let - libDir = if builtins.elem stdenv.system [ "x86_64-linux" "mips64-linux" "powerpc64le-linux" ] - then "/lib64" - else "/lib"; -in + stdenv.mkDerivation rec { pname = "nix-ld"; version = "1.2.2"; @@ -36,7 +32,7 @@ stdenv.mkDerivation rec { postInstall = '' mkdir -p $out/nix-support - ldpath=${libDir}/$(basename $(< ${stdenv.cc}/nix-support/dynamic-linker)) + ldpath=/${stdenv.hostPlatform.libDir}/$(basename $(< ${stdenv.cc}/nix-support/dynamic-linker)) echo "$ldpath" > $out/nix-support/ldpath mkdir -p $out/lib/tmpfiles.d/ cat > $out/lib/tmpfiles.d/nix-ld.conf <