Merge pull request #253767 from Anomalocaridid/nnn

nnn: add plugins, quitcd, and pcre and extra make flags build options
This commit is contained in:
Fabián Heredia Montiel 2023-09-13 23:24:14 -05:00 committed by GitHub
commit deb0f580be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,11 +10,14 @@
, readline
, which
, musl-fts
, pcre
# options
, conf ? null
, withIcons ? false
, withNerdIcons ? false
, withEmojis ? false
, withPcre ? false
, extraMakeFlags ? [ ]
}:
# Mutually exclusive options
@ -44,7 +47,9 @@ stdenv.mkDerivation (finalAttrs: {
preBuild = lib.optionalString (conf != null) "cp ${finalAttrs.configFile} src/nnn.h";
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";
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-lfts";
@ -52,7 +57,9 @@ stdenv.mkDerivation (finalAttrs: {
makeFlags = [ "PREFIX=$(out)" ]
++ lib.optionals withIcons [ "O_ICONS=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 ];
@ -63,6 +70,9 @@ stdenv.mkDerivation (finalAttrs: {
installShellCompletion --fish misc/auto-completion/fish/nnn.fish
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"
'';