2024-08-29 18:04:57 +02:00
|
|
|
{ lib, symlinkJoin, makeWrapper, kakoune, plugins ? [], configure ? {} }:
|
2019-06-07 17:18:32 +02:00
|
|
|
|
|
|
|
let
|
2020-06-29 22:25:16 +02:00
|
|
|
# "plugins" is the preferred way, but some configurations may be
|
|
|
|
# using "configure.plugins", so accept both
|
|
|
|
requestedPlugins = plugins ++ (configure.plugins or []);
|
2019-06-07 17:18:32 +02:00
|
|
|
|
2020-06-29 22:25:16 +02:00
|
|
|
in
|
|
|
|
symlinkJoin {
|
|
|
|
name = "kakoune-${kakoune.version}";
|
2019-06-07 17:18:32 +02:00
|
|
|
|
2021-02-07 10:17:39 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2019-06-07 17:18:32 +02:00
|
|
|
|
2020-06-29 22:25:16 +02:00
|
|
|
paths = [ kakoune ] ++ requestedPlugins;
|
2019-06-07 17:18:32 +02:00
|
|
|
|
2020-06-29 22:25:16 +02:00
|
|
|
postBuild = ''
|
2024-07-19 19:23:36 +02:00
|
|
|
# create a directory for bins that kakoune needs
|
|
|
|
# access to, without polluting the users path by adding
|
|
|
|
# that binary nested with this symlinkJoin.
|
|
|
|
mkdir -p $out/share/kak/bin
|
|
|
|
|
2020-06-29 22:25:16 +02:00
|
|
|
# location of kak binary is used to find ../share/kak/autoload,
|
|
|
|
# unless explicitly overriden with KAKOUNE_RUNTIME
|
|
|
|
rm "$out/bin/kak"
|
2024-07-19 19:23:36 +02:00
|
|
|
makeWrapper "${kakoune}/bin/kak" "$out/bin/kak" \
|
|
|
|
--set KAKOUNE_RUNTIME "$out/share/kak" \
|
2024-08-10 11:29:43 +02:00
|
|
|
--suffix PATH : "$out/share/kak/bin"
|
2020-10-18 17:19:09 +02:00
|
|
|
|
|
|
|
# currently kakoune ignores doc files if they are symlinks, so workaround by
|
|
|
|
# copying doc files over, so they become regular files...
|
|
|
|
mkdir "$out/DELETE_ME"
|
|
|
|
mv "$out/share/kak/doc" "$out/DELETE_ME"
|
|
|
|
cp -r --dereference "$out/DELETE_ME/doc" "$out/share/kak"
|
|
|
|
rm -Rf "$out/DELETE_ME"
|
2020-06-29 22:25:16 +02:00
|
|
|
'';
|
2019-06-07 17:18:32 +02:00
|
|
|
|
2024-08-29 18:04:57 +02:00
|
|
|
meta = kakoune.meta // { priority = (kakoune.meta.priority or lib.meta.defaultPriority) - 1; };
|
2020-06-29 22:25:16 +02:00
|
|
|
}
|