{ buildDotnetModule, darwin, dotnetCorePackages, fetchFromGitHub, fetchpatch, git, glibc, glibcLocales, lib, nixosTests, stdenv, which, buildPackages, runtimeShell, # List of Node.js runtimes the package should support nodeRuntimes ? [ "node20" ], nodejs_20, }: # Node.js runtimes supported by upstream assert builtins.all (x: builtins.elem x [ "node20" ]) nodeRuntimes; buildDotnetModule rec { pname = "github-runner"; version = "2.320.0"; src = fetchFromGitHub { owner = "actions"; repo = "runner"; rev = "v${version}"; hash = "sha256-mVi/Z89R2nbxQAyEkpbcaU3Pc3wK6989QojHew9ad4g="; leaveDotGit = true; postFetch = '' git -C $out rev-parse --short HEAD > $out/.git-revision rm -rf $out/.git ''; }; # The git commit is read during the build and some tests depend on a git repo to be present # https://github.com/actions/runner/blob/22d1938ac420a4cb9e3255e47a91c2e43c38db29/src/dir.proj#L5 unpackPhase = '' cp -r $src $TMPDIR/src chmod -R +w $TMPDIR/src cd $TMPDIR/src ( export PATH=${buildPackages.git}/bin:$PATH git init git config user.email "root@localhost" git config user.name "root" git add . git commit -m "Initial commit" git checkout -b v${version} ) mkdir -p $TMPDIR/bin cat > $TMPDIR/bin/git </dev/null $out/bin/Runner.Listener --help >/dev/null version=$($out/bin/Runner.Listener --version) if [[ "$version" != "${version}" ]]; then printf 'Unexpected version %s' "$version" exit 1 fi commit=$($out/bin/Runner.Listener --commit) if [[ "$commit" != "$(git rev-parse HEAD)" ]]; then printf 'Unexpected commit %s' "$commit" exit 1 fi runHook postInstallCheck ''; passthru = { tests.smoke-test = nixosTests.github-runner; updateScript = ./update.sh; }; meta = with lib; { changelog = "https://github.com/actions/runner/releases/tag/v${version}"; description = "Self-hosted runner for GitHub Actions"; homepage = "https://github.com/actions/runner"; license = licenses.mit; maintainers = with maintainers; [ veehaitch kfollesdal aanderse zimbatm ]; platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; }