From 3fdb6c5a9010690eb4c2676dcc40693094de590d Mon Sep 17 00:00:00 2001 From: David McFarland Date: Mon, 3 Oct 2022 11:13:17 -0300 Subject: [PATCH] dotnetCorePackages: move systemToDotnetRid out of sdk --- pkgs/applications/emulators/ryujinx/default.nix | 2 +- pkgs/applications/misc/ArchiSteamFarm/default.nix | 2 +- .../dotnet/build-dotnet-module/default.nix | 4 +--- pkgs/development/compilers/dotnet/build-dotnet.nix | 10 ---------- pkgs/development/compilers/dotnet/default.nix | 12 ++++++++++++ .../python-language-server/default.nix | 2 +- pkgs/games/BeatSaberModManager/default.nix | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pkgs/applications/emulators/ryujinx/default.nix b/pkgs/applications/emulators/ryujinx/default.nix index 90687a4e191d..e65dda41dc25 100644 --- a/pkgs/applications/emulators/ryujinx/default.nix +++ b/pkgs/applications/emulators/ryujinx/default.nix @@ -91,7 +91,7 @@ buildDotnetModule rec { "/p:ExtraDefineConstants=DISABLE_UPDATER" ]; - dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.sdk_7_0.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ]; + dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ]; executables = [ "Ryujinx.Headless.SDL2" diff --git a/pkgs/applications/misc/ArchiSteamFarm/default.nix b/pkgs/applications/misc/ArchiSteamFarm/default.nix index 878924c20e77..6d735c26b425 100644 --- a/pkgs/applications/misc/ArchiSteamFarm/default.nix +++ b/pkgs/applications/misc/ArchiSteamFarm/default.nix @@ -26,7 +26,7 @@ buildDotnetModule rec { nugetDeps = ./deps.nix; # Without this dotnet attempts to restore for Windows targets, which it cannot find the dependencies for - dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.sdk_6_0.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ]; + 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 89d423c80d72..237aaad50d25 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -2,13 +2,11 @@ , stdenvNoCC , callPackage , writeShellScript -, writeText , srcOnly , linkFarmFromDrvs , symlinkJoin , makeWrapper , dotnetCorePackages -, dotnetPackages , mkNugetSource , mkNugetDeps , nuget-to-nix @@ -167,7 +165,7 @@ stdenvNoCC.mkDerivation (args // { in builtins.filter (flag: !(hasRid flag)) (dotnetFlags ++ dotnetRestoreFlags); - runtimeIds = map (system: dotnet-sdk.systemToDotnetRid system) platforms; + runtimeIds = map (system: dotnetCorePackages.systemToDotnetRid system) platforms; in writeShellScript "fetch-${pname}-deps" '' set -euo pipefail diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix index e25a8a1464fe..308bd64dc7fd 100644 --- a/pkgs/development/compilers/dotnet/build-dotnet.nix +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -122,13 +122,6 @@ stdenv.mkDerivation (finalAttrs: rec { passthru = rec { inherit icu packages; - runtimeIdentifierMap = { - "x86_64-linux" = "linux-x64"; - "aarch64-linux" = "linux-arm64"; - "x86_64-darwin" = "osx-x64"; - "aarch64-darwin" = "osx-arm64"; - }; - updateScript = if type == "sdk" then let @@ -141,9 +134,6 @@ stdenv.mkDerivation (finalAttrs: rec { exec ${./update.sh} "${majorVersion}" '' else null; - # Convert a "stdenv.hostPlatform.system" to a dotnet RID - systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}"); - tests = { version = testers.testVersion { package = finalAttrs.finalPackage; diff --git a/pkgs/development/compilers/dotnet/default.nix b/pkgs/development/compilers/dotnet/default.nix index 53c32121aabc..aa29ab80ac89 100644 --- a/pkgs/development/compilers/dotnet/default.nix +++ b/pkgs/development/compilers/dotnet/default.nix @@ -14,6 +14,16 @@ let buildNetSdk = attrs: buildDotnet (attrs // { type = "sdk"; }); }; + runtimeIdentifierMap = { + "x86_64-linux" = "linux-x64"; + "aarch64-linux" = "linux-arm64"; + "x86_64-darwin" = "osx-x64"; + "aarch64-darwin" = "osx-arm64"; + }; + + # Convert a "stdenv.hostPlatform.system" to a dotnet RID + systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}"); + ## Files in versions/ are generated automatically by update.sh ## dotnet_3_1 = import ./versions/3.1.nix (buildAttrs // { icu = icu70; }); dotnet_5_0 = import ./versions/5.0.nix (buildAttrs // { inherit icu; }); @@ -21,6 +31,8 @@ let dotnet_7_0 = import ./versions/7.0.nix (buildAttrs // { inherit icu; }); in rec { + inherit systemToDotnetRid; + combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) {}; # EOL diff --git a/pkgs/development/dotnet-modules/python-language-server/default.nix b/pkgs/development/dotnet-modules/python-language-server/default.nix index a197f158bb6b..4ef76c81ac9b 100644 --- a/pkgs/development/dotnet-modules/python-language-server/default.nix +++ b/pkgs/development/dotnet-modules/python-language-server/default.nix @@ -26,7 +26,7 @@ buildDotnetModule rec { dotnet-sdk = dotnetCorePackages.sdk_3_1; dotnet-runtime = dotnetCorePackages.runtime_3_1; - dotnetRestoreFlags = [ "--runtime ${dotnet-sdk.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ]; + dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ]; nativeBuildInputs = [ autoPatchelfHook ]; buildInputs = [ stdenv.cc.cc.lib ]; diff --git a/pkgs/games/BeatSaberModManager/default.nix b/pkgs/games/BeatSaberModManager/default.nix index 8d607268dc64..ceef75f4585e 100644 --- a/pkgs/games/BeatSaberModManager/default.nix +++ b/pkgs/games/BeatSaberModManager/default.nix @@ -34,7 +34,7 @@ buildDotnetModule rec { patches = [ (substituteAll { src = ./add-runtime-identifier.patch; - runtimeIdentifier = dotnet-sdk.passthru.systemToDotnetRid targetPlatform.system; + runtimeIdentifier = dotnetCorePackages.systemToDotnetRid targetPlatform.system; }) ];