ast-grep: remove emulator support (#408028)

This commit is contained in:
Aleksana
2025-05-23 15:21:23 +08:00
committed by GitHub
+11 -17
View File
@@ -4,7 +4,6 @@
fetchFromGitHub,
stdenv,
installShellFiles,
buildPackages,
versionCheckHook,
nix-update-script,
enableLegacySg ? false,
@@ -35,23 +34,18 @@ rustPlatform.buildRustPackage (finalAttrs: {
"--package ast-grep --bin ast-grep"
] ++ lib.optionals enableLegacySg [ "--package ast-grep --bin sg" ];
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
''
installShellCompletion --cmd ast-grep \
--bash <(${emulator} $out/bin/ast-grep completions bash) \
--fish <(${emulator} $out/bin/ast-grep completions fish) \
--zsh <(${emulator} $out/bin/ast-grep completions zsh)
''
+ lib.optionalString enableLegacySg ''
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd ast-grep \
--bash <($out/bin/ast-grep completions bash) \
--fish <($out/bin/ast-grep completions fish) \
--zsh <($out/bin/ast-grep completions zsh)
${lib.optionalString enableLegacySg ''
installShellCompletion --cmd sg \
--bash <(${emulator} $out/bin/sg completions bash) \
--fish <(${emulator} $out/bin/sg completions fish) \
--zsh <(${emulator} $out/bin/sg completions zsh)
''
);
--bash <($out/bin/sg completions bash) \
--fish <($out/bin/sg completions fish) \
--zsh <($out/bin/sg completions zsh)
''}
'';
nativeInstallCheckInputs = [
versionCheckHook