lib.systems.elaborate: add libDir attribute

This commit is contained in:
Jeff Huffman 2023-11-24 22:51:50 -05:00
parent ab59f0dacc
commit 94a3c17582
No known key found for this signature in database
GPG key ID: 7F1A93286A8960C7
2 changed files with 9 additions and 6 deletions

View file

@ -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"

View file

@ -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 <<EOF