From 023eba06340a7e994253887e5207dfb8f35a3cc3 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 24 Dec 2024 09:46:26 +0100 Subject: [PATCH] uv: use stdenv.hostPlatform.emulator to generate the shell completion unconditionally --- pkgs/by-name/uv/uv/package.nix | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/uv/uv/package.nix b/pkgs/by-name/uv/uv/package.nix index a84105107687..800df5d9e4da 100644 --- a/pkgs/by-name/uv/uv/package.nix +++ b/pkgs/by-name/uv/uv/package.nix @@ -1,11 +1,15 @@ { lib, stdenv, - cmake, + rustPlatform, fetchFromGitHub, + + # nativeBuildInputs + cmake, installShellFiles, pkg-config, - rustPlatform, + + buildPackages, versionCheckHook, python3Packages, nix-update-script, @@ -41,13 +45,16 @@ rustPlatform.buildRustPackage rec { # Tests require python3 doCheck = false; - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' - export HOME=$TMPDIR - 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) - ''; + postInstall = + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd uv \ + --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 = [ versionCheckHook