From bd934093f4dd2528403f5ee8aa67788e8843d238 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Wed, 17 Apr 2024 09:41:51 -0300 Subject: [PATCH] dotnet: patch apphost as well as singlefilehost This fixes library loading in self-contained builds. --- pkgs/development/compilers/dotnet/build-dotnet.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix index 8ee0bd9e7b3a..f6802e62c70d 100644 --- a/pkgs/development/compilers/dotnet/build-dotnet.nix +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -25,6 +25,7 @@ assert if type == "sdk" then packages != null else true; , writeShellScript , mkNugetDeps , callPackage +, dotnetCorePackages }: let @@ -44,6 +45,8 @@ let mkCommon = callPackage ./common.nix {}; + targetRid = dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system; + in mkCommon type rec { inherit pname version; @@ -88,21 +91,21 @@ mkCommon type rec { # Tell autoPatchelf about runtime dependencies. # (postFixup phase is run before autoPatchelfHook.) - postFixup = lib.optionalString stdenv.isLinux '' + postFixup = lib.optionalString stdenv.targetPlatform.isLinux '' patchelf \ --add-needed libicui18n.so \ --add-needed libicuuc.so \ $out/shared/Microsoft.NETCore.App/*/libcoreclr.so \ $out/shared/Microsoft.NETCore.App/*/*System.Globalization.Native.so \ - $out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost + $out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host patchelf \ --add-needed libgssapi_krb5.so \ $out/shared/Microsoft.NETCore.App/*/*System.Net.Security.Native.so \ - $out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost + $out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host patchelf \ --add-needed libssl.so \ $out/shared/Microsoft.NETCore.App/*/*System.Security.Cryptography.Native.OpenSsl.so \ - $out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost + $out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host ''; passthru = {