mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-30 05:57:28 +03:00
90d5ad84c4
* This allows potentially chaining `cargoFmt` invocations with other derivations
29 lines
643 B
Nix
29 lines
643 B
Nix
{ cargoBuild
|
|
, rustfmt
|
|
}:
|
|
|
|
{ cargoExtraArgs ? ""
|
|
, rustFmtExtraArgs ? ""
|
|
, ...
|
|
}@origArgs:
|
|
let
|
|
args = builtins.removeAttrs origArgs [ "rustFmtExtraArgs" ];
|
|
in
|
|
cargoBuild (args // {
|
|
cargoArtifacts = null;
|
|
cargoVendorDir = null;
|
|
doCheck = false;
|
|
doRemapSourcePathPrefix = false;
|
|
pnameSuffix = "-fmt";
|
|
|
|
cargoBuildCommand = "cargo fmt";
|
|
cargoExtraArgs = "${cargoExtraArgs} -- --check ${rustFmtExtraArgs}";
|
|
|
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ rustfmt ];
|
|
|
|
preInstallPhases = [ "ensureTargetDir" ] ++ (args.preInstallPhases or [ ]);
|
|
ensureTargetDir = ''
|
|
mkdir -p ''${CARGO_TARGET_DIR:-target}
|
|
'';
|
|
})
|