mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-29 10:42:21 +03:00
25 lines
537 B
Nix
25 lines
537 B
Nix
|
{ taplo
|
||
|
, mkCargoDerivation
|
||
|
}:
|
||
|
|
||
|
{ taploExtraArgs ? ""
|
||
|
, ...
|
||
|
}@origArgs:
|
||
|
let
|
||
|
args = builtins.removeAttrs origArgs [ "taploExtraArgs" ];
|
||
|
in
|
||
|
mkCargoDerivation (args // {
|
||
|
cargoArtifacts = null;
|
||
|
cargoVendorDir = null;
|
||
|
pnameSuffix = "-tomlfmt";
|
||
|
|
||
|
buildPhaseCargoCommand = "taplo fmt --check ${taploExtraArgs}";
|
||
|
|
||
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ taplo ];
|
||
|
|
||
|
preInstallPhases = [ "ensureTargetDir" ] ++ (args.preInstallPhases or [ ]);
|
||
|
ensureTargetDir = ''
|
||
|
mkdir -p ''${CARGO_TARGET_DIR:-target}
|
||
|
'';
|
||
|
})
|