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

pkgs/build-support/rust: fix warning "build/.cargo/config is deprecated" #339281

Closed
wants to merge 1 commit into from

Conversation

VuiMuich
Copy link
Contributor

@VuiMuich VuiMuich commented Sep 3, 2024

Description of changes

With a recent cargo version update the deprecation warning (see below) became more vocal.

warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`

To verify this works I built the bk package, as it is very small and has very little deps.

Edit: it creates the symlink to the old /build/.cargo/confgi in case some packge enforces an old cargo version of 1.38 or older

closes #334857

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@VuiMuich VuiMuich force-pushed the fix/cargo-config-deprecation branch from 370f917 to f633cc4 Compare September 3, 2024 15:44
Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

Thanks; this has been bugging me. I’m not sure if we care about supporting Rust versions prior to 1.38, but I guess people could be using them through the various overlays.

Comment on lines 242 to +244
for registry in ${toString (builtins.attrNames extraRegistries)}; do
cat >> $out/.cargo/config <<EOF
cat >> $out/.cargo/config.toml <<EOF
ln -s .cargo/config.toml .cargo/config
Copy link
Member

Choose a reason for hiding this comment

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

I think this may fail if it is run multiple times. Can we do the ln in only one place instead?

@@ -96,7 +96,8 @@ in stdenv.mkDerivation ({

# Packages with git dependencies generate non-default cargo configs, so
# always install it rather than trying to write a standard default template.
install -D $CARGO_CONFIG $name/.cargo/config;
install -D $CARGO_CONFIG $name/.cargo/config.toml;
Copy link
Member

Choose a reason for hiding this comment

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

I think this ; is redundant.

@@ -22,19 +22,20 @@ cargoSetupPostUnpackHook() {
mkdir .cargo
fi

config="$cargoDepsCopy/.cargo/config";
config="$cargoDepsCopy/.cargo/config.toml";
Copy link
Member

Choose a reason for hiding this comment

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

I think this ; is redundant too.

@donovanglover donovanglover changed the title pkgs/build-support/rust: fix warning "build/.cargo/confgi is deprecated" pkgs/build-support/rust: fix warning "build/.cargo/config is deprecated" Sep 3, 2024
@emilazy
Copy link
Member

emilazy commented Sep 3, 2024

We need to make sure that this doesn’t invalidate the existing Cargo hashes in‐tree (i.e., that blanking out a hash still produces the same hash after this PR is applied). See #321095.

@alyssais
Copy link
Member

alyssais commented Sep 3, 2024

This looks like a duplicate of #331167. cc @mmlb. I don't know which is better.

@VuiMuich
Copy link
Contributor Author

VuiMuich commented Sep 3, 2024

I'm fine to close mine in favor of #331167, sind it catches a bunch of cases I missed (like pkgs/servers/clickhouse/default.nix).
The only thing my PR has over @mmlb theirs is the automatic symlinks for backwards compatibility.

@emilazy
Copy link
Member

emilazy commented Sep 3, 2024

This one would break the Cargo hashes, so I think we should close in favour of the earlier one. Thanks for taking a crack at this annoying problem anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cargo build/.cargo/config deprecation note
3 participants