mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 23:17:15 +03:00
cargoFmt: use mkCargoDerivation instead of cargoBuild
This commit is contained in:
parent
cc7d69f1ed
commit
51bbfae3f6
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
`crateNameFromCargoToml`) if they are not specified
|
||||
* `mkCargoDerivation` now defaults to an empty `checkPhaseCargoCommand` if not
|
||||
specified
|
||||
* `cargoFmt` now delegates to `mkCargoDerivation` instead of `cargoBuild`
|
||||
|
||||
### Fixed
|
||||
* Installing binaries now uses the same version of cargo as was used to build
|
||||
|
13
docs/API.md
13
docs/API.md
@ -402,20 +402,18 @@ Create a derivation which will run a `cargo fmt` invocation in a cargo
|
||||
workspace.
|
||||
|
||||
Except where noted below, all derivation attributes are delegated to
|
||||
`cargoBuild`, and can be used to influence its behavior.
|
||||
`mkCargoDerivation`, and can be used to influence its behavior.
|
||||
* `buildPhaseCargoCommand` will be set to run `cargo fmt` (in check mode) in the
|
||||
workspace.
|
||||
* `cargoArtifacts` is disabled/cleared
|
||||
* `cargoBuildCommand` will be set to run `cargo fmt` in the workspace.
|
||||
* `cargoExtraArgs` will have `rustFmtExtraArgs` appended to it
|
||||
- Default value: `""`
|
||||
* `cargoVendorDir` is disabled/cleared
|
||||
* `doCheck` is disabled
|
||||
* `pnameSuffix` will be set to `"-fmt"`
|
||||
|
||||
#### Optional attributes
|
||||
* `rustFmtExtraArgs`: additional flags to be passed in the rustfmt invocation
|
||||
- Default value: `""`
|
||||
* `cargoExtraArgs`: additional flags to be passed in the cargo invocation
|
||||
- Default value: `""`
|
||||
* `rustFmtExtraArgs`: additional flags to be passed in the rustfmt invocation
|
||||
- Default value: `""`
|
||||
|
||||
#### Native build dependencies
|
||||
The `rustfmt` package is automatically appended as a native build input to any
|
||||
@ -426,6 +424,7 @@ The following attributes will be removed before being lowered to
|
||||
`cargoBuild`. If you absolutely need these attributes present as
|
||||
environment variables during the build, you can bring them back via
|
||||
`.overrideAttrs`.
|
||||
* `cargoExtraArgs`
|
||||
* `rustFmtExtraArgs`
|
||||
|
||||
### `lib.cargoNextest`
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ cargoBuild
|
||||
{ mkCargoDerivation
|
||||
, rustfmt
|
||||
}:
|
||||
|
||||
@ -7,16 +7,17 @@
|
||||
, ...
|
||||
}@origArgs:
|
||||
let
|
||||
args = builtins.removeAttrs origArgs [ "rustFmtExtraArgs" ];
|
||||
args = builtins.removeAttrs origArgs [
|
||||
"cargoExtraArgs"
|
||||
"rustFmtExtraArgs"
|
||||
];
|
||||
in
|
||||
cargoBuild (args // {
|
||||
mkCargoDerivation (args // {
|
||||
cargoArtifacts = null;
|
||||
cargoVendorDir = null;
|
||||
doCheck = false;
|
||||
pnameSuffix = "-fmt";
|
||||
|
||||
cargoBuildCommand = "cargo fmt";
|
||||
cargoExtraArgs = "${cargoExtraArgs} -- --check ${rustFmtExtraArgs}";
|
||||
buildPhaseCargoCommand = "cargo fmt ${cargoExtraArgs} -- --check ${rustFmtExtraArgs}";
|
||||
|
||||
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ rustfmt ];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user