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
buildRustCrate: add lib output #73803
Conversation
@GrahamcOfBorg build buildRustCrateTests |
@GrahamcOfBorg build carnix |
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.
Do we have a way to list all the rust packages in hydra? I don't know about one, but it'd be nice to be able to check that landing this PR doesn't dramatically increase the number of failures.
Also, this probably needs release notes.
Yes we do. ofBorg did do that check for us already: https://gist.githubusercontent.com/GrahamcOfBorg/65e023463bccb03ab9f479057707a161/raw/7b6376dd8a0814a98cfff827cb0fd24e20c6b716/Changed%2520Paths And these are all those that are relevant:
What kind of notes do you like to see for this? We have a bit of (outdated?) |
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.
nix-review
passes on NixOS
[310 built, 249 copied (114.3 MiB), 14.7 MiB DL]
https://github.com/NixOS/nixpkgs/pull/73803
1 package are marked as broken and were skipped:
way-cooler
18 package were built:
buildRustCrateTests.allocNoStdLibTest buildRustCrateTests.brotliDecompressorTest buildRustCrateTests.brotliTest buildRustCrateTests.crateBinNoPath1 buildRustCrateTests.crateBinNoPath2 buildRustCrateTests.crateBinNoPath3 buildRustCrateTests.crateBinNoPath4 buildRustCrateTests.crateBinRename1 buildRustCrateTests.crateBinRename2 buildRustCrateTests.crateBinWithPath buildRustCrateTests.customLibName buildRustCrateTests.customLibNameAndLibPath buildRustCrateTests.libPath buildRustCrateTests.srcLib cargo-download cargo-update carnix toml2nix
would like for someone to do some more in-depth testing
This fixes #53026 |
@jonringer I did build https://broken.sh, a clients code base and a few of my other private projects using this. So far it really looks good. Let me know if you still prefer someone else having a look at this. It would probably be sane. |
bb8dd63
to
acb3b20
Compare
This cuts down the dependency tree on some rust builds where a crate not just exposes a binary but also a library. `$out/lib` contained a bunch of extra support files that among other information carry linker flags (including the full path to link-time dependencies). Worst case this led to some binary outputs depending on the full build closure of rust crates. Moving all the `$out/lib` files to `$lib/lib` solves this nicely. `lib` might be a bit weird here as they are most of the time just rlib files (rust libraries). Those are essential only required during compilation but they can also be shared objects (like with traditional C-style packages). Which is why I went with `lib` for the new output. One of the caveats we are running into here is that we do not (always) know ahead of time of a crate produces just a library or just a binary. Cargo allows for some ambiguity regarding whether or not a crate provides one, two, … binaries and libraries as it's outputs. Ideally we would be able to rely on the `crateType` entirely but so far that isn't the case. More work on that area might show how difficult that actually is.
acb3b20
to
1b74855
Compare
@Ekleog I added some basic changelog lines. Let me know if that is good (enough). |
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.
LGTM
[310 built, 249 copied (114.3 MiB), 14.7 MiB DL]
https://github.com/NixOS/nixpkgs/pull/73803
1 package are marked as broken and were skipped:
way-cooler
18 package were built:
buildRustCrateTests.allocNoStdLibTest buildRustCrateTests.brotliDecompressorTest buildRustCrateTests.brotliTest buildRustCrateTests.crateBinNoPath1 buildRustCrateTests.crateBinNoPath2 buildRustCrateTests.crateBinNoPath3 buildRustCrateTests.crateBinNoPath4 buildRustCrateTests.crateBinRename1 buildRustCrateTests.crateBinRename2 buildRustCrateTests.crateBinWithPath buildRustCrateTests.customLibName buildRustCrateTests.customLibNameAndLibPath buildRustCrateTests.libPath buildRustCrateTests.srcLib cargo-download cargo-update carnix toml2nix
@GrahamcOfBorg build buildRustCrateTests.allocNoStdLibTest buildRustCrateTests.brotliDecompressorTest buildRustCrateTests.brotliTest buildRustCrateTests.crateBinNoPath1 buildRustCrateTests.crateBinNoPath2 buildRustCrateTests.crateBinNoPath3 buildRustCrateTests.crateBinNoPath4 buildRustCrateTests.crateBinRename1 buildRustCrateTests.crateBinRename2 buildRustCrateTests.crateBinWithPath buildRustCrateTests.customLibName buildRustCrateTests.customLibNameAndLibPath buildRustCrateTests.libPath buildRustCrateTests.srcLib cargo-download cargo-update carnix toml2nix |
@GrahamcOfBorg build buildRustCrateTests.allocNoStdLibTest buildRustCrateTests.brotliDecompressorTest buildRustCrateTests.brotliTest buildRustCrateTests.crateBinNoPath1 buildRustCrateTests.crateBinNoPath2 buildRustCrateTests.crateBinNoPath3 buildRustCrateTests.crateBinNoPath4 buildRustCrateTests.crateBinRename1 buildRustCrateTests.crateBinRename2 buildRustCrateTests.crateBinWithPath buildRustCrateTests.customLibName buildRustCrateTests.customLibNameAndLibPath buildRustCrateTests.libPath buildRustCrateTests.srcLib cargo-download cargo-update carnix toml2nix Rerunning due to darwin failure. Not sure if that is flaky on that strange platform. |
not sure if darwin worked in the first place :/ |
Motivation for this change
This cuts down the dependency tree on some rust builds where a crate not
just exposes a binary but also a library.
$out/lib
contained a bunchof extra support files that among other information carry linker flags
(including the full path to link-time dependencies). Worst case this led
to some binary outputs depending on the full build closure of rust
crates.
Moving all the
$out/lib
files to$lib/lib
solves this nicely.lib
might be a bit weird here as they are most of the time just rlibfiles (rust libraries). Those are essential only required during
compilation but they can also be shared objects (like with traditional
C-style packages). Which is why I went with
lib
for the new output.One of the caveats we are running into here is that we do not (always)
know ahead of time of a crate produces just a library or just a binary.
Cargo allows for some ambiguity regarding whether or not a crate
provides one, two, … binaries and libraries as it's outputs. Ideally we
would be able to rely on the
crateType
entirely but so far that isn'tthe case. More work on that area might show how difficult that actually
is.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @Mic92