Skip to content

refactor: den-fx

refactor: den-fx #1853

Workflow file for this run

name: test
on:
push:
branches: [main]
paths: ["**/*.nix"]
pull_request:
types: [labeled, opened, synchronize, reopened, review_requested, ready_for_review]
paths: ["**/*.nix"]
pull_request_review:
types: [submitted]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NIX_PATH: "nixpkgs=https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
jobs:
non-draft:
runs-on: ubuntu-latest
if: ${{github.ref == 'refs/heads/main' || github.event.pull_request.draft == false}}
steps:
- uses: actions/checkout@v6
- run: |
git fetch --depth 1 origin refs/heads/main
test "refs/heads/main" == "${{github.ref}}" || (git diff --name-only origin/main..${{ github.sha }} -- | grep '.nix')
tests:
needs: [non-draft]
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
name: Tests ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- uses: wimpysworld/nothing-but-nix@v10
- uses: cachix/install-nix-action@v31
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: actions/checkout@v6
- run: nix-shell --run 'just ci'
flake-check:
needs: [non-draft]
name: nix flake check
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v31
- run: nix flake check -L github:vic/checkmate --override-input target github:$GITHUB_REPOSITORY/$GITHUB_SHA
allow-ci:
needs: [non-draft]
name: allow-ci
runs-on: ubuntu-latest
if: ${{github.ref == 'refs/heads/main' || contains( github.event.pull_request.labels.*.name, 'allow-ci')}}
steps:
- run: true
noflake:
needs: [allow-ci]
name: noflake
runs-on: ubuntu-latest
steps:
- uses: wimpysworld/nothing-but-nix@v10
- uses: cachix/install-nix-action@v31
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: actions/checkout@v6
- run: sed -i 's@# den.outPath@den.outPath@' templates/noflake/default.nix
- run: |
cat <<-EOF > templates/noflake/modules/ci-runtime.nix
{
_module.args.CI = true;
}
EOF
git add templates/noflake/modules/ci-runtime.nix
- run: (cd templates/noflake && nix-build ./default.nix -A flake.nixosConfigurations.igloo.config.system.build.toplevel)
- run: (cd templates/noflake && nix-shell ./default.nix -A den.sh --run 'igloo build --offline')
template:
needs: [allow-ci]
# max-parallel: 2
strategy:
matrix:
template: [bogus, minimal, microvm, nvf-standalone, flake-parts-modules]
os: [ubuntu-latest]
name: Check template ${{matrix.template}} ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- uses: wimpysworld/nothing-but-nix@v10
- uses: cachix/install-nix-action@v31
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: actions/checkout@v6
- run: |
cat <<-EOF > templates/${{matrix.template}}/modules/ci-runtime.nix
{
_module.args.CI = true;
}
EOF
git add templates/${{matrix.template}}/modules/ci-runtime.nix
- run: nix flake check -L ./templates/${{matrix.template}} --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA
- run: (cd templates/nvf-standalone && nix build .#my-neovim --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA)
if: matrix.template == 'nvf-standalone'
- run: (cd templates/minimal && nix build .#.nixosConfigurations.igloo.config.system.build.toplevel --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA)
if: matrix.template == 'minimal'
- run: |
cd templates/minimal
sed -i "s#github:$GITHUB_REPOSITORY#github:$GITHUB_REPOSITORY/$GITHUB_SHA#" flake.nix
nix flake update den
nix run .#igloo -- build --offline
if: matrix.template == 'minimal'
- run: (cd templates/flake-parts-modules && nix develop .# --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA --command cowsay)
if: matrix.template == 'flake-parts-modules'
flake-file-template:
needs: [allow-ci]
strategy:
matrix:
os: [ubuntu-latest]
template: [default, example]
name: Check template ${{matrix.template}} ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- uses: wimpysworld/nothing-but-nix@v10
if: matrix.os == 'ubuntu-latest'
- uses: cachix/install-nix-action@v31
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: nix flake init -t github:$GITHUB_REPOSITORY/$GITHUB_SHA#${{matrix.template}}
- run: |
cat <<-EOF > modules/ci-runtime.nix
{ lib, ... }:
{
flake-file.inputs.den.url = lib.mkForce "github:$GITHUB_REPOSITORY/$GITHUB_SHA";
_module.args.CI = true;
}
EOF
- run: nix run .#write-flake --override-input den "github:$GITHUB_REPOSITORY/$GITHUB_SHA"
- run: nix flake update den
- run: nix run .#write-flake
- run: nix flake metadata
- run: nix flake check -L --no-build