about summary refs log tree commit diff
path: root/pkgs/development/compilers/dotnet/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/dotnet/default.nix')
-rw-r--r--pkgs/development/compilers/dotnet/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/development/compilers/dotnet/default.nix b/pkgs/development/compilers/dotnet/default.nix
index 53c32121aabc..c2cb6eb37823 100644
--- a/pkgs/development/compilers/dotnet/default.nix
+++ b/pkgs/development/compilers/dotnet/default.nix
@@ -14,6 +14,18 @@ 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";
+    "x86_64-windows" = "win-x64";
+    "i686-windows" = "win-x86";
+  };
+
+  # 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 +33,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