variables:
  NIXPKGS_ALLOW_UNFREE: "1"
  NIXPKGS_ALLOW_INSECURE: "1"
  GIT_DEPTH: 10
  GIT_SUBMODULE_STRATEGY: normal
  GIT_SUBMODULE_DEPTH: 1


stages:
  - test
  - release

before_script:
  - git config --global user.email "${GITLAB_USER_EMAIL}"
  - git config --global user.name "${GITLAB_USER_NAME:-"Gitlab CI"}"
  - git config --global credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=${CI_JOB_TOKEN}"; }; f'
  - git config --global pull.rebase true
  - git config --global http.sslVerify "false"


after_script:
  - nix develop .#gitlab --command clean-up

tests:
  stage: test
  tags:
    - nixos-gen3
  script:
    - nix develop .#gitlab --command run-ci-tests

release:
  stage: release
  tags:
    - nixos-gen3
  script:
    - nix develop .#gitlab --command release
  when: on_success
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
  