nnn: don't make supported tools a requirement

Fixes #119728.
This commit is contained in:
midchildan 2021-04-19 01:24:14 +09:00
parent f71101e0c7
commit f36aca9e82
No known key found for this signature in database
GPG Key ID: D9A5748BACC6E3C2

@ -1,6 +1,18 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, makeWrapper, ncurses, readline
, archivemount, atool, fzf, libarchive, rclone, sshfs, unzip, vlock
, conf ? null, withIcons ? false, withNerdIcons ? false }:
{ lib
, stdenv
, fetchFromGitHub
, installShellFiles
, makeWrapper
, pkg-config
, file
, ncurses
, readline
, which
# options
, conf ? null
, withIcons ? false
, withNerdIcons ? false
}:
# Mutually exclusive options
assert withIcons -> withNerdIcons == false;
@ -20,21 +32,21 @@ stdenv.mkDerivation rec {
configFile = lib.optionalString (conf != null) (builtins.toFile "nnn.h" conf);
preBuild = lib.optionalString (conf != null) "cp ${configFile} src/nnn.h";
nativeBuildInputs = [ pkg-config makeWrapper ];
nativeBuildInputs = [ installShellFiles makeWrapper pkg-config ];
buildInputs = [ readline ncurses ];
makeFlags = [ "PREFIX=$(out)" ]
makeFlags = [ "PREFIX=${placeholder "out"}" ]
++ lib.optional withIcons [ "O_ICONS=1" ]
++ lib.optional withNerdIcons [ "O_NERD=1" ];
# shell completions
postInstall = ''
install -Dm555 misc/auto-completion/bash/nnn-completion.bash $out/share/bash-completion/completions/nnn.bash
install -Dm555 misc/auto-completion/zsh/_nnn -t $out/share/zsh/site-functions
install -Dm555 misc/auto-completion/fish/nnn.fish -t $out/share/fish/vendor_completions.d
binPath = lib.makeBinPath [ file which ];
wrapProgram $out/bin/nnn \
--prefix PATH : ${lib.makeBinPath [ archivemount atool fzf libarchive rclone sshfs unzip vlock ]}
postInstall = ''
installShellCompletion --bash --name nnn.bash misc/auto-completion/bash/nnn-completion.bash
installShellCompletion --fish misc/auto-completion/fish/nnn.fish
installShellCompletion --zsh misc/auto-completion/zsh/_nnn
wrapProgram $out/bin/nnn --prefix PATH : "$binPath"
'';
meta = with lib; {