Commit 023eba06 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

uv: use stdenv.hostPlatform.emulator to generate the shell completion unconditionally

parent d91865d4
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  cmake,
  rustPlatform,
  fetchFromGitHub,

  # nativeBuildInputs
  cmake,
  installShellFiles,
  pkg-config,
  rustPlatform,

  buildPackages,
  versionCheckHook,
  python3Packages,
  nix-update-script,
@@ -41,12 +45,15 @@ rustPlatform.buildRustPackage rec {
  # Tests require python3
  doCheck = false;

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    export HOME=$TMPDIR
  postInstall =
    let
      emulator = stdenv.hostPlatform.emulator buildPackages;
    in
    ''
      installShellCompletion --cmd uv \
      --bash <($out/bin/uv --generate-shell-completion bash) \
      --fish <($out/bin/uv --generate-shell-completion fish) \
      --zsh <($out/bin/uv --generate-shell-completion zsh)
        --bash <(${emulator} $out/bin/uv generate-shell-completion bash) \
        --fish <(${emulator} $out/bin/uv generate-shell-completion fish) \
        --zsh <(${emulator} $out/bin/uv generate-shell-completion zsh)
    '';

  nativeInstallCheckInputs = [