nnn: add plugins, quitcd, and pcre and extra make flags build options

This commit is contained in:
Anomalocaridid 2023-09-06 22:15:32 -04:00
parent 3cba01e8ab
commit 5049680bc8

View file

@ -10,11 +10,14 @@
, readline , readline
, which , which
, musl-fts , musl-fts
, pcre
# options # options
, conf ? null , conf ? null
, withIcons ? false , withIcons ? false
, withNerdIcons ? false , withNerdIcons ? false
, withEmojis ? false , withEmojis ? false
, withPcre ? false
, extraMakeFlags ? [ ]
}: }:
# Mutually exclusive options # Mutually exclusive options
@ -44,7 +47,9 @@ stdenv.mkDerivation (finalAttrs: {
preBuild = lib.optionalString (conf != null) "cp ${finalAttrs.configFile} src/nnn.h"; preBuild = lib.optionalString (conf != null) "cp ${finalAttrs.configFile} src/nnn.h";
nativeBuildInputs = [ installShellFiles makeWrapper pkg-config ]; nativeBuildInputs = [ installShellFiles makeWrapper pkg-config ];
buildInputs = [ readline ncurses ] ++ lib.optional stdenv.hostPlatform.isMusl musl-fts; buildInputs = [ readline ncurses ]
++ lib.optional stdenv.hostPlatform.isMusl musl-fts
++ lib.optional withPcre pcre;
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isMusl "-I${musl-fts}/include"; env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isMusl "-I${musl-fts}/include";
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-lfts"; NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-lfts";
@ -52,7 +57,9 @@ stdenv.mkDerivation (finalAttrs: {
makeFlags = [ "PREFIX=$(out)" ] makeFlags = [ "PREFIX=$(out)" ]
++ lib.optionals withIcons [ "O_ICONS=1" ] ++ lib.optionals withIcons [ "O_ICONS=1" ]
++ lib.optionals withNerdIcons [ "O_NERD=1" ] ++ lib.optionals withNerdIcons [ "O_NERD=1" ]
++ lib.optionals withEmojis [ "O_EMOJI=1" ]; ++ lib.optionals withEmojis [ "O_EMOJI=1" ]
++ lib.optionals withPcre [ "O_PCRE=1" ]
++ extraMakeFlags;
binPath = lib.makeBinPath [ file which ]; binPath = lib.makeBinPath [ file which ];
@ -63,6 +70,9 @@ stdenv.mkDerivation (finalAttrs: {
installShellCompletion --fish misc/auto-completion/fish/nnn.fish installShellCompletion --fish misc/auto-completion/fish/nnn.fish
installShellCompletion --zsh misc/auto-completion/zsh/_nnn installShellCompletion --zsh misc/auto-completion/zsh/_nnn
cp -r plugins $out/share
cp -r misc/quitcd $out/share/quitcd
wrapProgram $out/bin/nnn --prefix PATH : "$binPath" wrapProgram $out/bin/nnn --prefix PATH : "$binPath"
''; '';