2022-10-09 21:45:27 +03:00
|
|
|
{ mkCargoDerivation
|
2022-01-17 04:49:39 +03:00
|
|
|
, rustfmt
|
|
|
|
}:
|
|
|
|
|
|
|
|
{ cargoExtraArgs ? ""
|
|
|
|
, rustFmtExtraArgs ? ""
|
|
|
|
, ...
|
|
|
|
}@origArgs:
|
|
|
|
let
|
2022-10-09 21:45:27 +03:00
|
|
|
args = builtins.removeAttrs origArgs [
|
|
|
|
"cargoExtraArgs"
|
|
|
|
"rustFmtExtraArgs"
|
|
|
|
];
|
2022-01-17 04:49:39 +03:00
|
|
|
in
|
2022-10-09 21:45:27 +03:00
|
|
|
mkCargoDerivation (args // {
|
2022-01-17 04:49:39 +03:00
|
|
|
cargoArtifacts = null;
|
|
|
|
cargoVendorDir = null;
|
|
|
|
pnameSuffix = "-fmt";
|
|
|
|
|
2022-10-09 21:45:27 +03:00
|
|
|
buildPhaseCargoCommand = "cargo fmt ${cargoExtraArgs} -- --check ${rustFmtExtraArgs}";
|
2022-01-17 04:49:39 +03:00
|
|
|
|
|
|
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ rustfmt ];
|
2022-02-11 08:02:48 +03:00
|
|
|
|
|
|
|
preInstallPhases = [ "ensureTargetDir" ] ++ (args.preInstallPhases or [ ]);
|
|
|
|
ensureTargetDir = ''
|
|
|
|
mkdir -p ''${CARGO_TARGET_DIR:-target}
|
|
|
|
'';
|
2022-01-17 04:49:39 +03:00
|
|
|
})
|