diff --git a/pkgs/applications/audio/galaxy-buds-client/default.nix b/pkgs/applications/audio/galaxy-buds-client/default.nix index 15125358e464..6dd2256d7c8a 100644 --- a/pkgs/applications/audio/galaxy-buds-client/default.nix +++ b/pkgs/applications/audio/galaxy-buds-client/default.nix @@ -2,7 +2,6 @@ , stdenv , buildDotnetModule , fetchFromGitHub -, autoPatchelfHook , fontconfig , xorg , libglvnd @@ -27,7 +26,6 @@ buildDotnetModule rec { dotnetFlags = [ "-p:Runtimeidentifier=linux-x64" ]; nativeBuildInputs = [ - autoPatchelfHook copyDesktopItems graphicsmagick ]; diff --git a/pkgs/applications/blockchains/wasabibackend/default.nix b/pkgs/applications/blockchains/wasabibackend/default.nix index 79355f3979dc..1371be1a9752 100644 --- a/pkgs/applications/blockchains/wasabibackend/default.nix +++ b/pkgs/applications/blockchains/wasabibackend/default.nix @@ -4,7 +4,6 @@ fetchFromGitHub, buildDotnetModule, dotnetCorePackages, - autoPatchelfHook, zlib, openssl, }: @@ -25,7 +24,6 @@ buildDotnetModule rec { dotnet-sdk = dotnetCorePackages.sdk_7_0; dotnet-runtime = dotnetCorePackages.aspnetcore_7_0; - nativeBuildInputs = [autoPatchelfHook]; buildInputs = [stdenv.cc.cc.lib zlib]; runtimeDeps = [openssl zlib]; diff --git a/pkgs/applications/misc/avalonia-ilspy/default.nix b/pkgs/applications/misc/avalonia-ilspy/default.nix index 797a8ffe5c93..d8ae98e66acd 100644 --- a/pkgs/applications/misc/avalonia-ilspy/default.nix +++ b/pkgs/applications/misc/avalonia-ilspy/default.nix @@ -15,7 +15,6 @@ , makeDesktopItem , copyDesktopItems , icoutils -, autoPatchelfHook , bintools , fixDarwinDylibNames , autoSignDarwinBinariesHook @@ -40,8 +39,7 @@ buildDotnetModule rec { nativeBuildInputs = [ copyDesktopItems icoutils - ] ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ bintools fixDarwinDylibNames ] + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ bintools fixDarwinDylibNames ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ autoSignDarwinBinariesHook ]; buildInputs = [ 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 = { diff --git a/pkgs/development/compilers/dotnet/common.nix b/pkgs/development/compilers/dotnet/common.nix index a757dd36d17b..49f3e3be4d77 100644 --- a/pkgs/development/compilers/dotnet/common.nix +++ b/pkgs/development/compilers/dotnet/common.nix @@ -63,7 +63,7 @@ '' + build); in if run == null - then build + then built else runCommand "${built.name}-run" { src = built; nativeBuildInputs = runInputs; } ( lib.optionalString (runtime != null) '' @@ -71,8 +71,10 @@ export DOTNET_ROOT=${runtime} '' + run); + # Setting LANG to something other than 'C' forces the runtime to search + # for ICU, which will be required in most user environments. checkConsoleOutput = command: '' - output="$(${command})" + output="$(LANG=C.UTF-8 ${command})" # yes, older SDKs omit the comma [[ "$output" =~ Hello,?\ World! ]] && touch "$out" ''; @@ -98,6 +100,15 @@ run = checkConsoleOutput "$src/test"; }; + self-contained = mkDotnetTest { + name = "self-contained"; + template = "console"; + usePackageSource = true; + build = "dotnet publish --use-current-runtime --sc -o $out"; + runtime = null; + run = checkConsoleOutput "$src/test"; + }; + single-file = mkDotnetTest { name = "single-file"; template = "console"; diff --git a/pkgs/development/compilers/inklecate/default.nix b/pkgs/development/compilers/inklecate/default.nix index fa701d8fd269..52c278a1bd30 100644 --- a/pkgs/development/compilers/inklecate/default.nix +++ b/pkgs/development/compilers/inklecate/default.nix @@ -1,6 +1,5 @@ { lib , stdenv -, autoPatchelfHook , buildDotnetModule , dotnetCorePackages , fetchFromGitHub @@ -17,7 +16,6 @@ buildDotnetModule rec { hash = "sha512-aUjjT5Qf64wrKRn1vkwJadMOBWMkvsXUjtZ7S3/ZWAh1CCDkQNO84mSbtbVc9ny0fKeJEqaDX2tJNwq7pYqAbA=="; }; - nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; buildInputs = [ stdenv.cc.cc.lib ]; projectFile = "inklecate/inklecate.csproj"; diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index e9aace248d86..34aaf68bb0ff 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -1,5 +1,4 @@ -{ autoPatchelfHook -, autoSignDarwinBinariesHook +{ autoSignDarwinBinariesHook , buildDotnetModule , dotnetCorePackages , fetchFromGitHub @@ -114,8 +113,6 @@ buildDotnetModule rec { nativeBuildInputs = [ which git - ] ++ lib.optionals stdenv.isLinux [ - autoPatchelfHook ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]; diff --git a/pkgs/tools/games/opentracker/default.nix b/pkgs/tools/games/opentracker/default.nix index 6bb5fc8ff207..5bab19fa2ad9 100644 --- a/pkgs/tools/games/opentracker/default.nix +++ b/pkgs/tools/games/opentracker/default.nix @@ -3,7 +3,6 @@ stdenv, buildDotnetModule, fetchFromGitHub, - autoPatchelfHook, wrapGAppsHook, dotnetCorePackages, fontconfig, @@ -40,7 +39,6 @@ buildDotnetModule rec { ]; nativeBuildInputs = [ - autoPatchelfHook wrapGAppsHook ]; @@ -64,12 +62,6 @@ buildDotnetModule rec { libXi ]); - # Attempts to patchelf unneeded SOs - autoPatchelfIgnoreMissingDeps = [ - "libc.musl-x86_64.so.1" - "libintl.so.8" - ]; - meta = with lib; { description = "A tracking application for A Link to the Past Randomizer"; homepage = "https://github.com/trippsc2/OpenTracker"; diff --git a/pkgs/tools/networking/mqttmultimeter/default.nix b/pkgs/tools/networking/mqttmultimeter/default.nix index e2d6f4e6fbd3..1c2c290bef78 100644 --- a/pkgs/tools/networking/mqttmultimeter/default.nix +++ b/pkgs/tools/networking/mqttmultimeter/default.nix @@ -4,7 +4,6 @@ , dotnet-runtime_8 , buildDotnetModule , fetchFromGitHub -, autoPatchelfHook , fontconfig , xorg , libglvnd @@ -12,9 +11,6 @@ , copyDesktopItems }: -# NOTES: -# 1. we need autoPatchelfHook for quite a number of things in $out/lib - buildDotnetModule rec { pname = "mqttmultimeter"; version = "1.8.2.272"; @@ -35,13 +31,11 @@ buildDotnetModule rec { executables = [ "mqttMultimeter" ]; nativeBuildInputs = [ - autoPatchelfHook copyDesktopItems ]; buildInputs = [ stdenv.cc.cc.lib fontconfig ]; - # don't care about musl and windows versions, as they fail autoPatchelfHook postInstall = '' rm -rf $out/lib/${lib.toLower pname}/runtimes/{*musl*,win*} '';