Skip to content
Jörg Thalheim edited this page Aug 19, 2022 · 10 revisions

CI example configurations

Gitlab

stages:
 - eval
 - build

eval:
 stage: eval
 script:
   - nix run github:nix-community/nix-eval-jobs -- --workers 8 --gc-roots-dir $(pwd)/gcroot --flake '.#hydraJobs' > jobs.json
   # TODO: this does not properly check for eval errors yet
   - nix run nixpkgs/nixpkgs-unstable#jq -- -r '.attr + " " + .drvPath' < jobs.json > jobs
   - |
     echo > generated-config.yml
     while read -r line; do
       IFS=" " read attr drvPath <<< "$line"
       cat >> generated-config.yml <<EOF
       build-$attr:
         stage: build
         retry: 2
         script:
           - nix build --out-link "result-$attr" -L "$drvPath"
           # useful if you want a binary cache
           #- |
           #  if [[ -n "$CACHIX_SIGNING_KEY" ]]; then
           #    nix run nixpkgs/nixpkgs-unstable#cachix -- push "$CACHIX_NAME" "result-$attr"
           #  fi
     EOF
     done < jobs
 artifacts:
   paths:
     - generated-config.yml
     - jobs.json

build:
 stage: build
 trigger:
    include:
      - artifact: generated-config.yml
        job: eval
    strategy: depend

Buildbot

See this configuration

Github actions

Robotnix has an example in their repo

Clone this wiki locally