diff --git a/pkgs/by-name/as/ast-grep/package.nix b/pkgs/by-name/as/ast-grep/package.nix index 4783207b3a6f..e03894c63e96 100644 --- a/pkgs/by-name/as/ast-grep/package.nix +++ b/pkgs/by-name/as/ast-grep/package.nix @@ -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