From d32d994cc195858ec6569011a642d29350241edc Mon Sep 17 00:00:00 2001 From: sudosubin Date: Sun, 16 Jan 2022 22:31:42 +0900 Subject: [PATCH 1/2] pipenv: add pipenv shell completions --- pkgs/development/tools/pipenv/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/tools/pipenv/default.nix b/pkgs/development/tools/pipenv/default.nix index 1c09bb502a23..c9590c7fa5ee 100644 --- a/pkgs/development/tools/pipenv/default.nix +++ b/pkgs/development/tools/pipenv/default.nix @@ -38,6 +38,17 @@ in buildPythonApplication rec { propagatedBuildInputs = runtimeDeps python3.pkgs; + postInstall = '' + mkdir -p "$out/share/bash-completion/completions" + _PIPENV_COMPLETE=bash_source "$out/bin/pipenv" > "$out/share/bash-completion/completions/pipenv" + + mkdir -p "$out/share/zsh/vendor-completions" + _PIPENV_COMPLETE=zsh_source "$out/bin/pipenv" > "$out/share/zsh/vendor-completions/_pipenv" + + mkdir -p "$out/share/fish/vendor_completions.d" + _PIPENV_COMPLETE=fish_source "$out/bin/pipenv" > "$out/share/fish/vendor_completions.d/pipenv.fish" + ''; + doCheck = true; checkPhase = '' export HOME=$(mktemp -d) From 617f6e0a8b3f2411db670a50ca8af0743e8f0af7 Mon Sep 17 00:00:00 2001 From: sudosubin Date: Wed, 19 Jan 2022 00:16:39 +0900 Subject: [PATCH 2/2] pipenv: refact to use installShellCompletion --- pkgs/development/tools/pipenv/default.nix | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/pipenv/default.nix b/pkgs/development/tools/pipenv/default.nix index c9590c7fa5ee..9d2d9b3962c0 100644 --- a/pkgs/development/tools/pipenv/default.nix +++ b/pkgs/development/tools/pipenv/default.nix @@ -1,5 +1,6 @@ { lib , python3 +, installShellFiles }: with python3.pkgs; @@ -27,6 +28,8 @@ in buildPythonApplication rec { LC_ALL = "en_US.UTF-8"; + nativeBuildInputs = [ installShellFiles ]; + postPatch = '' # pipenv invokes python in a subprocess to create a virtualenv # and to call setup.py. @@ -39,14 +42,10 @@ in buildPythonApplication rec { propagatedBuildInputs = runtimeDeps python3.pkgs; postInstall = '' - mkdir -p "$out/share/bash-completion/completions" - _PIPENV_COMPLETE=bash_source "$out/bin/pipenv" > "$out/share/bash-completion/completions/pipenv" - - mkdir -p "$out/share/zsh/vendor-completions" - _PIPENV_COMPLETE=zsh_source "$out/bin/pipenv" > "$out/share/zsh/vendor-completions/_pipenv" - - mkdir -p "$out/share/fish/vendor_completions.d" - _PIPENV_COMPLETE=fish_source "$out/bin/pipenv" > "$out/share/fish/vendor_completions.d/pipenv.fish" + installShellCompletion --cmd pipenv \ + --bash <(_PIPENV_COMPLETE=bash_source $out/bin/pipenv) \ + --zsh <(_PIPENV_COMPLETE=zsh_source $out/bin/pipenv) \ + --fish <(_PIPENV_COMPLETE=fish_source $out/bin/pipenv) ''; doCheck = true;