blob: b4cc823880e727656e78552bcf5e2f75b941e567 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
{ stdenv, bash }:
with stdenv.lib;
kakoune:
let
getPlugins = { plugins ? [] }: plugins;
wrapper = { configure ? {} }:
stdenv.mkDerivation rec {
pname = "kakoune";
version = getVersion kakoune;
src = ./.;
buildCommand = ''
mkdir -p $out/share/kak
for plugin in ${strings.escapeShellArgs (getPlugins configure)}; do
if [[ -d $plugin/share/kak/autoload ]]; then
find "$plugin/share/kak/autoload" -type f -name '*.kak'| while read rcfile; do
printf 'source "%s"\n' "$rcfile"
done
fi
done >>$out/share/kak/plugins.kak
mkdir -p $out/bin
substitute ${src}/wrapper.sh $out/bin/kak \
--subst-var-by bash "${bash}" \
--subst-var-by kakoune "${kakoune}" \
--subst-var-by out "$out"
chmod +x $out/bin/kak
'';
preferLocalBuild = true;
buildInputs = [ bash kakoune ];
passthru = { unwrapped = kakoune; };
meta = kakoune.meta // {
# prefer wrapper over the package
priority = (kakoune.meta.priority or 0) - 1;
hydraPlatforms = [];
};
};
in
makeOverridable wrapper
|