diff --git a/flake.nix b/flake.nix index 7be8f61..2f75245 100644 --- a/flake.nix +++ b/flake.nix @@ -60,7 +60,7 @@ { # Build a rust flake with a single crate single = { src, crateName, sharedDeps ? (system: [ ]) - , sharedNativeDeps ? (system: [ ]) }: + , sharedNativeDeps ? (system: [ ]), copyBins ? true, copyLibs ? false }: utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { @@ -103,23 +103,20 @@ # Main binary packages.${crateName} = naersk-lib.buildPackage { pname = "${crateName}"; - inherit buildInputs; - inherit nativeBuildInputs; + inherit buildInputs nativeBuildInputs copyBins copyLibs; root = src; }; # binary + tests packages.tests.${crateName} = naersk-lib.buildPackage { pname = "${crateName}"; - inherit buildInputs; - inherit nativeBuildInputs; + inherit buildInputs nativeBuildInputs copyBins copyLibs; root = src; doCheck = true; }; # Docs packages.docs.${crateName} = naersk-lib.buildPackage { pname = "${crateName}"; - inherit buildInputs; - inherit nativeBuildInputs; + inherit buildInputs nativeBuildInputs copyBins copyLibs; root = src; dontBuild = true; doDoc = true; @@ -136,7 +133,7 @@ stdenv.mkDerivation { name = "format lint"; src = src; - inherit buildInputs; + inherit buildInputs copyBins copyLibs; nativeBuildInputs = with pkgs; [ rust-bin.stable.latest.default ] ++ nativeBuildInputs; dontConfigure = true; @@ -148,7 +145,7 @@ stdenv.mkDerivation { name = "audit lint"; src = src; - inherit buildInputs; + inherit buildInputs copyBins copyLibs; nativeBuildInputs = with pkgs; [ rust-bin.stable.latest.default ] ++ nativeBuildInputs; dontConfigure = true; @@ -164,8 +161,7 @@ clippy.${crateName} = naersk-lib.buildPackage { pname = "${crateName}"; root = src; - inherit buildInputs; - inherit nativeBuildInputs; + inherit buildInputs nativeBuildInputs copyBins copyLibs; cargoTestCommands = (old: [ "cargo $cargo_options clippy" ]); doCheck = true; dontBuild = true;