From c299444bb9b618743598b760c865924c36954160 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 9 Jun 2024 13:51:59 +0200 Subject: [PATCH] fix(nix): make the package code correct - testDeps should be separate, in nativeBuildInputs to allow for disabling checks. - rust should be a native dependency as it doesn't need to be put nowhere next to the resulting binary. --- default.nix | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/default.nix b/default.nix index de5c1ff..2a9fc2b 100644 --- a/default.nix +++ b/default.nix @@ -9,20 +9,6 @@ darwin, python3, }: let - testDeps = [ - python3 - ]; - - buildDeps = rust: - [ - rust - ] - ++ (lib.optionals stdenv.isDarwin [ - libiconv - darwin.apple_sdk.frameworks.Foundation - ]) - ++ testDeps; - mkPackage = rust: (makeRustPlatform { cargo = rust; @@ -31,12 +17,22 @@ .buildRustPackage { pname = packageToml.name; inherit (packageToml) version; + src = builtins.path { path = ./.; inherit (packageToml) name; }; + + dontUseCargoParallelTests = true; + cargoLock.lockFile = ./Cargo.lock; - buildInputs = buildDeps rust; - dontUseCargoParallelTests = true; + + nativeBuildInputs = [ rust ]; + buildInputs = (lib.optional stdenv.isDarwin [ + libiconv + darwin.apple_sdk.frameworks.Foundation + ]); + + nativeCheckInputs = [python3]; }; in (mkPackage rust-bin.stable.latest.minimal)