From a3bc43ce06d132453f1f3de3e395b8cda19a3fc9 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Fri, 23 Apr 2021 17:51:12 +0200 Subject: pkgs/profpatsch/write-rust: alwyas run tests by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit testRustSimple wouldn’t work with all the rust functions, so let’s just use it internally and expose the tests via the conventional `doCheck` attribute instead. --- pkgs/profpatsch/write-rust.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'pkgs/profpatsch/write-rust.nix') diff --git a/pkgs/profpatsch/write-rust.nix b/pkgs/profpatsch/write-rust.nix index 1c02c014..13ba6b82 100644 --- a/pkgs/profpatsch/write-rust.nix +++ b/pkgs/profpatsch/write-rust.nix @@ -10,7 +10,13 @@ let "if" [ bins.s6-ln "-sL" path "$out" ] ]; - writeRustSimpleBin = name: { dependencies ? [], ... }@args: srcFile: pkgs.buildRustCrate ({ + writeRustSimpleBin = name: { + dependencies ? [], + doCheck ? true, + ... + }@args: srcFile: + (if doCheck then testRustSimple else pkgs.lib.id) + (pkgs.buildRustCrate ({ pname = name; version = "1.0.0"; crateName = name; @@ -21,9 +27,15 @@ let cp ${srcFile} $out/src/bin/${name}.rs find $out ''; - } // args); + } // args)); - writeRustSimpleLib = name: { dependencies ? [], ... }@args: srcFile: pkgs.buildRustCrate ({ + writeRustSimpleLib = name: { + dependencies ? [], + doCheck ? true, + ... + }@args: srcFile: + (if doCheck then testRustSimple else pkgs.lib.id) + (pkgs.buildRustCrate ({ pname = name; version = "1.0.0"; crateName = name; @@ -33,7 +45,7 @@ let cp ${srcFile} $out/src/lib.rs find $out ''; - } // args); + } // args)); /* Takes a `buildRustCrate` derivation as an input, * builds it with `{ buildTests = true; }` and runs @@ -65,6 +77,5 @@ in { writeRustSimple writeRustSimpleBin writeRustSimpleLib - testRustSimple ; } -- cgit 1.4.1