Merge pull request #119816 from midchildan/fix/nnn/darwin

nnn: don't make supported tools a requirement
This commit is contained in:
Dmitry Kalinkin 2021-04-21 12:06:43 -04:00 committed by GitHub
commit 711dbe7dba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,18 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, makeWrapper, ncurses, readline { lib
, archivemount, atool, fzf, libarchive, rclone, sshfs, unzip, vlock , stdenv
, conf ? null, withIcons ? false, withNerdIcons ? false }: , fetchFromGitHub
, installShellFiles
, makeWrapper
, pkg-config
, file
, ncurses
, readline
, which
# options
, conf ? null
, withIcons ? false
, withNerdIcons ? false
}:
# Mutually exclusive options # Mutually exclusive options
assert withIcons -> withNerdIcons == false; assert withIcons -> withNerdIcons == false;
@ -20,21 +32,21 @@ stdenv.mkDerivation rec {
configFile = lib.optionalString (conf != null) (builtins.toFile "nnn.h" conf); configFile = lib.optionalString (conf != null) (builtins.toFile "nnn.h" conf);
preBuild = lib.optionalString (conf != null) "cp ${configFile} src/nnn.h"; preBuild = lib.optionalString (conf != null) "cp ${configFile} src/nnn.h";
nativeBuildInputs = [ pkg-config makeWrapper ]; nativeBuildInputs = [ installShellFiles makeWrapper pkg-config ];
buildInputs = [ readline ncurses ]; buildInputs = [ readline ncurses ];
makeFlags = [ "PREFIX=$(out)" ] makeFlags = [ "PREFIX=${placeholder "out"}" ]
++ lib.optional withIcons [ "O_ICONS=1" ] ++ lib.optional withIcons [ "O_ICONS=1" ]
++ lib.optional withNerdIcons [ "O_NERD=1" ]; ++ lib.optional withNerdIcons [ "O_NERD=1" ];
# shell completions binPath = lib.makeBinPath [ file which ];
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
wrapProgram $out/bin/nnn \ postInstall = ''
--prefix PATH : ${lib.makeBinPath [ archivemount atool fzf libarchive rclone sshfs unzip vlock ]} 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; { meta = with lib; {