2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, ncurses, readline
|
|
|
|
, conf ? null, withIcons ? false, withNerdIcons ? false }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# Mutually exclusive options
|
|
|
|
assert withIcons -> withNerdIcons == false;
|
|
|
|
assert withNerdIcons -> withIcons == false;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nnn";
|
2020-11-19 00:13:47 +00:00
|
|
|
version = "3.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jarun";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2020-11-19 00:13:47 +00:00
|
|
|
sha256 = "1fa7cmwrzn6kx87kms8i98p9azdlwyh2gnif29l340syl9hkr5qy";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
configFile = lib.optionalString (conf != null) (builtins.toFile "nnn.h" conf);
|
|
|
|
preBuild = lib.optionalString (conf != null) "cp ${configFile} src/nnn.h";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ readline ncurses ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
makeFlags = [
|
|
|
|
"DESTDIR=${placeholder "out"}"
|
|
|
|
"PREFIX="
|
|
|
|
] ++ lib.optional withIcons [ "O_ICONS=1" ]
|
|
|
|
++ lib.optional withNerdIcons [ "O_NERD=1" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Small ncurses-based file browser forked from noice";
|
|
|
|
homepage = "https://github.com/jarun/nnn";
|
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.all;
|
2020-11-19 00:13:47 +00:00
|
|
|
maintainers = with maintainers; [ jfrankenau Br1ght0ne ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|