diff --git a/pkgs/applications/editors/kakoune/plugins/build-kakoune-plugin.nix b/pkgs/applications/editors/kakoune/plugins/build-kakoune-plugin.nix new file mode 100644 index 00000000000..f35a175312c --- /dev/null +++ b/pkgs/applications/editors/kakoune/plugins/build-kakoune-plugin.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, rtpPath ? "share/kak/autoload/plugins" }: +rec { + buildKakounePlugin = attrs@{ + name ? "${attrs.pname}-${attrs.version}", + namePrefix ? "kakplugin-", + src, + unpackPhase ? "", + configurePhase ? "", + buildPhase ? "", + preInstall ? "", + postInstall ? "", + path ? lib.getName name, + ... + }: + stdenv.mkDerivation ((builtins.removeAttrs attrs [ "namePrefix" "path" ]) // { + name = namePrefix + name; + + installPhase = '' + runHook preInstall + + target=$out/${rtpPath}/${path} + mkdir -p $out/${rtpPath} + cp -r . $target + + runHook postInstall + ''; + }); + + buildKakounePluginFrom2Nix = attrs: buildKakounePlugin ({ + buildPhase = ":"; + configurePhase = ":"; + } // attrs); +} diff --git a/pkgs/applications/editors/kakoune/plugins/kakoune-utils.nix b/pkgs/applications/editors/kakoune/plugins/kakoune-utils.nix new file mode 100644 index 00000000000..11a1cc130d6 --- /dev/null +++ b/pkgs/applications/editors/kakoune/plugins/kakoune-utils.nix @@ -0,0 +1,4 @@ +{ lib, stdenv }: +{ + inherit (import ./build-kakoune-plugin.nix { inherit lib stdenv; }) buildKakounePlugin buildKakounePluginFrom2Nix; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6d9905206d1..e1e650f456a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5533,6 +5533,7 @@ in kakoune = wrapKakoune kakoune-unwrapped { plugins = [ ]; # override with the list of desired plugins }; + kakouneUtils = callPackage ../applications/editors/kakoune/plugins/kakoune-utils.nix { }; kak-lsp = callPackage ../tools/misc/kak-lsp { inherit (darwin.apple_sdk.frameworks) Security;