From b2b779f680479d634691c4c8ce2baaaf48444515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 11 Aug 2020 20:58:38 +0200 Subject: [PATCH 1/2] broot: disable nag about installing shell functions --- pkgs/tools/misc/broot/default.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/broot/default.nix b/pkgs/tools/misc/broot/default.nix index bafe507a37c2..ffbc0ff12dfc 100644 --- a/pkgs/tools/misc/broot/default.nix +++ b/pkgs/tools/misc/broot/default.nix @@ -1,4 +1,12 @@ -{ stdenv, rustPlatform, fetchFromGitHub, coreutils, libiconv, Security, installShellFiles }: +{ stdenv +, rustPlatform +, fetchFromGitHub +, installShellFiles +, makeWrapper +, coreutils +, libiconv +, Security +}: rustPlatform.buildRustPackage rec { pname = "broot"; @@ -13,7 +21,7 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "18b4lh5x25mbhpffva8ygzm5ad00svm1c3r83vfw0l2f61m7vyjh"; - nativeBuildInputs = [ installShellFiles ]; + nativeBuildInputs = [ makeWrapper installShellFiles ]; buildInputs = stdenv.lib.optionals stdenv.isDarwin [ libiconv Security ]; @@ -27,6 +35,11 @@ rustPlatform.buildRustPackage rec { ''; postInstall = '' + # Do not nag users about installing shell integration, since + # it is impure. + wrapProgram $out/bin/broot \ + --set BR_INSTALL no + # install shell completion files OUT_DIR=$releaseDir/build/broot-*/out From 8770c229e4f613cf7d1ace96a43ab7c4b7889a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 11 Aug 2020 20:59:41 +0200 Subject: [PATCH 2/2] broot: install bash/zsh/fish files for the br function - In bash, the user needs to source `br.sh` somewhere. - In zsh, the user needs to `autoload -Uz br` somewhere. - In fish, `br` should just work. --- pkgs/tools/misc/broot/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/tools/misc/broot/default.nix b/pkgs/tools/misc/broot/default.nix index ffbc0ff12dfc..ac315b2e816a 100644 --- a/pkgs/tools/misc/broot/default.nix +++ b/pkgs/tools/misc/broot/default.nix @@ -40,6 +40,18 @@ rustPlatform.buildRustPackage rec { wrapProgram $out/bin/broot \ --set BR_INSTALL no + # Install shell function for bash. + $out/bin/broot --print-shell-function bash > br.bash + install -Dm0444 -t $out/etc/profile.d br.bash + + # Install shell function for zsh. + $out/bin/broot --print-shell-function zsh > br.zsh + install -Dm0444 br.zsh $out/share/zsh/site-functions/br + + # Install shell function for fish + $out/bin/broot --print-shell-function fish > br.fish + install -Dm0444 -t $out/share/fish/vendor_functions.d br.fish + # install shell completion files OUT_DIR=$releaseDir/build/broot-*/out