stages:
- generate
- flake
- cache

generate-flake-ci:
  stage: generate
  script:
  - nix run "git+https://gitlab.nixica.dev/haskell/flake-to-gitlab-ci?ref=refs/tags/0.2.4.1" > flake-ci-x86_64-linux.yml
  artifacts:
    paths:
      - flake-ci-x86_64-linux.yml

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

cachix:
  stage: cache
  only:
    refs:
    - master
    - cachix
  script:
  - nix-shell -p cachix --command "nix build github:srid/devour-flake -L --no-link --print-out-paths --override-input flake . | xargs cat | cachix push horizon"
