summary refs log tree commit diff
path: root/pkgs/applications/editors/kakoune
diff options
context:
space:
mode:
authorFlakebi <flakebi@t-online.de>2021-01-04 00:35:24 +0100
committerFlakebi <flakebi@t-online.de>2021-02-25 10:05:23 +0100
commit9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2 (patch)
treef496d4423ccefa18432c32b848b50c2ced0134fb /pkgs/applications/editors/kakoune
parent3ad7ba46c502d96821362579fc76c6a07364bb67 (diff)
downloadnixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.tar
nixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.tar.gz
nixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.tar.bz2
nixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.tar.lz
nixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.tar.xz
nixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.tar.zst
nixpkgs-9ca73dd13f3771c0e32713b519f4a0ea6d2bb6d2.zip
kakounePlugins: add buildKakounePlugin helper
Same as buildVimPlugin but for Kakoune
Diffstat (limited to 'pkgs/applications/editors/kakoune')
-rw-r--r--pkgs/applications/editors/kakoune/plugins/build-kakoune-plugin.nix33
-rw-r--r--pkgs/applications/editors/kakoune/plugins/kakoune-utils.nix4
2 files changed, 37 insertions, 0 deletions
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;
+}