summary refs log tree commit diff
path: root/pkgs/development/tools/continuous-integration/github-runner/default.nix
diff options
context:
space:
mode:
authorVincent Haupert <mail@vincent-haupert.de>2021-12-29 15:25:27 +0100
committerKristoffer Føllesdal <kfollesdal@gmail.com>2021-12-30 00:34:50 +0100
commit8b138c90318712d0a0c19732a32a4d1394f5168f (patch)
tree1c7e65deaa9314509c73a91c6619e7328c05be8c /pkgs/development/tools/continuous-integration/github-runner/default.nix
parentc8b997df95bf0a179cd6e872dc847f4d45d4d389 (diff)
downloadnixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.tar
nixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.tar.gz
nixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.tar.bz2
nixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.tar.lz
nixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.tar.xz
nixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.tar.zst
nixpkgs-8b138c90318712d0a0c19732a32a4d1394f5168f.zip
github-runner: Extend script to update all platform deps
Runs `dotnet restore` for all supported platforms (`x86_64-linux` and
`arm64-linux` at the moment) in the update script.
Diffstat (limited to 'pkgs/development/tools/continuous-integration/github-runner/default.nix')
-rw-r--r--pkgs/development/tools/continuous-integration/github-runner/default.nix22
1 files changed, 13 insertions, 9 deletions
diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix
index a0aedc083a0..239d0c3430b 100644
--- a/pkgs/development/tools/continuous-integration/github-runner/default.nix
+++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix
@@ -33,10 +33,12 @@ let
   );
 
   dotnetSdk = dotnetCorePackages.sdk_6_0;
-  runtimeId =
-    if stdenv.isAarch64
-    then "linux-arm64"
-    else "linux-x64";
+  # Map Nix systems to .NET runtime ids
+  runtimeIds = {
+    "x86_64-linux" = "linux-x64";
+    "aarch64-linux" = "linux-arm64";
+  };
+  runtimeId = runtimeIds.${stdenv.system};
   fakeSha1 = "0000000000000000000000000000000000000000";
 in
 stdenv.mkDerivation rec {
@@ -276,7 +278,7 @@ stdenv.mkDerivation rec {
   # Script to create deps.nix file for dotnet dependencies. Run it with
   # $(nix-build -A github-runner.passthru.createDepsFile)/bin/create-deps-file
   #
-  # Default output path is /tmp/${pname}-deps.nix, but can be override with cli argument.
+  # Default output path is /tmp/${pname}-deps.nix, but can be overriden with cli argument.
   #
   # Inspired by passthru.fetch-deps in pkgs/build-support/build-dotnet-module/default.nix
   passthru.createDepsFile = writeShellApplication {
@@ -295,8 +297,10 @@ stdenv.mkDerivation rec {
 
       mkdir nuget_pkgs
 
-      printf "\n* Restore ${pname} dotnet project\n"
-      dotnet restore src/ActionsRunner.sln --packages nuget_pkgs --no-cache --force --runtime ${runtimeId}
+      ${lib.concatMapStrings (rid: ''
+      printf "\n* Restore ${pname} (${rid}) dotnet project\n"
+      dotnet restore src/ActionsRunner.sln --packages nuget_pkgs --no-cache --force --runtime "${rid}"
+      '') (lib.attrValues runtimeIds)}
 
       cd "$rundir"
       deps_file=''${1-"/tmp/${pname}-deps.nix"}
@@ -310,7 +314,7 @@ stdenv.mkDerivation rec {
     description = "Self-hosted runner for GitHub Actions";
     homepage = "https://github.com/actions/runner";
     license = licenses.mit;
-    maintainers = with maintainers; [ veehaitch newam kfollesdal];
-    platforms = [ "x86_64-linux" "aarch64-linux" ];
+    maintainers = with maintainers; [ veehaitch newam kfollesdal ];
+    platforms = attrNames runtimeIds;
   };
 }