From 8a06f7a8d0984b0f82aa2fe3746c96fccca715e7 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 18:19:39 -0700 Subject: [PATCH] starship: emulate shell completions see https://nixos.org/manual/nixpkgs/unstable/#installshellfiles-installshellcompletion --- pkgs/tools/misc/starship/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index 152b51df10c1..dc1affff975b 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -10,6 +10,7 @@ Security, Foundation, Cocoa, + buildPackages, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -50,12 +51,17 @@ rustPlatform.buildRustPackage (finalAttrs: { mkdir -p $presetdir cp docs/public/presets/toml/*.toml $presetdir '' - + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' - installShellCompletion --cmd starship \ - --bash <($out/bin/starship completions bash) \ - --fish <($out/bin/starship completions fish) \ - --zsh <($out/bin/starship completions zsh) - ''; + + lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd starship \ + --bash <(${emulator} $out/bin/starship completions bash) \ + --fish <(${emulator} $out/bin/starship completions fish) \ + --zsh <(${emulator} $out/bin/starship completions zsh) + '' + ); useFetchCargoVendor = true; cargoHash = "sha256-B2CCrSH2aTcGEX96oBxl/27hNMdDpdd2vxdt0/nlN6I=";