crane/lib/taploFmt.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
537 B
Nix
Raw Normal View History

{ 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}
'';
})