mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-27 02:52:02 +03:00
28 lines
608 B
Nix
28 lines
608 B
Nix
{ cargoBuild
|
|
, rustfmt
|
|
}:
|
|
|
|
{ cargoExtraArgs ? ""
|
|
, rustFmtExtraArgs ? ""
|
|
, ...
|
|
}@origArgs:
|
|
let
|
|
args = builtins.removeAttrs origArgs [ "rustFmtExtraArgs" ];
|
|
in
|
|
cargoBuild (args // {
|
|
cargoArtifacts = null;
|
|
cargoVendorDir = null;
|
|
doCheck = 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}
|
|
'';
|
|
})
|