From 17b3df2861d0ced01ddefa58b6d6fc2571b1c415 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Wed, 19 Jun 2024 14:28:58 -0400 Subject: [PATCH] rust: Write to .cargo/config.toml instead of .cargo/config Seeing the following new warnings pop up on stderr when cargo was bumped to 1.78: ``` 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` ``` which happens to break commitmsgfmt builds in nix (#320294). closes #320294 --- pkgs/build-support/rust/fetch-cargo-tarball/default.nix | 2 +- pkgs/build-support/rust/hooks/cargo-setup-hook.sh | 6 +++--- pkgs/build-support/rust/import-cargo-lock.nix | 6 +++--- pkgs/development/compilers/rust/rustc.nix | 2 +- pkgs/development/ruby-modules/gem-config/default.nix | 2 +- pkgs/servers/clickhouse/default.nix | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgs/build-support/rust/fetch-cargo-tarball/default.nix b/pkgs/build-support/rust/fetch-cargo-tarball/default.nix index c16f3540e6ae..96db232ce2f5 100644 --- a/pkgs/build-support/rust/fetch-cargo-tarball/default.nix +++ b/pkgs/build-support/rust/fetch-cargo-tarball/default.nix @@ -136,7 +136,7 @@ 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 runHook postBuild ''; diff --git a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh index 693c0b08759e..1c779a6541d8 100644 --- a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh @@ -22,7 +22,7 @@ cargoSetupPostUnpackHook() { mkdir .cargo fi - config="$cargoDepsCopy/.cargo/config"; + config="$cargoDepsCopy/.cargo/config.toml" if [[ ! -e $config ]]; then config=@defaultConfig@ fi; @@ -30,9 +30,9 @@ cargoSetupPostUnpackHook() { tmp_config=$(mktemp) substitute $config $tmp_config \ --subst-var-by vendor "$cargoDepsCopy" - cat ${tmp_config} >> .cargo/config + cat ${tmp_config} >> .cargo/config.toml - cat >> .cargo/config <<'EOF' + cat >> .cargo/config.toml <<'EOF' @cargoConfig@ EOF diff --git a/pkgs/build-support/rust/import-cargo-lock.nix b/pkgs/build-support/rust/import-cargo-lock.nix index 3db3f0e5e1f0..e88931d0f383 100644 --- a/pkgs/build-support/rust/import-cargo-lock.nix +++ b/pkgs/build-support/rust/import-cargo-lock.nix @@ -229,7 +229,7 @@ let else "cp $lockFileContentsPath $out/Cargo.lock" } - cat > $out/.cargo/config < $out/.cargo/config.toml <> $out/.cargo/config <> $out/.cargo/config.toml <> $out/.cargo/config + cat "$crate/.cargo-config" >> $out/.cargo/config.toml fi fi done diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index d09e2e803068..ebd4fc86644e 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -233,7 +233,7 @@ in stdenv.mkDerivation (finalAttrs: { export JEMALLOC_SYS_WITH_LG_VADDR=48 '' + lib.optionalString (!(finalAttrs.src.passthru.isReleaseTarball or false)) '' mkdir .cargo - cat > .cargo/config <<\EOF + cat > .cargo/config.toml <<\EOF [source.crates-io] replace-with = "vendored-sources" [source.vendored-sources] diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix index eb55255191cf..80a21d426d3f 100644 --- a/pkgs/development/ruby-modules/gem-config/default.nix +++ b/pkgs/development/ruby-modules/gem-config/default.nix @@ -335,7 +335,7 @@ in rustc.unwrapped ]; preBuild = '' - cat ../.cargo/config > ext/fast_mmaped_file_rs/.cargo/config.toml + cat ../.cargo/config.toml > ext/fast_mmaped_file_rs/.cargo/config.toml sed -i "s|cargo-vendor-dir|$PWD/../cargo-vendor-dir|" ext/fast_mmaped_file_rs/.cargo/config.toml ''; postInstall = '' diff --git a/pkgs/servers/clickhouse/default.nix b/pkgs/servers/clickhouse/default.nix index 4b5071be7bd2..d65d82abb76e 100644 --- a/pkgs/servers/clickhouse/default.nix +++ b/pkgs/servers/clickhouse/default.nix @@ -133,9 +133,9 @@ in mkDerivation rec { pushd rust cargoDeps="$rustDeps" cargoSetupPostUnpackHook rustDepsCopy="$cargoDepsCopy" - cat .cargo/config >> .cargo/config.toml.in - cat .cargo/config >> skim/.cargo/config.toml.in - rm .cargo/config + cat .cargo/config.toml >> .cargo/config.toml.in + cat .cargo/config.toml >> skim/.cargo/config.toml.in + rm .cargo/config.toml popd popd