From 9757c7101a0527c001fa9e9832764d5dc106ff25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 15 Feb 2021 06:54:18 +0100 Subject: [PATCH 1/6] buildRustPackage: factor out install phase to cargoInstallHook --- doc/languages-frameworks/rust.section.md | 2 + pkgs/build-support/rust/default.nix | 40 ++------------- .../rust/hooks/cargo-build-hook.sh | 6 +-- .../rust/hooks/cargo-install-hook.sh | 49 +++++++++++++++++++ pkgs/build-support/rust/hooks/default.nix | 9 ++++ .../compilers/rust/make-rust-platform.nix | 4 +- 6 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 pkgs/build-support/rust/hooks/cargo-install-hook.sh diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index c53818f8157..8451c126410 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -293,6 +293,8 @@ attributes can also be used: variable `buildAndTestSubdir` can be used to build a crate in a Cargo workspace. Additional maturin flags can be passed through `maturinBuildFlags`. +* `cargoInstallHook`: install binaries and static/shared libraries + that were built using `cargoBuildHook`. ### Examples diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index 19ec71261be..b7d6cb522bc 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -4,6 +4,7 @@ , cacert , cargo , cargoBuildHook +, cargoInstallHook , cargoSetupHook , fetchCargoTarball , runCommandNoCC @@ -87,9 +88,6 @@ let originalCargoToml = src + /Cargo.toml; # profile info is later extracted }; - releaseDir = "target/${shortTarget}/${buildType}"; - tmpDir = "${releaseDir}-tmp"; - in # Tests don't currently work for `no_std`, and all custom sysroots are currently built without `std`. @@ -99,16 +97,16 @@ assert useSysroot -> !(args.doCheck or true); stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs useSysroot { RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or ""); } // { - inherit buildAndTestSubdir cargoDeps releaseDir tmpDir; + inherit buildAndTestSubdir cargoDeps; cargoBuildFlags = lib.concatStringsSep " " cargoBuildFlags; - cargoBuildType = "--${buildType}"; + cargoBuildType = buildType; patchRegistryDeps = ./patch-registry-deps; nativeBuildInputs = nativeBuildInputs ++ - [ cacert git cargo cargoBuildHook cargoSetupHook rustc ]; + [ cacert git cargo cargoBuildHook cargoInstallHook cargoSetupHook rustc ]; buildInputs = buildInputs ++ lib.optional stdenv.hostPlatform.isMinGW windows.pthreads; @@ -144,36 +142,6 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u strictDeps = true; - installPhase = args.installPhase or '' - runHook preInstall - - # This needs to be done after postBuild: packages like `cargo` do a pushd/popd in - # the pre/postBuild-hooks that need to be taken into account before gathering - # all binaries to install. - mkdir -p $tmpDir - cp -r $releaseDir/* $tmpDir/ - bins=$(find $tmpDir \ - -maxdepth 1 \ - -type f \ - -executable ! \( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \)) - - # rename the output dir to a architecture independent one - mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep '${tmpDir}$') - for target in "''${targets[@]}"; do - rm -rf "$target/../../${buildType}" - ln -srf "$target" "$target/../../" - done - mkdir -p $out/bin $out/lib - - xargs -r cp -t $out/bin <<< $bins - find $tmpDir \ - -maxdepth 1 \ - -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \ - -print0 | xargs -r -0 cp -t $out/lib - rmdir --ignore-fail-on-non-empty $out/lib $out/bin - runHook postInstall - ''; - passthru = { inherit cargoDeps; } // (args.passthru or {}); meta = { diff --git a/pkgs/build-support/rust/hooks/cargo-build-hook.sh b/pkgs/build-support/rust/hooks/cargo-build-hook.sh index 55585233413..85a3827dc10 100644 --- a/pkgs/build-support/rust/hooks/cargo-build-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-build-hook.sh @@ -17,16 +17,16 @@ cargoBuildHook() { cargo build -j $NIX_BUILD_CORES \ --target @rustTargetPlatformSpec@ \ --frozen \ - ${cargoBuildType} \ + --${cargoBuildType} \ ${cargoBuildFlags} ) - runHook postBuild - if [ ! -z "${buildAndTestSubdir-}" ]; then popd fi + runHook postBuild + echo "Finished cargoBuildHook" } diff --git a/pkgs/build-support/rust/hooks/cargo-install-hook.sh b/pkgs/build-support/rust/hooks/cargo-install-hook.sh new file mode 100644 index 00000000000..e6ffa300706 --- /dev/null +++ b/pkgs/build-support/rust/hooks/cargo-install-hook.sh @@ -0,0 +1,49 @@ +cargoInstallPostBuildHook() { + echo "Executing cargoInstallPostBuildHook" + + releaseDir=target/@shortTarget@/$cargoBuildType + tmpDir="${releaseDir}-tmp"; + + mkdir -p $tmpDir + cp -r ${releaseDir}/* $tmpDir/ + bins=$(find $tmpDir \ + -maxdepth 1 \ + -type f \ + -executable ! \( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \)) + + echo "Finished cargoInstallPostBuildHook" +} + +cargoInstallHook() { + echo "Executing cargoInstallHook" + + runHook preInstall + + # rename the output dir to a architecture independent one + + releaseDir=target/@shortTarget@/$cargoBuildType + tmpDir="${releaseDir}-tmp"; + + mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep "${tmpDir}$") + for target in "${targets[@]}"; do + rm -rf "$target/../../${cargoBuildType}" + ln -srf "$target" "$target/../../" + done + mkdir -p $out/bin $out/lib + + xargs -r cp -t $out/bin <<< $bins + find $tmpDir \ + -maxdepth 1 \ + -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \ + -print0 | xargs -r -0 cp -t $out/lib + rmdir --ignore-fail-on-non-empty $out/lib $out/bin + runHook postInstall + + echo "Finished cargoInstallHook" +} + + +if [ -z "${installPhase-}" ]; then + installPhase=cargoInstallHook + postBuildHooks+=(cargoInstallPostBuildHook) +fi diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix index d4b2cc15605..b43f83acda0 100644 --- a/pkgs/build-support/rust/hooks/default.nix +++ b/pkgs/build-support/rust/hooks/default.nix @@ -36,6 +36,15 @@ in { }; } ./cargo-build-hook.sh) {}; + cargoInstallHook = callPackage ({ }: + makeSetupHook { + name = "cargo-install-hook.sh"; + deps = [ ]; + substitutions = { + inherit shortTarget; + }; + } ./cargo-install-hook.sh) {}; + cargoSetupHook = callPackage ({ }: makeSetupHook { name = "cargo-setup-hook.sh"; diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix index 1ea97b48c44..e963c463135 100644 --- a/pkgs/development/compilers/rust/make-rust-platform.nix +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -12,7 +12,7 @@ rec { }; buildRustPackage = callPackage ../../../build-support/rust { - inherit rustc cargo cargoBuildHook cargoSetupHook fetchCargoTarball; + inherit rustc cargo cargoBuildHook cargoInstallHook cargoSetupHook fetchCargoTarball; }; rustcSrc = callPackage ./rust-src.nix { @@ -26,5 +26,5 @@ rec { # Hooks inherit (callPackage ../../../build-support/rust/hooks { inherit cargo; - }) cargoBuildHook cargoSetupHook maturinBuildHook; + }) cargoBuildHook cargoInstallHook cargoSetupHook maturinBuildHook; } From 05e40e79a8559cdbe323ab05e003d56033000ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 15 Feb 2021 10:26:40 +0100 Subject: [PATCH 2/6] buildRustPackage: factor out check phase to cargoCheckHook API change: `cargoParallelTestThreads` suggests that this attribute sets the number of threads used during tests, while it is actually a boolean option (use 1 thread or NIX_BUILD_CORES threads). In the hook, this is replaced by a more canonical name `dontUseCargoParallelTests`. --- doc/languages-frameworks/rust.section.md | 6 ++- .../networking/browsers/castor/default.nix | 2 +- pkgs/build-support/rust/default.nix | 26 +++++-------- .../rust/hooks/cargo-check-hook.sh | 37 +++++++++++++++++++ pkgs/build-support/rust/hooks/default.nix | 9 +++++ .../compilers/rust/make-rust-platform.nix | 5 ++- pkgs/development/tools/the-way/default.nix | 2 +- 7 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 pkgs/build-support/rust/hooks/cargo-check-hook.sh diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 8451c126410..2290d92f7ad 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -196,7 +196,7 @@ sometimes it may be necessary to disable this so the tests run consecutively. ```nix rustPlatform.buildRustPackage { /* ... */ - cargoParallelTestThreads = false; + dontUseCargoParallelTests = true; } ``` @@ -293,6 +293,10 @@ attributes can also be used: variable `buildAndTestSubdir` can be used to build a crate in a Cargo workspace. Additional maturin flags can be passed through `maturinBuildFlags`. +* `cargoCheckHook`: run tests using Cargo. Additional flags can be + passed to Cargo using `checkFlags` and `checkFlagsArray`. By + default, tests are run in parallel. This can be disabled by setting + `dontUseCargoParallelTests`. * `cargoInstallHook`: install binaries and static/shared libraries that were built using `cargoBuildHook`. diff --git a/pkgs/applications/networking/browsers/castor/default.nix b/pkgs/applications/networking/browsers/castor/default.nix index be3d8295f99..daead82e485 100644 --- a/pkgs/applications/networking/browsers/castor/default.nix +++ b/pkgs/applications/networking/browsers/castor/default.nix @@ -39,7 +39,7 @@ rustPlatform.buildRustPackage rec { postInstall = "make PREFIX=$out copy-data"; # Sometimes tests fail when run in parallel - cargoParallelTestThreads = false; + dontUseCargoParallelThreads = true; meta = with lib; { description = "A graphical client for plain-text protocols written in Rust with GTK. It currently supports the Gemini, Gopher and Finger protocols"; diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index b7d6cb522bc..760f7c920da 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -2,8 +2,8 @@ , lib , buildPackages , cacert -, cargo , cargoBuildHook +, cargoCheckHook , cargoInstallHook , cargoSetupHook , fetchCargoTarball @@ -42,7 +42,6 @@ , cargoVendorDir ? null , checkType ? buildType , depsExtraArgs ? {} -, cargoParallelTestThreads ? true # Toggles whether a custom sysroot is created when the target is a .json file. , __internal_dontAddSysroot ? false @@ -105,8 +104,15 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u patchRegistryDeps = ./patch-registry-deps; - nativeBuildInputs = nativeBuildInputs ++ - [ cacert git cargo cargoBuildHook cargoInstallHook cargoSetupHook rustc ]; + nativeBuildInputs = nativeBuildInputs ++ [ + cacert + git + cargoBuildHook + cargoCheckHook + cargoInstallHook + cargoSetupHook + rustc + ]; buildInputs = buildInputs ++ lib.optional stdenv.hostPlatform.isMinGW windows.pthreads; @@ -126,18 +132,6 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u runHook postConfigure ''; - checkPhase = args.checkPhase or (let - argstr = "${lib.optionalString (checkType == "release") "--release"} --target ${target} --frozen"; - threads = if cargoParallelTestThreads then "$NIX_BUILD_CORES" else "1"; - in '' - ${lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"} - runHook preCheck - echo "Running cargo test ${argstr} -- ''${checkFlags} ''${checkFlagsArray+''${checkFlagsArray[@]}}" - cargo test -j $NIX_BUILD_CORES ${argstr} -- --test-threads=${threads} ''${checkFlags} ''${checkFlagsArray+"''${checkFlagsArray[@]}"} - runHook postCheck - ${lib.optionalString (buildAndTestSubdir != null) "popd"} - ''); - doCheck = args.doCheck or true; strictDeps = true; diff --git a/pkgs/build-support/rust/hooks/cargo-check-hook.sh b/pkgs/build-support/rust/hooks/cargo-check-hook.sh new file mode 100644 index 00000000000..a1df2babffb --- /dev/null +++ b/pkgs/build-support/rust/hooks/cargo-check-hook.sh @@ -0,0 +1,37 @@ +cargoCheckHook() { + echo "Executing cargoCheckHook" + + runHook preCheck + + if [[ -n "${buildAndTestSubdir-}" ]]; then + pushd "${buildAndTestSubdir}" + fi + + if [[ -z ${dontUseCargoParallelTests-} ]]; then + threads=$NIX_BUILD_CORES + else + threads=1 + fi + + argstr="--${cargoBuildType} --target @rustTargetPlatformSpec@ --frozen"; + + ( + set -x + cargo test \ + -j $NIX_BUILD_CORES \ + ${argstr} -- \ + --test-threads=${threads} \ + ${checkFlags} \ + ${checkFlagsArray+"${checkFlagsArray[@]}"} + ) + + if [[ -n "${buildAndTestSubdir-}" ]]; then + popd + fi + + echo "Finished cargoCheckHook" + + runHook postCheck +} + +checkPhase=cargoCheckHook diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix index b43f83acda0..e8927e2b542 100644 --- a/pkgs/build-support/rust/hooks/default.nix +++ b/pkgs/build-support/rust/hooks/default.nix @@ -36,6 +36,15 @@ in { }; } ./cargo-build-hook.sh) {}; + cargoCheckHook = callPackage ({ }: + makeSetupHook { + name = "cargo-check-hook.sh"; + deps = [ cargo ]; + substitutions = { + inherit rustTargetPlatformSpec; + }; + } ./cargo-check-hook.sh) {}; + cargoInstallHook = callPackage ({ }: makeSetupHook { name = "cargo-install-hook.sh"; diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix index e963c463135..584b1fdbe43 100644 --- a/pkgs/development/compilers/rust/make-rust-platform.nix +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -12,7 +12,8 @@ rec { }; buildRustPackage = callPackage ../../../build-support/rust { - inherit rustc cargo cargoBuildHook cargoInstallHook cargoSetupHook fetchCargoTarball; + inherit cargoBuildHook cargoCheckHook cargoInstallHook cargoSetupHook + fetchCargoTarball rustc; }; rustcSrc = callPackage ./rust-src.nix { @@ -26,5 +27,5 @@ rec { # Hooks inherit (callPackage ../../../build-support/rust/hooks { inherit cargo; - }) cargoBuildHook cargoInstallHook cargoSetupHook maturinBuildHook; + }) cargoBuildHook cargoCheckHook cargoInstallHook cargoSetupHook maturinBuildHook; } diff --git a/pkgs/development/tools/the-way/default.nix b/pkgs/development/tools/the-way/default.nix index e8f52fa8334..6d7fbef2f19 100644 --- a/pkgs/development/tools/the-way/default.nix +++ b/pkgs/development/tools/the-way/default.nix @@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "sha256-jTZso61Lyt6jprBxBAhvchgOsgM9y1qBleTxUx1jCnE="; checkFlagsArray = lib.optionals stdenv.isDarwin [ "--skip=copy" ]; - cargoParallelTestThreads = false; + dontUseCargoParallelTests = true; postInstall = '' $out/bin/the-way config default tmp.toml From 087ab3db9cd2a597700e438ae1d0fbe90c1e3fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 15 Feb 2021 12:08:06 +0100 Subject: [PATCH 3/6] buildRustPackage: handle cargoBuildFlags in cargoBuildHook --- pkgs/build-support/rust/default.nix | 3 --- pkgs/build-support/rust/hooks/cargo-build-hook.sh | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index 760f7c920da..a7bd296d673 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -36,7 +36,6 @@ , nativeBuildInputs ? [] , cargoUpdateHook ? "" , cargoDepsHook ? "" -, cargoBuildFlags ? [] , buildType ? "release" , meta ? {} , cargoVendorDir ? null @@ -98,8 +97,6 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u } // { inherit buildAndTestSubdir cargoDeps; - cargoBuildFlags = lib.concatStringsSep " " cargoBuildFlags; - cargoBuildType = buildType; patchRegistryDeps = ./patch-registry-deps; diff --git a/pkgs/build-support/rust/hooks/cargo-build-hook.sh b/pkgs/build-support/rust/hooks/cargo-build-hook.sh index 85a3827dc10..54f4512d67c 100644 --- a/pkgs/build-support/rust/hooks/cargo-build-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-build-hook.sh @@ -1,3 +1,5 @@ +declare -a cargoBuildFlags + cargoBuildHook() { echo "Executing cargoBuildHook" From 1df80d2bade93da39d844ce3b60185d79689e4bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 15 Feb 2021 11:18:37 +0100 Subject: [PATCH 4/6] diesel-cli: use comma-separated features, use buildAndTestSubdir --- .../rust/hooks/cargo-check-hook.sh | 6 +++++- pkgs/development/tools/diesel-cli/default.nix | 20 +++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pkgs/build-support/rust/hooks/cargo-check-hook.sh b/pkgs/build-support/rust/hooks/cargo-check-hook.sh index a1df2babffb..8c5b1a13219 100644 --- a/pkgs/build-support/rust/hooks/cargo-check-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-check-hook.sh @@ -1,3 +1,5 @@ +declare -a checkFlags + cargoCheckHook() { echo "Executing cargoCheckHook" @@ -34,4 +36,6 @@ cargoCheckHook() { runHook postCheck } -checkPhase=cargoCheckHook +if [ -z "${checkPhase-}" ]; then + checkPhase=cargoCheckHook +fi diff --git a/pkgs/development/tools/diesel-cli/default.nix b/pkgs/development/tools/diesel-cli/default.nix index bd8e71090c5..20185ff7d13 100644 --- a/pkgs/development/tools/diesel-cli/default.nix +++ b/pkgs/development/tools/diesel-cli/default.nix @@ -9,11 +9,9 @@ assert lib.assertMsg (sqliteSupport == true || postgresqlSupport == true || mysq let inherit (lib) optional optionals optionalString; - features = '' - ${optionalString sqliteSupport "sqlite"} \ - ${optionalString postgresqlSupport "postgres"} \ - ${optionalString mysqlSupport "mysql"} \ - ''; + features = optional sqliteSupport "sqlite" + ++ optional postgresqlSupport "postgres" + ++ optional mysqlSupport "mysql"; in rustPlatform.buildRustPackage rec { @@ -35,11 +33,12 @@ rustPlatform.buildRustPackage rec { ./allow-warnings.patch ]; - cargoBuildFlags = [ "--no-default-features --features \"${features}\"" ]; + cargoBuildFlags = [ "--no-default-features" "--features" "${lib.concatStringsSep "," features}" ]; cargoPatches = [ ./cargo-lock.patch ]; cargoSha256 = "1vbb7r0dpmq8363i040bkhf279pz51c59kcq9v5qr34hs49ish8g"; nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl ] ++ optional stdenv.isDarwin Security ++ optional (stdenv.isDarwin && mysqlSupport) libiconv @@ -47,12 +46,7 @@ rustPlatform.buildRustPackage rec { ++ optional postgresqlSupport postgresql ++ optionals mysqlSupport [ mysql zlib ]; - # We must `cd diesel_cli`, we cannot use `--package diesel_cli` to build - # because --features fails to apply to the package: - # https://github.com/rust-lang/cargo/issues/5015 - # https://github.com/rust-lang/cargo/issues/4753 - preBuild = "cd diesel_cli"; - postBuild = "cd .."; + buildAndTestSubdir = "diesel_cli"; checkPhase = optionalString sqliteSupport '' (cd diesel_cli && cargo check --features sqlite) @@ -65,7 +59,7 @@ rustPlatform.buildRustPackage rec { # Fix the build with mariadb, which otherwise shows "error adding symbols: # DSO missing from command line" errors for libz and libssl. - NIX_LDFLAGS = lib.optionalString mysqlSupport "-lz -lssl -lcrypto"; + NIX_LDFLAGS = optionalString mysqlSupport "-lz -lssl -lcrypto"; meta = with lib; { description = "Database tool for working with Rust projects that use Diesel"; From 2df314c261c06c51a940338e2b3f7997d58208ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 15 Feb 2021 11:51:27 +0100 Subject: [PATCH 5/6] wasmer: remove spurious feature quotation --- pkgs/development/interpreters/wasmer/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/wasmer/default.nix b/pkgs/development/interpreters/wasmer/default.nix index 60ce4d89f19..91e13ed32cd 100644 --- a/pkgs/development/interpreters/wasmer/default.nix +++ b/pkgs/development/interpreters/wasmer/default.nix @@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec { # using the [makefile](https://github.com/wasmerio/wasmer/blob/master/Makefile). # Enabling cranelift as this used to be the old default. At least one backend is # needed for the run subcommand to work. - cargoBuildFlags = [ "--features 'backend-cranelift'" ]; + cargoBuildFlags = [ "--features" "backend-cranelift" ]; LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; From 2376921de5c85b75e9b868d1f9dd98d209a19afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 15 Feb 2021 12:01:34 +0100 Subject: [PATCH 6/6] rls: update preBuild for changes in buildRustPackage preBuild is now run before changing to buildAndTestSubdir, so use full path to tests/client.rs in preBuild. --- pkgs/development/compilers/rust/rls/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/rust/rls/default.nix b/pkgs/development/compilers/rust/rls/default.nix index ee860d78258..f2835919631 100644 --- a/pkgs/development/compilers/rust/rls/default.nix +++ b/pkgs/development/compilers/rust/rls/default.nix @@ -2,7 +2,7 @@ , openssh, openssl, pkg-config, cmake, zlib, curl, libiconv , CoreFoundation, Security }: -rustPlatform.buildRustPackage { +rustPlatform.buildRustPackage rec { pname = "rls"; inherit (rustPlatform.rust.rustc) src version; @@ -14,7 +14,7 @@ rustPlatform.buildRustPackage { preBuild = '' # client tests are flaky - rm tests/client.rs + rm ${buildAndTestSubdir}/tests/client.rs ''; # a nightly compiler is required unless we use this cheat code.