Skip to content

fix: nix develop flake output - #401

Merged
LargeModGames merged 3 commits into
LargeModGames:mainfrom
DinoLeung:fix/upddate-flake
Jul 26, 2026
Merged

fix: nix develop flake output#401
LargeModGames merged 3 commits into
LargeModGames:mainfrom
DinoLeung:fix/upddate-flake

Conversation

@DinoLeung

@DinoLeung DinoLeung commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix the flake output layout so nix develop finds devShells.default instead of falling back to the package derivation.
  • Move apps.default to the proper top-level per-system flake output.
  • Share native/build inputs between the package derivation and dev shell.
  • Add LIBCLANG_PATH for bindgen/libclang-backed dependencies.
  • Add cargoLock.outputHashes for the patched librespot git dependencies so nix build can vendor them reproducibly.

Testing

  • nix flake show --all-systems
  • nix develop --command true
  • nix develop --command cargo --version
    • Output included: cargo 1.93.0
  • nix develop --command pkg-config --modversion openssl
    • Output: 3.6.1
  • nix develop --command printenv LIBCLANG_PATH
    • Output pointed to the Nix libclang store path.
  • nix-prefetch-git for LargeModGames/spotatui-librespot
    • Confirmed hash: sha256-F1pAhVgxYsbmLXOcbOEU6mGYZO1n94EWCXn5yjhPxv0=
  • nix build --no-link
    • Confirmed the previous Cargo vendoring/hash failure is fixed.
    • Build reached the final spotatui derivation; full package build did not complete during the validation window.

Additional notes

  • The seven librespot-* output hash entries use the same hash because they all come from the same pinned git repo/revision.

Summary by CodeRabbit

  • Chores
    • Centralized Rust build dependencies in the build configuration for consistent behavior across builds and development shells.
    • Added/updated output hash mappings for bundled librespot crate versions to strengthen dependency integrity.
    • Refreshed the development environment setup, including native tooling and LIBCLANG_PATH, to improve local build reliability.
    • Reformatted the packaged application output definition for clearer attribute structure.

- move devShells.default out from under packages so nix develop can find
it
- move apps.default to the proper top-level per-system flake output
- share native/build inputs between the package derivation and dev shell
- add LIBCLANG_PATH for bindgen/libclang-backed dependencies
- avoid nix develop falling back to the package build path
- allow nix build to vendor patched git dependencies reproducibly
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3eec3378-a3b0-4e01-9a1b-5eb1460488b1

📥 Commits

Reviewing files that changed from the base of the PR and between b60e2bd and 0fc64f7.

📒 Files selected for processing (1)
  • flake.nix
🚧 Files skipped from review as they are similar to previous changes (1)
  • flake.nix

📝 Walkthrough

Walkthrough

The flake centralizes Rust build inputs, pins output hashes for librespot crates, reuses those inputs in the package and development shell, and configures LIBCLANG_PATH. The default app attribute formatting is also updated.

Changes

Rust build environment

Layer / File(s) Summary
Shared build inputs
flake.nix
Defines reusable native and regular build inputs with Linux and macOS-specific packages, plus a shared librespot output hash.
Package and shell wiring
flake.nix
Adds librespot output hashes, reuses shared inputs in the Rust derivation, updates the development shell with Rust tooling and LIBCLANG_PATH, and reformats the default app output.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required conventional-commit prefix and clearly matches the flake output fix in this change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands.

@LargeModGames
LargeModGames merged commit 761da58 into LargeModGames:main Jul 26, 2026
12 checks passed
@LargeModGames

Copy link
Copy Markdown
Owner

@all-contributors please add @DinoLeung for platform

@allcontributors

Copy link
Copy Markdown
Contributor

@LargeModGames

I've put up a pull request to add @DinoLeung! 🎉

LargeModGames added a commit that referenced this pull request Jul 26, 2026
Adds @DinoLeung as a contributor for platform.

This was requested by LargeModGames [in this
comment](#401 (comment))

[skip ci]
LargeModGames added a commit that referenced this pull request Jul 26, 2026
# Summary

Adds a Nix leg that the Rust matrix cannot cover. Three steps, cheapest
first:

- `nix flake check --all-systems --no-build` catches outputs declared
under the wrong attribute path. This is the #401 class of bug:
`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. That had been the case since
v0.37.0.
- `nix develop --command cargo --version` guards the dev shell directly:
reachable, and actually carrying the toolchain.
- `nix build --no-link .#default` catches drift between the
`librespot-*` entries in `cargoLock.outputHashes` and the fork rev 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 names the rev. Only
an actual build realizes the vendor derivation, so only a build catches
it.

Separate workflow rather than a job in `ci.yml` because GitHub filters
`paths:` at the workflow level only, and the build step compiles the
full default feature set.

# Testing

Nix is not installed on my machine, so none of the three steps ran
locally. The workflow triggers on changes to itself, so this PR's own
run is the real verification.

- `python3 -c "import yaml;
yaml.safe_load(open('.github/workflows/nix.yml'))"` parses clean
- `git ls-files flake.lock` confirms the lock is tracked, so the job
will not go red merely because `nixos-unstable` moved
- `gh api repos/cachix/install-nix-action/tags` to pin `v31.11.0`; that
repo publishes no moving major tag

# Additional notes

- Not suitable as a required check. With `paths:` filters it does not
run on most PRs, and a required check that never runs leaves them
blocked pending forever.
- Expect the build step to run long whenever it fires. A hermetic `nix
build` gets no benefit from the existing `Swatinem/rust-cache`. That is
inherent to catching hash drift by building; the path filter is the
mitigation.
- If step 1 fails on a darwin attribute rather than on output layout,
drop `--all-systems`. It cross-evaluates the darwin outputs (including
`pkgs.apple-sdk`) from a Linux runner, and the layout bug it guards
reproduces on the Linux system alone.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Added a Nix-based CI workflow that runs on relevant changes to
Nix/Rust or the workflow itself, and on pushes to the main branch.
* Validates the Nix flake across all systems (without building) and
confirms the development shell provides Rust tooling.
* Builds the flake’s default output and includes protections like
limited permissions, a 60-minute timeout, and support for `[skip ci]`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants