update/navibeat
1name: "Build and populate cache"
2on:
3 pull_request:
4 push:
5 branches:
6 - main
7 - master
8 # schedule:
9 # # rebuild everyday at 2:51
10 # # TIP: Choose a random time here so not all repositories are build at once:
11 # # https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new
12 # - cron: "51 2 * * *"
13 workflow_dispatch:
14jobs:
15 tests:
16 strategy:
17 matrix:
18 # Set this to notify the global nur package registry that changes are
19 # available.
20 #
21 # The repo name as used in
22 # https://github.com/nix-community/NUR/blob/master/repos.json
23 nurRepo:
24 - <YOUR_REPO_NAME>
25 # Set this to cache your build results in cachix for faster builds
26 # in CI and for everyone who uses your cache.
27 #
28 # Format: Your cachix cache host name without the ".cachix.org" suffix.
29 # Example: mycache (for mycache.cachix.org)
30 #
31 # For this to work, you also need to set the CACHIX_SIGNING_KEY or
32 # CACHIX_AUTH_TOKEN secret in your repository secrets settings in
33 # Github found at
34 # https://github.com/<your_githubname>/nur-packages/settings/secrets
35 cachixName:
36 - hpcesia-nur
37 runs-on: nixos-latest-high
38 steps:
39 - name: Checkout repository
40 uses: actions/checkout@v6
41 - name: Setup Nix
42 run: |
43 echo "access-tokens = github.com=${{ secrets.NIX_GITHUB_TOKEN }}" >> /etc/nix/nix.conf
44 echo "substituters = https://mirrors.ustc.edu.cn/nix-channels/store?priority=39 \
45 https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store?priority=39 \
46 https://cache.nixos.org?priority=40" >> /etc/nix/nix.conf
47 nixpkgsRev=$(nix-instantiate --eval -E '(builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked.rev' | tr -d '"')
48 echo "NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/${nixpkgsRev}.tar.gz" >> $FORGEJO_ENV
49 - name: Show nixpkgs version
50 run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
51 - name: Setup cachix
52 uses: https://github.com/cachix/cachix-action@v17
53 # Don't replace <YOUR_CACHIX_NAME> here!
54 if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }}
55 with:
56 name: ${{ matrix.cachixName }}
57 signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
58 authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
59 - name: Restore and save Nix store
60 uses: https://github.com/nix-community/cache-nix-action@v7
61 with:
62 primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
63 restore-prefixes-first-match: nix-${{ runner.os }}-
64 gc-max-store-size-linux: 2G
65 - name: Check evaluation
66 run: |
67 nix-env -f . -qa \* --meta --xml \
68 --allowed-uris https://static.rust-lang.org \
69 --option restrict-eval true \
70 --option allow-import-from-derivation true \
71 --drv-path --show-trace \
72 -I nixpkgs=$(nix-instantiate --find-file nixpkgs) \
73 -I $PWD
74 - name: Build nix packages
75 run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs
76 - name: Trigger NUR update
77 # Don't replace <YOUR_REPO_NAME> here!
78 if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }}
79 run: curl -XPOST "https://nur-update.nix-community.org/update?repo=${{ matrix.nurRepo }}"