Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splice overrideToolchain #652

Merged
merged 10 commits into from
Jun 29, 2024
Merged

Splice overrideToolchain #652

merged 10 commits into from
Jun 29, 2024

Conversation

szlend
Copy link
Contributor

@szlend szlend commented Jun 23, 2024

Motivation

overrideToolchain can now accept a function used to splice the rust toolchain:

craneLib = (crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.stable.latest.default);

I don't fully understand why the toolchain needs be offset from pkgsBuildHost even when spliced. But this has always been the case.

Fixes #648

Fixes #551

Checklist

  • added tests to verify new behavior
  • added an example template or updated an existing one
  • updated docs/API.md (or general documentation) with changes
  • updated CHANGELOG.md

default.nix Outdated Show resolved Hide resolved
lib/default.nix Outdated Show resolved Hide resolved
@szlend
Copy link
Contributor Author

szlend commented Jun 24, 2024

Actually, on second testing, it doesn't seem there's any difference to just doing:

craneLib = (crane.mkLib pkgs).overrideToolchain pkgsBuildHost.rust-bin.stable.latest.default;

So it kind of seems like splicing isn't working correctly. Though I did verify that cargo passed into nativeBuildInputs in various crane derivations has the __spliced attrset. So I don't understand what's going on here.

Edit: Fixed now.

lib/default.nix Outdated Show resolved Hide resolved
lib/default.nix Outdated Show resolved Hide resolved
@szlend
Copy link
Contributor Author

szlend commented Jun 24, 2024

I don't fully understand why the toolchain needs be offset from pkgsBuildHost even when spliced. But this has always been the case.

I should have seen this as a red flag. This works fine after working out the issues:

craneLib = (crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.stable.latest.default);

@szlend szlend changed the title splice overrideToolchain Splice overrideToolchain Jun 24, 2024
Copy link
Owner

@ipetkov ipetkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR, and for making it backwards compatible! Overall I think it looks good. The hoops we have to jump through to make everything work are no where near as bad as I feared so I'm okay with moving in that direction!

Going to do a little bit of my own testing and move forward from there if it looks fine

examples/cross-rust-overlay/flake.nix Outdated Show resolved Hide resolved
lib/default.nix Outdated Show resolved Hide resolved
docs/API.md Outdated Show resolved Hide resolved
@ipetkov ipetkov marked this pull request as ready for review June 29, 2024 18:25
@ipetkov ipetkov merged commit aa5dcd0 into ipetkov:master Jun 29, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants