
# THIS FILE IS AUTOGENERATED BY THE DEVENVSHELL
# DO NOT EDIT THIS FILE MANUALLY
# INSTEAD EDIT THE DEVENVSHELL CONFIGURATION FILE devenv.nix
# AND OPEN A SHELL WITH THE COMMAND devenv shell
#

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

#    services:
#      - docker:dind

variables:
  # The repo name as used in
  # https://github.com/nix-community/NUR/blob/master/repos.json
  NIXOS_VERSION: "23.05"
  NIXPKGS_ALLOW_UNFREE: "1"
  NIXPKGS_ALLOW_INSECURE: "1"
  GIT_DEPTH: 10

stages:
  - test
  - deploy 

#before_script:
  #- echo > .env-gitlab-ci
  #- variables=("HOME=$HOME" "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME" "CI_REPOSITORY_URL=$CI_REPOSITORY_URL" "GITLAB_TOKEN=$GITLAB_TOKEN" "CI_JOB_TOKEN=$CI_JOB_TOKEN" "GITLAB_USER_EMAIL=$GITLAB_USER_EMAIL" "GITLAB_USER_NAME=\"$GITLAB_USER_NAME\"" "CI_REGISTRY_USER=$CI_REGISTRY_USER" "CI_PROJECT_ID=$CI_PROJECT_ID" "CI_PROJECT_DIR=$CI_PROJECT_DIR" "CI_API_V4_URL=$CI_API_V4_URL" "CI_PROJECT_NAME=$CI_PROJECT_NAME" "CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA"); for var in "${variables[@]}"; do echo "$var" >> .env-gitlab-ci; done
  #- cat .env-gitlab-ci
  #- env 
  #- nix shell nixpkgs#docker-client -c docker info

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

