Skip to content

buildRustPackage: remove git from nativeBuildInputs#206195

Closed
Atemu wants to merge 2 commits intoNixOS:stagingfrom
Atemu:build-rust-package-remove-git
Closed

buildRustPackage: remove git from nativeBuildInputs#206195
Atemu wants to merge 2 commits intoNixOS:stagingfrom
Atemu:build-rust-package-remove-git

Conversation

@Atemu
Copy link
Member

@Atemu Atemu commented Dec 15, 2022

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

Having git in nativeBuildInputs causes thousands of rebuilds when git is touched
because every derivation that somehow transiently depends on a rust package will
change. See NixOS#205682 for instance.

AFAICT git is unused. Only the fetcher needs git which it has already.

Fixes NixOS#205804
Cacert doesn't have any binary parts; it does not make sense to have it in
nativeBuildInputs. Its home sould be buildInputs.

It probably shouldn't be in there either as I can't imagine it being a general
requirement for rust packages and any package that depends on cacert should do
so explicitly. I don't have the experience with the rust packages set to know
whether that's the case, so let's err on the side of caution.
@Atemu Atemu requested review from LnL7, Mic92 and zowoq as code owners December 15, 2022 06:57
@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Dec 15, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Dec 15, 2022
@Atemu Atemu changed the title Build rust package remove git buildRustPackage: remove git from nativeBuildInputs Dec 15, 2022
];

buildInputs = buildInputs
++ [ cacert ] # FIXME Is this actually needed?
Copy link
Member

Choose a reason for hiding this comment

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

Does this even have an effect when its in buildInputs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes:

$ nix print-dev-env --impure --expr 'with import ./. {}; pkgsCross.riscv64.mkShell { buildInputs = [ cacert ]; }' | grep SSL
NIX_SSL_CERT_FILE='/nix/store/65wwvlzss9wsrsjwidrp2i0p0ps38nvg-nss-cacert-3.83/etc/ssl/certs/ca-bundle.crt'
export NIX_SSL_CERT_FILE

$ nix print-dev-env --impure --expr 'with import ./. {}; pkgsCross.riscv64.mkShell { }' | grep SSL

$

Copy link
Member Author

Choose a reason for hiding this comment

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

@Mic92 asked the other way around, what should having it in nativeBuildInputs achieve?

AFAIK, the only distinction made is when cross-compiling where nativeBuildInputs are expected to run on the host while buildInputs are for the target.

Since you're here, do you know whether some rust packages need this env var to build a usable package? (Especially w.r.t. internet-facing ones.)

@zowoq
Copy link
Contributor

zowoq commented Dec 26, 2022

cacert seems like a bit of a mess as it's used here and it's wrapped by cargo, need to be sure before making any changes to it.

Removing git seems fine so I've cherry picked that to another PR that can be merged now and I'll follow up on the cacert changes in a couple of weeks.

#207804

@zowoq zowoq marked this pull request as draft December 26, 2022 06:19
@Atemu Atemu closed this Jan 16, 2023
@Atemu Atemu deleted the build-rust-package-remove-git branch January 16, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants