parent
f71101e0c7
commit
f36aca9e82
@ -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 New Issue
Block a user