-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Clean up Nix Flake & make it easier to customize #12831
base: master
Are you sure you want to change the base?
Conversation
I was considering trying to remove the dependency on Removing Should we also consider switching to the |
Yeah I considered that but also didn't think it was a big deal. I don't think it would be very hard to move to that. I can take a look later to see. It should be even easier to customize with only rust-overlay.
It's not a maintenance burden so there's not really a reason to remove it imo.
Ah, I did not look at this. Sure, makes sense. FYI fat LTO is sort of a placebo effect now days since it doesn't get much attention in LLVM anymore. The main thing it does is make your builds take longer. Thin is generally pretty close or faster (at runtime) in many cases since Google and other folks put money into thin LTO (for chrome and such). |
Ah, I whipped up the overlay-only version today during lunch. It has the problem of customization being pretty obtuse atm. See: Basically this line: |
Moving to the Rust-Overlay only version would still be a net win though because Cachix would work. And it wouldn't be much different from the status-quo wrt customization. |
@the-mikedavis I found a solution. Here's my NixOS config with customizations: |
f311895
to
57b3891
Compare
a9903b8
to
7bbfd57
Compare
On this branch I'm seeing an error when creating the dev shell:
The package build with |
Oh yeah, I did not test that. |
flake.nix
Outdated
rustPlatform.rust.rustc # TODO: Remove | ||
rustPlatform.rust.cargo # TODO: Remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use rustc
and cargo
from the attrs passed to mkHelix
instead? I'm seeing a deprecation warning on accessing these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No as they are not spliced in properly if you do that. The alternative is to change the callPackage
invocations to be something like
pkgs.callPackage mkHelix {
rustPlatform = msrvPlatform;
rustc = msrvToolchain.rustc;
cargo = msrvToolchain.cargo;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the package build (not the shell) we don't need to follow the MSRV, it's ok to build with latest stable. We do roughly the same in CI - the build workflow for PRs checks with the MSRV and then the release workflow uses whatever is the latest stable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not for Helix, but rather for me (or anyone else who overrides the toolchain) so that when I override the toolchain that the correct Cargo and Rustc are used for the entire build.
Hmm there's something weird with the fromRustupToolchainFile API. The check fails to build, and it was what was wrong with the devShell |
fat LTO takes a long time
Ok with some help from oxalica I found my typo and it should work fine now. |
An optional thing that could be done (and I do this in my repos at work) is move the |
It also looks like finalAttrs for buildRustPackage was merged, so the TODOs can be resolved. |
Hello. It has been a while since #11528. I am better at Nix, so I decided to take a crack at cleaning the flake up.
My main issues with it is that it was not setup to be very customizable. Also the Cachix cache is nearly useless since it is compiled with
target-cpu=native
, so the cache will nearly always be missed. So I refactored it and added some comments.I am unconvinced it needs all the source filtering.I did preserve the behavior that the devshell will compile with
target-cpu=native
and other flags. But now the Cachix cache is actually possible to hit.You can see an example of it in use in my NixOS config here: https://github.com/RossSmyth/nixos/blob/338fce6a5b7c3c5fe9c1790929bae40ce1494006/home-manager/helix.nix#L10-L29
The main issue is that the previous weird setup may be relied one by some people. So this will break them.
Commits can be squashed when merged.