Repository navigation
70 lines (64 loc) · 2.84 KB
/
Copy pathnix.yml
File metadata and controls
70 lines (64 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Nix packaging is only exercised when the inputs that can break it change,
# because `nix build` compiles the whole crate and is far too slow to run on
# every PR. Keep this list in sync with anything the flake reads.
on:
pull_request:
paths:
- "flake.nix"
- "flake.lock"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/nix.yml"
push:
branches: [main]
paths:
- "flake.nix"
- "flake.lock"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/nix.yml"
name: Nix
permissions:
contents: read
jobs:
flake:
name: Flake
runs-on: ubuntu-latest
# A cold `nix build` of the full default feature set (librespot included)
# is the long pole here.
timeout-minutes: 60
if: |
!contains(format('{0} {1} {2}', github.event.head_commit.message, github.event.pull_request.title, github.event.pull_request.body), '[skip ci]')
steps:
# Pinned to commit SHAs rather than tags or branches: a tag can be
# retargeted, and this job runs `nix build`, so a compromised action would
# be executing arbitrary code against the build. Dependabot already tracks
# the `github-actions` ecosystem and reads the trailing version comment, so
# these still get update PRs.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
# The job only reads the repo, so leaving GITHUB_TOKEN behind in the
# local git config buys nothing.
persist-credentials: false
- uses: cachix/install-nix-action@630ae543ea3a38a9a4166f03376c02c50f408342 # v31.11.0
with:
extra_nix_config: |
experimental-features = nix-command flakes
# Catches outputs declared under the wrong attribute path. `devShells` and
# `apps` nested inside `packages` evaluated fine but were invisible to Nix,
# so `nix run` had no target and `nix develop` silently fell back to the
# package derivation (#401). Evaluation only, no builds.
- name: Check flake outputs
run: nix flake check --all-systems --no-build
# Direct regression guard for the above: the dev shell has to be reachable
# *and* actually carry the Rust toolchain.
- name: Dev shell provides the Rust toolchain
run: nix develop --command cargo --version
# The `librespot-*` entries in `cargoLock.outputHashes` pin the content of
# the spotatui-librespot checkout, while the rev they correspond to lives
# in Cargo.toml's [patch] block. Nothing links the two, so bumping the fork
# without regenerating the hash breaks `nix build` for every Nix user, with
# a fixed-output hash mismatch that never mentions the rev. Building here is
# what catches that drift before it reaches main.
- name: Build the package
run: nix build --no-link --print-build-logs .#default