Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

### Added
* `cargoBench` can now be used to run cargo benchmarks

### Changed
* A warning will now be emitted if a derivation's `pname` or `version`
attributes are not set and the value cannot be loaded from the derivation's
Expand Down
18 changes: 18 additions & 0 deletions lib/cargoBench.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ mkCargoDerivation
}:

{ cargoExtraArgs ? ""
, cargoBenchExtraArgs ? ""
, ...
}@origArgs:
let
args = builtins.removeAttrs origArgs [
"cargoExtraArgs"
"cargoBenchExtraArgs"
];
in
mkCargoDerivation (args // {
pnameSuffix = "-bench";

buildPhaseCargoCommand = "cargoWithProfile bench ${cargoExtraArgs} ${cargoBenchExtraArgs}";
})
1 change: 1 addition & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ in
buildDepsOnly = callPackage ./buildDepsOnly.nix { };
buildPackage = callPackage ./buildPackage.nix { };
cargoAudit = callPackage ./cargoAudit.nix { };
cargoBench = callPackage ./cargoBench.nix { };
cargoBuild = callPackage ./cargoBuild.nix { };
cargoClippy = callPackage ./cargoClippy.nix { };
cargoDoc = callPackage ./cargoDoc.nix { };
Expand Down