From c8b98cecd7a2885729ba6d52058f194a57a3c3b5 Mon Sep 17 00:00:00 2001 From: TNE <38938720+JustTNE@users.noreply.github.com> Date: Tue, 27 Sep 2022 22:40:41 +0200 Subject: [PATCH] zerotierone: Use pre-vendored cargo dependencies (#193093) ZeroTierOne already vendors the dependencies for us, so there is no point in doing it twice. Unfortunately, the ZeroTierOne developers forgot to specify rust-jwt in the cargo configuration file, so we have to manually do that to allow it to work as intended. --- pkgs/tools/networking/zerotierone/default.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/networking/zerotierone/default.nix b/pkgs/tools/networking/zerotierone/default.nix index 5faebe9bdadd..05e9651bcb3c 100644 --- a/pkgs/tools/networking/zerotierone/default.nix +++ b/pkgs/tools/networking/zerotierone/default.nix @@ -26,13 +26,6 @@ let in stdenv.mkDerivation { inherit pname version src; - cargoDeps = rustPlatform.fetchCargoTarball { - src = "${src}/zeroidc"; - name = "${pname}-${version}"; - sha256 = "sha256-8K4zAXo85MT4pfIsg7DZAO+snfwzdo2TozVw17KhX4Q="; - }; - postPatch = "cp ${src}/zeroidc/Cargo.lock Cargo.lock"; - preConfigure = '' patchShebangs ./doc/build.sh substituteInPlace ./doc/build.sh \ @@ -41,12 +34,17 @@ in stdenv.mkDerivation { substituteInPlace ./make-linux.mk \ --replace '-march=armv6zk' "" \ --replace '-mcpu=arm1176jzf-s' "" + + # Upstream does not define the cargo settings necessary to use the vendorized rust-jwt version, so it has to be added manually. + # Can be removed once ZeroTierOne's zeroidc no longer uses a git url in Cargo.toml for jwt + echo '[source."https://github.com/glimberg/rust-jwt"] +git = "https://github.com/glimberg/rust-jwt" +replace-with = "vendored-sources"' >> ./zeroidc/.cargo/config.toml ''; nativeBuildInputs = [ pkg-config ronn - rustPlatform.cargoSetupHook rustPlatform.rust.cargo rustPlatform.rust.rustc ];