mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 23:17:15 +03:00
29 lines
613 B
Nix
29 lines
613 B
Nix
{ mkCargoDerivation
|
|
, rustfmt
|
|
}:
|
|
|
|
{ cargoExtraArgs ? ""
|
|
, rustFmtExtraArgs ? ""
|
|
, ...
|
|
}@origArgs:
|
|
let
|
|
args = builtins.removeAttrs origArgs [
|
|
"cargoExtraArgs"
|
|
"rustFmtExtraArgs"
|
|
];
|
|
in
|
|
mkCargoDerivation (args // {
|
|
cargoArtifacts = null;
|
|
cargoVendorDir = null;
|
|
pnameSuffix = "-fmt";
|
|
|
|
buildPhaseCargoCommand = "cargo fmt ${cargoExtraArgs} -- --check ${rustFmtExtraArgs}";
|
|
|
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ rustfmt ];
|
|
|
|
preInstallPhases = [ "ensureTargetDir" ] ++ (args.preInstallPhases or [ ]);
|
|
ensureTargetDir = ''
|
|
mkdir -p ''${CARGO_TARGET_DIR:-target}
|
|
'';
|
|
})
|