DETERMINATE_NIX_KVM fixup, support Magic Nix Cache + FlakeHub Cache on Namespace runners #72

Merged
grahamc merged 16 commits from mnc into main 2024-03-11 23:53:26 +00:00
5 changed files with 40 additions and 10 deletions

View file

@ -16,15 +16,18 @@ jobs:
- run: npm run all - run: npm run all
- run: git status --porcelain=v1 - run: git status --porcelain=v1
- run: test $(git status --porcelain=v1 2>/dev/null | wc -l) -eq 0 - run: test $(git status --porcelain=v1 2>/dev/null | wc -l) -eq 0
run-x86_64-linux: run-test-suite:
name: Run x86_64 Linux name: Run test suite
strategy: strategy:
matrix: matrix:
runner: runner:
- ubuntu-latest - ubuntu-latest
- nscloud-ubuntu-22.04-amd64-4x16 - nscloud-ubuntu-22.04-amd64-4x16
- namespace-profile-default-arm64 - namespace-profile-default-arm64
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
permissions:
contents: read
id-token: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Nix - name: Install Nix
@ -33,8 +36,15 @@ jobs:
logger: pretty logger: pretty
log-directives: nix_installer=trace log-directives: nix_installer=trace
backtrace: full backtrace: full
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: echo $PATH - name: echo $PATH
run: echo $PATH run: echo $PATH
- name: Render the devshell
if: success() || failure()
run: |
nix develop --command date
- name: Test `nix` with `$GITHUB_PATH` - name: Test `nix` with `$GITHUB_PATH`
if: success() || failure() if: success() || failure()
run: | run: |
@ -43,6 +53,7 @@ jobs:
hello hello
nix store gc nix store gc
nix run nixpkgs#hello nix run nixpkgs#hello
- name: Test bash - name: Test bash
run: nix-instantiate -E 'builtins.currentTime' --eval run: nix-instantiate -E 'builtins.currentTime' --eval
if: success() || failure() if: success() || failure()
@ -91,6 +102,9 @@ jobs:
run-x86_64-darwin: run-x86_64-darwin:
name: Run x86_64 Darwin name: Run x86_64 Darwin
runs-on: macos-12 runs-on: macos-12
permissions:
contents: read
id-token: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Nix - name: Install Nix
@ -99,6 +113,7 @@ jobs:
logger: pretty logger: pretty
log-directives: nix_installer=trace log-directives: nix_installer=trace
backtrace: full backtrace: full
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: echo $PATH - name: echo $PATH
run: echo $PATH run: echo $PATH
- name: Test `nix` with `$GITHUB_PATH` - name: Test `nix` with `$GITHUB_PATH`
@ -135,6 +150,10 @@ jobs:
hello hello
nix store gc nix store gc
nix run nixpkgs#hello nix run nixpkgs#hello
- name: Terminate the magic nix cache pre-reinstall
if: success() || failure()
run: |
pkill magic-nix-cache
- name: Reinstall Nix - name: Reinstall Nix
uses: ./ uses: ./
with: with:

8
dist/index.js generated vendored
View file

@ -406,7 +406,6 @@ class NixInstallerAction {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info("KVM is not available."); _actions_core__WEBPACK_IMPORTED_MODULE_0__.info("KVM is not available.");
_actions_core__WEBPACK_IMPORTED_MODULE_0__.exportVariable("DETERMINATE_NIX_KVM", "0"); _actions_core__WEBPACK_IMPORTED_MODULE_0__.exportVariable("DETERMINATE_NIX_KVM", "0");
} }
_actions_core__WEBPACK_IMPORTED_MODULE_0__.exportVariable("DETERMINATE_NIX_KVM", "0");
} }
// Normal just doing of the install // Normal just doing of the install
_actions_core__WEBPACK_IMPORTED_MODULE_0__.startGroup("Installing Nix"); _actions_core__WEBPACK_IMPORTED_MODULE_0__.startGroup("Installing Nix");
@ -464,9 +463,16 @@ class NixInstallerAction {
"run", "run",
"--detach", "--detach",
"--privileged", "--privileged",
"--network=host",
"--userns=host", "--userns=host",
"--pid=host", "--pid=host",
"--mount", "--mount",
"type=bind,src=/bin,dst=/bin,readonly",
"--mount",
"type=bind,src=/lib,dst=/lib,readonly",
"--mount",
"type=bind,src=/home,dst=/home,readonly",
"--mount",
"type=bind,src=/tmp,dst=/tmp", "type=bind,src=/tmp,dst=/tmp",
"--mount", "--mount",
"type=bind,src=/nix,dst=/nix", "type=bind,src=/nix,dst=/nix",

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@
outputs = { self, flake-schemas, nixpkgs }: outputs = { self, flake-schemas, nixpkgs }:
let let
supportedSystems = [ "x86_64-linux" "aarch64-darwin" ]; supportedSystems = [ "x86_64-linux" "aarch64-darwin" "aarch64-linux" "x86_64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
}); });

View file

@ -513,8 +513,6 @@ class NixInstallerAction {
actions_core.info("KVM is not available."); actions_core.info("KVM is not available.");
actions_core.exportVariable("DETERMINATE_NIX_KVM", "0"); actions_core.exportVariable("DETERMINATE_NIX_KVM", "0");
} }
actions_core.exportVariable("DETERMINATE_NIX_KVM", "0");
} }
// Normal just doing of the install // Normal just doing of the install
@ -587,9 +585,16 @@ class NixInstallerAction {
"run", "run",
"--detach", "--detach",
"--privileged", "--privileged",
"--network=host",
"--userns=host", "--userns=host",
"--pid=host", "--pid=host",
"--mount", "--mount",
"type=bind,src=/bin,dst=/bin,readonly",
"--mount",
"type=bind,src=/lib,dst=/lib,readonly",
"--mount",
"type=bind,src=/home,dst=/home,readonly",
"--mount",
"type=bind,src=/tmp,dst=/tmp", "type=bind,src=/tmp,dst=/tmp",
"--mount", "--mount",
"type=bind,src=/nix,dst=/nix", "type=bind,src=/nix,dst=/nix",