Skip to content

fix nix ci, take two #321

fix nix ci, take two

fix nix ci, take two #321

Workflow file for this run

name: Nix CI
# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
push:
paths:
- 'lib/**'
- 'src/**'
- 'test/**'
- 'lib/base/base.agda-lib'
- 'agda2hs.cabal'
- 'cabal.project'
- 'Makefile'
- 'flake.*'
- 'nix/*'
- '.github/workflows/**.yml'
branches: [master]
jobs:
nix-build:
name: ${{ matrix.pretty }} with nix (${{ matrix.derivation }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
derivation: [agda2hs, base-lib, containers-lib]
include:
- pretty: "Compile agda2hs"
derivation: agda2hs
- pretty: "Typecheck with Agda"
derivation: base-lib
- pretty: "Typecheck with Agda"
derivation: containers-lib
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ matrix.derivation }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
- run: nix build .#${{ matrix.derivation }} --print-build-logs
nix-shell:
name: "Test building inside a nix shell"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-devshell-${{ hashFiles('**/*.nix', '**/flake.lock') }}
- name: drop into the devshell and run cabal
# we're using v1 command due to a lonstanding cabal-nix bug
#
# explainer: https://gist.github.com/ScottFreeCode/ef9f254e2dd91544bba4a068852fc81f
#
# bugs:
# https://github.com/haskell/cabal/issues/8434
# https://github.com/NixOS/nixpkgs/issues/130556
# https://github.com/NixOS/nixpkgs/issues/176887
#
# finally, v1-build doesn't work without update for some reason
# even though the update doesn't actually download anything
run: nix develop -Lv -c bash -c "cabal update; cabal v1-build"