feat: output write-* to packages also #416
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: flake-check | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| jobs: | |
| find-templates: | |
| name: Find templates | |
| runs-on: ubuntu-latest | |
| outputs: | |
| templates: ${{ steps.templates.outputs.templates }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: templates | |
| run: | | |
| templates=$(find templates -mindepth 2 -maxdepth 2 -name flake.nix -print0 | xargs -0 dirname | xargs -n 1 basename | jq -R | jq -sc) | |
| echo "$templates" | |
| echo "templates=$templates" >> $GITHUB_OUTPUT | |
| bootstrap-minimal: | |
| name: Bootstrap templates/minimal | |
| runs-on: ubuntu-latest | |
| env: | |
| NIX_PATH: "nixpkgs=https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz" | |
| steps: | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: actions/checkout@v4 | |
| - run: | | |
| cd templates/minimal | |
| rm flake.nix | |
| mv flake-file.nix flake.nix | |
| nix-shell "https://github.com/$GITHUB_REPOSITORY/archive/$GITHUB_SHA.zip" -A flake-file.sh --run bootstrap | |
| cat flake-file.nix flake.nix | |
| nix flake check | |
| sed -i 's#hello = "mundo"#hello = "world"#' flake-file.nix | |
| if nix flake check; then exit 1; fi | |
| sed -i 's#hello = "world"#hello = "monde"#' flake-file.nix | |
| nix flake check | |
| bootstrap-tests: | |
| name: Bootstrap apps | |
| runs-on: ubuntu-latest | |
| env: | |
| NIX_PATH: "nixpkgs=https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz" | |
| steps: | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: actions/checkout@v4 | |
| - run: nix-shell ./dev/bootstrap-tests.nix --run test-all | |
| template: | |
| name: Check template ${{matrix.template}} | |
| needs: [nix-fmt, find-templates] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| template: ${{ fromJSON(needs.find-templates.outputs.templates) }} | |
| exclude: | |
| - template: minimal | |
| - template: flakeless-parts | |
| steps: | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: | | |
| set -uveo pipefail | |
| cat <<EOF | tee forced.nix | |
| { lib, ... }: | |
| { | |
| flake-file.inputs.flake-file.url = lib.mkForce "github:$GITHUB_REPOSITORY/$GITHUB_SHA"; | |
| } | |
| EOF | |
| mkdir templated; cd templated | |
| nix flake init -t github:$GITHUB_REPOSITORY/$GITHUB_SHA#${{ matrix.template }} | |
| nix run .#write-flake -L --show-trace --override-input flake-file "github:$GITHUB_REPOSITORY/$GITHUB_SHA" | |
| if test -d ./modules; then cp ../forced.nix ./modules/; fi; | |
| if test -d ./flake-parts; then cp ../forced.nix ./flake-parts/; fi; | |
| nix run .#write-flake -L --show-trace --override-input flake-file "github:$GITHUB_REPOSITORY/$GITHUB_SHA" | |
| nix flake metadata | |
| nix run .#write-flake -L --show-trace --override-input flake-file "github:$GITHUB_REPOSITORY/$GITHUB_SHA" | |
| nix flake check -L --show-trace --override-input flake-file "github:$GITHUB_REPOSITORY/$GITHUB_SHA" | |
| npins: | |
| needs: [nix-fmt] | |
| name: Check npins | |
| runs-on: ubuntu-latest | |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'npins') }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: | | |
| set -e -o pipefail | |
| cd templates/npins | |
| sed -i 's/# flake-file = import/flake-file = import/' default.nix | |
| echo "{ inputs, ... }: { npins.pkgs = import inputs.nixpkgs {}; }" | tee modules/pkgs.nix | |
| nix-shell . -A flake-file.sh --run write-npins | |
| flakeless-parts: | |
| needs: [nix-fmt] | |
| name: Check flakeless-parts | |
| runs-on: ubuntu-latest | |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'flakeless-parts') }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: | | |
| set -e -o pipefail | |
| cd templates/flakeless-parts | |
| sed -i 's/# flake-file = import/flake-file = import/' default.nix | |
| nix run .#write-npins | |
| unflake: | |
| needs: [nix-fmt] | |
| name: Check unflake | |
| runs-on: ubuntu-latest | |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'unflake') }} | |
| env: | |
| NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: | | |
| set -e -o pipefail | |
| cd templates/unflake | |
| sed -i 's/# flake-file = import/flake-file = import/' default.nix | |
| nix-shell . -A flake-file.sh --run 'write-unflake --verbose' | |
| nixlock: | |
| needs: [nix-fmt] | |
| name: Check nixlock | |
| runs-on: ubuntu-latest | |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'nixlock') }} | |
| env: | |
| NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: | | |
| set -e -o pipefail | |
| cd templates/nixlock | |
| sed -i 's/# flake-file = import/flake-file = import/' default.nix | |
| nix-shell . -A flake-file.sh --run write-nixlock | |
| dev: | |
| needs: [bootstrap-minimal, bootstrap-tests, nix-fmt] | |
| name: Check flake dev | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: cd dev && nix flake check && nix flake metadata && nix flake check | |
| nix-fmt: | |
| name: Nix Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: wimpysworld/nothing-but-nix@v10 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - run: nix run -L ./dev#fmt -- --ci |