image: docker-registry.schukai.com:443/nixos-ci-devenv:latest


variables:
  NIXOS_VERSION: "23.11"
  NIXPKGS_ALLOW_UNFREE: "1"
  NIXPKGS_ALLOW_INSECURE: "1"
  GIT_DEPTH: 10

stages:
  - test
  - deploy 

after_script:
  - if [ -f .env-gitlab-ci ]; then rm .env-gitlab-ci; fi

test:
  stage: test
  tags:
    - nixos
  script:
    - nix develop --command run-ci-tests

  cache:
    - key: nixos
      paths:
        - /nix/store

deploy:
  stage: deploy
  tags:
    - nixos
  script:
    - nix develop --command deploy
  after_script:
    - nix develop --command clean-up 

  when: on_success

  cache:
    - key: nixos
      paths:
        - /nix/store

