summary refs log tree commit diff
path: root/pkgs/applications/editors/kakoune/plugins/build-kakoune-plugin.nix
blob: f35a175312c000433297e477fc24cb5627ed08a3 (plain) (blame)
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
{ 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);
}