main
 1# Mostly modified from https://github.com/nix-community/nur-packages-template/blob/d65ab8218182ba47cd048d50ff1bae0d8b4e7546/.github/workflows/build.yml
 2
 3labels:
 4  tier: high
 5
 6when:
 7  - event: [push, manual]
 8    branch: main
 9
10matrix:
11  NIX_BRANCH:
12    - nixpkgs-unstable
13    - nixos-unstable
14    - nixos-26.05
15
16steps:
17  - name: Setup Nix config
18    image: docker.io/nixos/nix:2.32.8
19    commands:
20      - mkdir -p ./.nixconf
21      - install -Dm644 /etc/nix/nix.conf ./.nixconf
22      - echo "access-tokens = github.com=$${GITHUB_TOKEN}" >> ./.nixconf/nix.conf
23      - echo "experimental-features = nix-command flakes" >> ./.nixconf/nix.conf
24      - echo "export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/${NIX_BRANCH}.tar.gz" >> .envvars
25      - echo "export NIX_CONF_DIR=$(realpath ./.nixconf)" >> .envvars
26    environment:
27      GITHUB_TOKEN:
28        from_secret: github_token
29
30  - name: Show nixpkgs version
31    image: docker.io/nixos/nix:2.32.8
32    commands:
33      - source ./.envvars
34      - nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
35
36  - name: Check evaluation
37    image: docker.io/nixos/nix:2.32.8
38    commands:
39      - source ./.envvars
40      - |
41        nix-env -f . -qa \* --meta --xml \
42          --allowed-uris https://static.rust-lang.org \
43          --option restrict-eval true \
44          --option allow-import-from-derivation true \
45          --drv-path --show-trace \
46          -I nixpkgs=$(nix-instantiate --find-file nixpkgs) \
47          -I $PWD
48
49  - name: Build nix packages
50    image: docker.io/nixos/nix:2.32.8
51    commands:
52      - source ./.envvars
53      - nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs