Skip to content
Jörg Thalheim edited this page Aug 11, 2024 · 9 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 buildbot-nix

Github actions

nixpkgs-unfree uses nix-eval-jobs to offer a Hydra-lite experience: https://github.com/numtide/nixpkgs-unfree/blob/main/ci.sh It scales a bit better if you have a lot of small packages (too much for a github build matrix)

Clone this wiki locally