From 55b0e588e17c4cd076b354a1cb9f47bef6dbde38 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 22 May 2024 14:42:20 -0500 Subject: [PATCH] add on-demand builder --- .github/workflows/on-demand.yml | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/on-demand.yml diff --git a/.github/workflows/on-demand.yml b/.github/workflows/on-demand.yml new file mode 100644 index 0000000..33fdc4a --- /dev/null +++ b/.github/workflows/on-demand.yml @@ -0,0 +1,42 @@ +name: Build NixOS (on demand) + +on: + workflow_dispatch: + inputs: + host: + description: 'host name to build' + required: true + default: 'othalan' + type: string + lockFile: + description: 'flake.lock file' + required: true + type: string + +# TODO: add concurrency check to cancel in-progress builds +jobs: + build: + runs-on: ubuntu-latest + steps: + # free up some space + - run: sudo rm -rf /opt& + + - uses: actions/checkout@v4 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@v2 + + - uses: cachix/cachix-action@v14 + with: + name: daylin + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: write lock file + run: | + echo '${{ inputs.lockFile }}' > flake.lock + git diff + + + - name: Build + run: | + nix run . --accept-flake-config -- cache --host "${{ inputs.host }}" --flake .