From a6c5a14ae7b04d0c54ea1b5cc5b007e90ca66e98 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Sun, 27 Sep 2026 22:32:49 +0200 Subject: [PATCH] python3Packages.pip: fix shell completions on cross --- .../python-modules/pip/default.nix | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/pip/default.nix b/pkgs/development/python-modules/pip/default.nix index b12013744b3d..e687a583c162 100644 --- a/pkgs/development/python-modules/pip/default.nix +++ b/pkgs/development/python-modules/pip/default.nix @@ -2,11 +2,13 @@ lib, buildPythonPackage, fetchFromGitHub, - pythonAtLeast, # build-system flit-core, installShellFiles, + stdenv, + buildPackages, + python, # docs sphinx, @@ -104,14 +106,19 @@ let werkzeug ]; - postInstall = '' - installManPage docs/build/man/* - - installShellCompletion --cmd pip \ - --bash <($out/bin/pip completion --bash --no-cache-dir) \ - --fish <($out/bin/pip completion --fish --no-cache-dir) \ - --zsh <($out/bin/pip completion --zsh --no-cache-dir) - ''; + postInstall = + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installManPage docs/build/man/* + '' + + lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' + installShellCompletion --cmd pip \ + --bash <(${emulator} ${python.interpreter} $out/bin/pip completion --bash --no-cache-dir) \ + --fish <(${emulator} ${python.interpreter} $out/bin/pip completion --fish --no-cache-dir) \ + --zsh <(${emulator} ${python.interpreter} $out/bin/pip completion --zsh --no-cache-dir) + ''; passthru.tests = { inherit pip-tools;