mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-29 21:42:23 +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}
|
|
'';
|
|
})
|