dprint: installShellFiles when cross compiling (#422602)

This commit is contained in:
Aleksana
2025-07-07 17:22:44 +08:00
committed by GitHub
+12 -8
View File
@@ -3,6 +3,7 @@
stdenv,
fetchFromGitHub,
rustPlatform,
buildPackages,
installShellFiles,
writableTmpDirAsHomeHook,
versionCheckHook,
@@ -26,9 +27,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
useFetchCargoVendor = true;
cargoHash = "sha256-OnrsuVK1gEDweldq+P8lDkkrHjklsG8MRpM0wqWsdlM=";
nativeBuildInputs = lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
installShellFiles
];
nativeBuildInputs = [ installShellFiles ];
cargoBuildFlags = [
"--package=dprint"
@@ -51,15 +50,20 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
postInstall =
let
dprint =
if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
"$out/bin/dprint"
else
lib.getExe buildPackages.dprint;
in
''
rm "$out/bin/test-process-plugin"
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
export DPRINT_CACHE_DIR="$(mktemp -d)"
installShellCompletion --cmd dprint \
--bash <($out/bin/dprint completions bash) \
--zsh <($out/bin/dprint completions zsh) \
--fish <($out/bin/dprint completions fish)
--bash <(${dprint} completions bash) \
--zsh <(${dprint} completions zsh) \
--fish <(${dprint} completions fish)
'';
nativeInstallCheckInputs = [