dotnetCorePackages: move systemToDotnetRid out of sdk

This commit is contained in:
David McFarland 2022-10-03 11:13:17 -03:00
parent d38c3c8484
commit 3fdb6c5a90
7 changed files with 17 additions and 17 deletions

View File

@ -91,7 +91,7 @@ buildDotnetModule rec {
"/p:ExtraDefineConstants=DISABLE_UPDATER" "/p:ExtraDefineConstants=DISABLE_UPDATER"
]; ];
dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.sdk_7_0.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ]; dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
executables = [ executables = [
"Ryujinx.Headless.SDL2" "Ryujinx.Headless.SDL2"

View File

@ -26,7 +26,7 @@ buildDotnetModule rec {
nugetDeps = ./deps.nix; nugetDeps = ./deps.nix;
# Without this dotnet attempts to restore for Windows targets, which it cannot find the dependencies for # 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"; projectFile = "ArchiSteamFarm.sln";
executables = [ "ArchiSteamFarm" ]; executables = [ "ArchiSteamFarm" ];

View File

@ -2,13 +2,11 @@
, stdenvNoCC , stdenvNoCC
, callPackage , callPackage
, writeShellScript , writeShellScript
, writeText
, srcOnly , srcOnly
, linkFarmFromDrvs , linkFarmFromDrvs
, symlinkJoin , symlinkJoin
, makeWrapper , makeWrapper
, dotnetCorePackages , dotnetCorePackages
, dotnetPackages
, mkNugetSource , mkNugetSource
, mkNugetDeps , mkNugetDeps
, nuget-to-nix , nuget-to-nix
@ -167,7 +165,7 @@ stdenvNoCC.mkDerivation (args // {
in in
builtins.filter (flag: !(hasRid flag)) (dotnetFlags ++ dotnetRestoreFlags); builtins.filter (flag: !(hasRid flag)) (dotnetFlags ++ dotnetRestoreFlags);
runtimeIds = map (system: dotnet-sdk.systemToDotnetRid system) platforms; runtimeIds = map (system: dotnetCorePackages.systemToDotnetRid system) platforms;
in in
writeShellScript "fetch-${pname}-deps" '' writeShellScript "fetch-${pname}-deps" ''
set -euo pipefail set -euo pipefail

View File

@ -122,13 +122,6 @@ stdenv.mkDerivation (finalAttrs: rec {
passthru = rec { passthru = rec {
inherit icu packages; inherit icu packages;
runtimeIdentifierMap = {
"x86_64-linux" = "linux-x64";
"aarch64-linux" = "linux-arm64";
"x86_64-darwin" = "osx-x64";
"aarch64-darwin" = "osx-arm64";
};
updateScript = updateScript =
if type == "sdk" then if type == "sdk" then
let let
@ -141,9 +134,6 @@ stdenv.mkDerivation (finalAttrs: rec {
exec ${./update.sh} "${majorVersion}" exec ${./update.sh} "${majorVersion}"
'' else null; '' else null;
# Convert a "stdenv.hostPlatform.system" to a dotnet RID
systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");
tests = { tests = {
version = testers.testVersion { version = testers.testVersion {
package = finalAttrs.finalPackage; package = finalAttrs.finalPackage;

View File

@ -14,6 +14,16 @@ let
buildNetSdk = attrs: buildDotnet (attrs // { type = "sdk"; }); 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 ## ## Files in versions/ are generated automatically by update.sh ##
dotnet_3_1 = import ./versions/3.1.nix (buildAttrs // { icu = icu70; }); dotnet_3_1 = import ./versions/3.1.nix (buildAttrs // { icu = icu70; });
dotnet_5_0 = import ./versions/5.0.nix (buildAttrs // { inherit icu; }); 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; }); dotnet_7_0 = import ./versions/7.0.nix (buildAttrs // { inherit icu; });
in in
rec { rec {
inherit systemToDotnetRid;
combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) {}; combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) {};
# EOL # EOL

View File

@ -26,7 +26,7 @@ buildDotnetModule rec {
dotnet-sdk = dotnetCorePackages.sdk_3_1; dotnet-sdk = dotnetCorePackages.sdk_3_1;
dotnet-runtime = dotnetCorePackages.runtime_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 ]; nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ stdenv.cc.cc.lib ]; buildInputs = [ stdenv.cc.cc.lib ];

View File

@ -34,7 +34,7 @@ buildDotnetModule rec {
patches = [ patches = [
(substituteAll { (substituteAll {
src = ./add-runtime-identifier.patch; src = ./add-runtime-identifier.patch;
runtimeIdentifier = dotnet-sdk.passthru.systemToDotnetRid targetPlatform.system; runtimeIdentifier = dotnetCorePackages.systemToDotnetRid targetPlatform.system;
}) })
]; ];