Skip to content

Conversation

charles-dyfis-net
Copy link

@charles-dyfis-net charles-dyfis-net commented Aug 27, 2025

  • Add optional cargoLockHash parameter that makes Cargo.lock extraction a fixed-output derivation
  • If trying to cross-eval but not cross-build, use pkgsBuildHost to evaluate that FOD. (This may be identical to pkgs in the absence of cross-compilation; folks intending to support cross-eval will need to take explicit steps).

@charles-dyfis-net

This comment was marked as outdated.

@charles-dyfis-net charles-dyfis-net force-pushed the allow-explicit-lock-hash branch 2 times, most recently from a874606 to 9556f07 Compare August 27, 2025 22:30
Add optional cargoLockHash parameter that makes Cargo.lock extraction a fixed-output derivation.

Use pkgsBuildHost rather than pkgs for build -- as a FOD, this doesn't change the build hash.

This allows platforms that are doing cross-evalution but not cross-compilation to generate identical derivation hashes between cross-evaluation and local build, so long as they (1) provide a hash for Cargo.lock files, and (2) ensure that `pkgsBuildHost` is set to reflect the system doing the evaluation.
@charles-dyfis-net charles-dyfis-net force-pushed the allow-explicit-lock-hash branch from 9556f07 to 7362e9b Compare August 27, 2025 22:34
@adisbladis
Copy link
Member

Could you explain the use case in greater detail? I don't really understand what this is supposed to solve.

@charles-dyfis-net
Copy link
Author

Could you explain the use case in greater detail? I don't really understand what this is supposed to solve.

Sure. I have a flake using pyproject.nix, and I want nix flake check --no-build --all-systems to work.

Right now it doesn't, because when evaluating the derivation for a different target we need to get the lockfile to parse, and the "get the lockfile" steps are run with the target pkgs instead of the local one.

When the lockfile is a FOD, it has the same hash no matter how it was built, so we can reuse a copy of the lockfile extracted with local tools when evaluating the same build for a different target platform.

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