mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Merge pull request #119816 from midchildan/fix/nnn/darwin
nnn: don't make supported tools a requirement
This commit is contained in:
commit
711dbe7dba
1 changed files with 24 additions and 12 deletions
|
@ -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; {
|
||||
|
|
Loading…
Reference in a new issue