summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2022-09-26 14:35:14 -0300
committerDavid McFarland <corngood@gmail.com>2022-12-19 15:36:25 -0400
commit824d40aa0400e547c07c054ed7eddcf42b68955e (patch)
tree27a8d2b43ad4eb455b0b21b85684ebb265106bb2
parent13861970f4ae8d029d6609ece5c31200233d49f4 (diff)
downloadnixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.tar
nixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.tar.gz
nixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.tar.bz2
nixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.tar.lz
nixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.tar.xz
nixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.tar.zst
nixpkgs-824d40aa0400e547c07c054ed7eddcf42b68955e.zip
build-dotnet-module: restore for current runtime by default
-rw-r--r--doc/languages-frameworks/dotnet.section.md1
-rw-r--r--pkgs/applications/blockchains/wasabibackend/default.nix2
-rw-r--r--pkgs/applications/emulators/ryujinx/default.nix2
-rw-r--r--pkgs/applications/misc/ArchiSteamFarm/default.nix3
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/default.nix22
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix7
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh2
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh1
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh3
-rw-r--r--pkgs/development/dotnet-modules/python-language-server/default.nix2
-rw-r--r--pkgs/development/tools/omnisharp-roslyn/default.nix1
-rw-r--r--pkgs/games/osu-lazer/default.nix4
-rw-r--r--pkgs/games/xivlauncher/default.nix6
-rw-r--r--pkgs/servers/jellyfin/default.nix16
-rw-r--r--pkgs/tools/games/ps3-disc-dumper/default.nix4
15 files changed, 21 insertions, 55 deletions
diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md
index 1baa135ae58..bfb193b1f02 100644
--- a/doc/languages-frameworks/dotnet.section.md
+++ b/doc/languages-frameworks/dotnet.section.md
@@ -121,7 +121,6 @@ in buildDotnetModule rec {
 
   dotnet-sdk = dotnetCorePackages.sdk_3_1;
   dotnet-runtime = dotnetCorePackages.net_5_0;
-  dotnetFlags = [ "--runtime linux-x64" ];
 
   executables = [ "foo" ]; # This wraps "$out/lib/$pname/foo" to `$out/bin/foo`.
   executables = []; # Don't install any executables.
diff --git a/pkgs/applications/blockchains/wasabibackend/default.nix b/pkgs/applications/blockchains/wasabibackend/default.nix
index 4eca512bf48..e4e97cae21a 100644
--- a/pkgs/applications/blockchains/wasabibackend/default.nix
+++ b/pkgs/applications/blockchains/wasabibackend/default.nix
@@ -25,8 +25,6 @@ buildDotnetModule rec {
   dotnet-sdk = dotnetCorePackages.sdk_3_1;
   dotnet-runtime = dotnetCorePackages.aspnetcore_3_1;
 
-  dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system}" ];
-
   nativeBuildInputs = [ autoPatchelfHook ];
   buildInputs = [ stdenv.cc.cc.lib zlib ];
 
diff --git a/pkgs/applications/emulators/ryujinx/default.nix b/pkgs/applications/emulators/ryujinx/default.nix
index e65dda41dc2..7f13892b936 100644
--- a/pkgs/applications/emulators/ryujinx/default.nix
+++ b/pkgs/applications/emulators/ryujinx/default.nix
@@ -91,8 +91,6 @@ buildDotnetModule rec {
     "/p:ExtraDefineConstants=DISABLE_UPDATER"
   ];
 
-  dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
-
   executables = [
     "Ryujinx.Headless.SDL2"
     "Ryujinx.Ava"
diff --git a/pkgs/applications/misc/ArchiSteamFarm/default.nix b/pkgs/applications/misc/ArchiSteamFarm/default.nix
index 6d735c26b42..7896604b0e9 100644
--- a/pkgs/applications/misc/ArchiSteamFarm/default.nix
+++ b/pkgs/applications/misc/ArchiSteamFarm/default.nix
@@ -25,9 +25,6 @@ buildDotnetModule rec {
 
   nugetDeps = ./deps.nix;
 
-  # Without this dotnet attempts to restore for Windows targets, which it cannot find the dependencies for
-  dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
-
   projectFile = "ArchiSteamFarm.sln";
   executables = [ "ArchiSteamFarm" ];
 
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
index 17a82677c14..7f05a3a4eec 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix
+++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
@@ -59,6 +59,9 @@
   # Libraries that need to be available at runtime should be passed through this.
   # These get wrapped into `LD_LIBRARY_PATH`.
 , runtimeDeps ? [ ]
+  # The dotnet runtime ID. If null, fetch-deps will gather dependencies for all
+  # platforms in meta.platforms which are supported by the sdk.
+, runtimeId ? null
 
   # Tests to disable. This gets passed to `dotnet test --filter "FullyQualifiedName!={}"`, to ensure compatibility with all frameworks.
   # See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details for more details.
@@ -90,6 +93,10 @@ let
 
   inherit (callPackage ./hooks {
     inherit dotnet-sdk dotnet-test-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType;
+    runtimeId =
+      if runtimeId != null
+      then runtimeId
+      else dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system;
   }) dotnetConfigureHook dotnetBuildHook dotnetCheckHook dotnetInstallHook dotnetFixupHook;
 
   localDeps =
@@ -156,16 +163,11 @@ stdenvNoCC.mkDerivation (args // {
 
     fetch-deps =
       let
-        # Derivations may set flags such as `--runtime <rid>` based on the host platform to avoid restoring/building nuget dependencies they dont have or dont need.
-        # This introduces an issue; In this script we loop over all platforms from `meta` and add the RID flag for it, as to fetch all required dependencies.
-        # The script would inherit the RID flag from the derivation based on the platform building the script, and set the flag for any iteration we do over the RIDs.
-        # That causes conflicts. To circumvent it we remove all occurances of the flag.
-        flags =
-          let
-            isRuntime = flag: lib.hasPrefix "--runtime" flag;
-          in
-            builtins.filter (flag: !(isRuntime flag)) (dotnetFlags ++ dotnetRestoreFlags);
-        runtimeIds = map (system: dotnetCorePackages.systemToDotnetRid system) platforms;
+        flags = dotnetFlags ++ dotnetRestoreFlags;
+        runtimeIds =
+          if runtimeId != null
+          then [ runtimeId ]
+          else map (system: dotnetCorePackages.systemToDotnetRid system) platforms;
       in
       writeShellScript "fetch-${pname}-deps" ''
         set -euo pipefail
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 1cc88602ff4..2309ae6240d 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix
+++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix
@@ -9,7 +9,9 @@
 , dotnet-runtime
 , runtimeDeps
 , buildType
+, runtimeId
 }:
+assert (builtins.isString runtimeId);
 
 let
   libraryPath = lib.makeLibraryPath runtimeDeps;
@@ -21,6 +23,7 @@ in
       deps = [ dotnet-sdk nuget-source ];
       substitutions = {
         nugetSource = nuget-source;
+        inherit runtimeId;
       };
     } ./dotnet-configure-hook.sh) { };
 
@@ -29,7 +32,7 @@ in
       name = "dotnet-build-hook";
       deps = [ dotnet-sdk ];
       substitutions = {
-        inherit buildType;
+        inherit buildType runtimeId;
       };
     } ./dotnet-build-hook.sh) { };
 
@@ -49,7 +52,7 @@ in
       name = "dotnet-install-hook";
       deps = [ dotnet-sdk ];
       substitutions = {
-        inherit buildType;
+        inherit buildType runtimeId;
       };
     } ./dotnet-install-hook.sh) { };
 
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh
index 782c170b0bb..8f7f7733935 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh
+++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh
@@ -15,7 +15,7 @@ dotnetBuildHook() {
     fi
 
     if [ "${selfContainedBuild-}" ]; then
-        dotnetBuildFlags+=("-p:SelfContained=true")
+        dotnetBuildFlags+=(--runtime "@runtimeId@" "-p:SelfContained=true")
     else
         dotnetBuildFlags+=("-p:SelfContained=false")
     fi
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 3479f58bb38..1e33ebbaef7 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
@@ -18,6 +18,7 @@ dotnetConfigureHook() {
         env dotnet restore ${project-} \
             -p:ContinuousIntegrationBuild=true \
             -p:Deterministic=true \
+            --runtime "@runtimeId@" \
             --source "@nugetSource@/lib" \
             ${parallelFlag-} \
             ${dotnetRestoreFlags[@]} \
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh
index 196d2ca1af7..831059f941c 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh
+++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh
@@ -7,7 +7,7 @@ dotnetInstallHook() {
     runHook preInstall
 
     if [ "${selfContainedBuild-}" ]; then
-        dotnetInstallFlags+=("--self-contained")
+        dotnetInstallFlags+=(--runtime "@runtimeId@" "--self-contained")
     else
         dotnetInstallFlags+=("--no-self-contained")
     fi
@@ -21,7 +21,6 @@ dotnetInstallHook() {
         env dotnet publish ${project-} \
             -p:ContinuousIntegrationBuild=true \
             -p:Deterministic=true \
-            -p:UseAppHost=true \
             --output "$out/lib/${pname}" \
             --configuration "@buildType@" \
             --no-build \
diff --git a/pkgs/development/dotnet-modules/python-language-server/default.nix b/pkgs/development/dotnet-modules/python-language-server/default.nix
index 4ef76c81ac9..3044e884e3c 100644
--- a/pkgs/development/dotnet-modules/python-language-server/default.nix
+++ b/pkgs/development/dotnet-modules/python-language-server/default.nix
@@ -26,8 +26,6 @@ buildDotnetModule rec {
   dotnet-sdk = dotnetCorePackages.sdk_3_1;
   dotnet-runtime = dotnetCorePackages.runtime_3_1;
 
-  dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
-
   nativeBuildInputs = [ autoPatchelfHook ];
   buildInputs = [ stdenv.cc.cc.lib ];
   runtimeDeps = [ openssl icu ];
diff --git a/pkgs/development/tools/omnisharp-roslyn/default.nix b/pkgs/development/tools/omnisharp-roslyn/default.nix
index 0d42c494ce1..0fc9952b592 100644
--- a/pkgs/development/tools/omnisharp-roslyn/default.nix
+++ b/pkgs/development/tools/omnisharp-roslyn/default.nix
@@ -29,7 +29,6 @@ let finalPackage = buildDotnetModule rec {
     patchelf
   ];
 
-  dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system}" ];
   dotnetInstallFlags = [ "--framework net6.0" ];
   dotnetBuildFlags = [ "--framework net6.0" "--no-self-contained" ];
   dotnetFlags = [
diff --git a/pkgs/games/osu-lazer/default.nix b/pkgs/games/osu-lazer/default.nix
index cfcb69625d8..f400c0e3e13 100644
--- a/pkgs/games/osu-lazer/default.nix
+++ b/pkgs/games/osu-lazer/default.nix
@@ -28,10 +28,6 @@ buildDotnetModule rec {
 
   nativeBuildInputs = [ copyDesktopItems ];
 
-  dotnetFlags = [
-    "--runtime linux-x64"
-  ];
-
   runtimeDeps = [
     ffmpeg
     alsa-lib
diff --git a/pkgs/games/xivlauncher/default.nix b/pkgs/games/xivlauncher/default.nix
index 0bd586d458c..b8560f2b413 100644
--- a/pkgs/games/xivlauncher/default.nix
+++ b/pkgs/games/xivlauncher/default.nix
@@ -23,12 +23,8 @@ in
     nugetDeps = ./deps.nix; # File generated with `nix-build -A xivlauncher.passthru.fetch-deps`
 
     dotnetFlags = [
-      "--runtime linux-x64"
       "-p:BuildHash=${rev}"
-    ];
-
-    dotnetBuildFlags = [
-      "--no-self-contained"
+      "-p:PublishSingleFile=false"
     ];
 
     postPatch = ''
diff --git a/pkgs/servers/jellyfin/default.nix b/pkgs/servers/jellyfin/default.nix
index 4848dcba9f0..1943d107ad0 100644
--- a/pkgs/servers/jellyfin/default.nix
+++ b/pkgs/servers/jellyfin/default.nix
@@ -12,21 +12,6 @@
 , sqlite
 }:
 
-let
-  os = if stdenv.isDarwin then "osx" else "linux";
-  arch =
-    with stdenv.hostPlatform;
-    if isx86_32 then "x86"
-    else if isx86_64 then "x64"
-    else if isAarch32 then "arm"
-    else if isAarch64 then "arm64"
-    else lib.warn "Unsupported architecture, some image processing features might be unavailable" "unknown";
-  musl = lib.optionalString stdenv.hostPlatform.isMusl
-    (lib.warnIf (arch != "x64") "Some image processing features might be unavailable for non x86-64 with Musl"
-      "musl-");
-  # https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#using-rids
-  runtimeId = "${os}-${musl}${arch}";
-in
 buildDotnetModule rec {
   pname = "jellyfin";
   version = "10.8.8"; # ensure that jellyfin-web has matching version
@@ -57,7 +42,6 @@ buildDotnetModule rec {
   ];
   dotnet-sdk = dotnetCorePackages.sdk_6_0;
   dotnet-runtime = dotnetCorePackages.aspnetcore_6_0;
-  dotnetFlags = [ "--runtime=${runtimeId}" ];
   dotnetBuildFlags = [ "--no-self-contained" ];
 
   preInstall = ''
diff --git a/pkgs/tools/games/ps3-disc-dumper/default.nix b/pkgs/tools/games/ps3-disc-dumper/default.nix
index 523ae25a949..577be973848 100644
--- a/pkgs/tools/games/ps3-disc-dumper/default.nix
+++ b/pkgs/tools/games/ps3-disc-dumper/default.nix
@@ -27,10 +27,6 @@ buildDotnetModule rec {
     openssl
   ];
 
-  dotnetFlags = [
-    "--runtime linux-x64"
-  ];
-
   meta = with lib; {
     homepage = "https://github.com/13xforever/ps3-disc-dumper";
     description = "A handy utility to make decrypted PS3 disc dumps";