stages:
- generate
- check
- cache

generate-flake-ci:
  stage: generate
  script: nix run "git+https://gitlab.homotopic.tech/haskell/flake-to-gitlab-ci?ref=refs/tags/0.2.2.0" > flake-ci.yml
  artifacts:
    paths:
      - flake-ci.yml

flake-ci:
  stage: check
  trigger:
    include:
      - artifact: flake-ci.yml
        job: generate-flake-ci
    strategy: depend

cachix:
  stage: cache
  only:
    refs:
    - master
    - cachix
  script: nix-shell -p jq cachix parallel --command 'dhall --file .cachix.dhall | dhall text | bash'
