diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index a689cbcfb68e..15fe5a2c5d41 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -96,9 +96,13 @@ in stdenvNoCC.mkDerivation (args // { dotnetInstallHook dotnetFixupHook - dotnet-sdk cacert makeWrapper + dotnet-sdk + ]; + + makeWrapperArgs = args.makeWrapperArgs or [ ] ++ [ + "--prefix LD_LIBRARY_PATH : ${dotnet-sdk.icu}/lib" ]; # Stripping breaks the executable diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix index 5f5916d08b19..1cc88602ff4c 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix @@ -56,7 +56,7 @@ in dotnetFixupHook = callPackage ({ }: makeSetupHook { name = "dotnet-fixup-hook"; - deps = [ dotnet-runtime makeWrapper ]; + deps = [ dotnet-runtime ]; substitutions = { dotnetRuntime = dotnet-runtime; runtimeDeps = libraryPath; diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh index 1686c15d2693..3e8c14189500 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh @@ -1,6 +1,6 @@ declare -a projectFile testProjectFile -# inherit arguments from derivation +# Inherit arguments from derivation dotnetFlags=( ${dotnetFlags[@]-} ) dotnetRestoreFlags=( ${dotnetRestoreFlags[@]-} ) diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix index e16049e8594b..11150ec7ca16 100644 --- a/pkgs/development/compilers/dotnet/build-dotnet.nix +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -4,12 +4,14 @@ , icu #passing icu as an argument, because dotnet 3.1 has troubles with icu71 }: -assert builtins.elem type [ "aspnetcore" "runtime" "sdk"]; +assert builtins.elem type [ "aspnetcore" "runtime" "sdk" ]; { lib , stdenv , fetchurl , writeText +, autoPatchelfHook +, makeWrapper , libunwind , openssl , libuuid @@ -19,19 +21,21 @@ assert builtins.elem type [ "aspnetcore" "runtime" "sdk"]; }: let - pname = if type == "aspnetcore" then - "aspnetcore-runtime" - else if type == "runtime" then - "dotnet-runtime" - else - "dotnet-sdk"; + pname = + if type == "aspnetcore" then + "aspnetcore-runtime" + else if type == "runtime" then + "dotnet-runtime" + else + "dotnet-sdk"; descriptions = { aspnetcore = "ASP.NET Core Runtime ${version}"; runtime = ".NET Runtime ${version}"; sdk = ".NET SDK ${version}"; }; -in stdenv.mkDerivation rec { +in +stdenv.mkDerivation rec { inherit pname version; # Some of these dependencies are `dlopen()`ed. @@ -47,8 +51,19 @@ in stdenv.mkDerivation rec { lttng-ust_2_12 ]); - src = fetchurl (srcs."${stdenv.hostPlatform.system}" or (throw - "Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")); + nativeBuildInputs = [ + autoPatchelfHook + makeWrapper + ]; + + buildInputs = [ + stdenv.cc.cc + ]; + + src = fetchurl ( + srcs."${stdenv.hostPlatform.system}" or (throw + "Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}") + ); sourceRoot = "."; @@ -68,10 +83,16 @@ in stdenv.mkDerivation rec { patchelf --set-rpath "${rpath}" $out/dotnet find $out -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \; find $out -type f \( -name "apphost" -or -name "createdump" \) -exec patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" --set-rpath '$ORIGIN:${rpath}' {} \; + + wrapProgram $out/bin/dotnet \ + --prefix LD_LIBRARY_PATH : ${icu}/lib ''; doInstallCheck = true; installCheckPhase = '' + # Fixes cross + export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 + $out/bin/dotnet --info ''; @@ -85,6 +106,10 @@ in stdenv.mkDerivation rec { export DOTNET_CLI_TELEMETRY_OPTOUT=1 ''; + passthru = { + inherit icu; + }; + meta = with lib; { description = builtins.getAttr type descriptions; homepage = "https://dotnet.github.io/";