about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/kakoune/plugins/overrides.nix
blob: 2ca24cf661a059822032666826922c5c45f11282 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{ lib, stdenv, fetchFromGitHub, fetchFromGitLab, fetchgit
, buildKakounePluginFrom2Nix
, kak-lsp, parinfer-rust, rep
, fzf, git, guile, kakoune-unwrapped, lua5_3, plan9port
}:

self: super: {
  inherit kak-lsp parinfer-rust rep;

  case-kak = buildKakounePluginFrom2Nix {
    pname = "case-kak";
    version = "2020-04-06";
    src = fetchFromGitLab {
      owner = "FlyingWombat";
      repo = "case.kak";
      rev = "6f1511820aa3abfa118e0f856118adc8113e2185";
      sha256 = "002njrlwgakqgp74wivbppr9qyn57dn4n5bxkr6k6nglk9qndwdp";
    };
    meta.homepage = "https://gitlab.com/FlyingWombat/case.kak";
  };

  fzf-kak = super.fzf-kak.overrideAttrs(oldAttrs: rec {
    preFixup = ''
      if [[ -x "${fzf}/bin/fzf" ]]; then
        fzfImpl='${fzf}/bin/fzf'
      else
        fzfImpl='${fzf}/bin/sk'
      fi

      substituteInPlace $out/share/kak/autoload/plugins/fzf-kak/rc/fzf.kak \
        --replace \'fzf\' \'"$fzfImpl"\'
    '';
  });

  kak-ansi = stdenv.mkDerivation rec {
    pname = "kak-ansi";
    version = "0.2.3";

    src = fetchFromGitHub {
      owner = "eraserhd";
      repo = "kak-ansi";
      rev = "v${version}";
      sha256 = "pO7M3MjKMJQew9O20KALEvsXLuCKPYGGTtuN/q/kj8Q=";
    };

    installPhase = ''
      mkdir -p $out/bin $out/share/kak/autoload/plugins/
      cp kak-ansi-filter $out/bin/
      # Hard-code path of filter and don't try to build when Kakoune boots
      sed '
        /^declare-option.* ansi_filter /i\
declare-option -hidden str ansi_filter %{'"$out"'/bin/kak-ansi-filter}
        /^declare-option.* ansi_filter /,/^}/d
      ' rc/ansi.kak >$out/share/kak/autoload/plugins/ansi.kak
    '';

    meta = with lib; {
      description = "Kakoune support for rendering ANSI code";
      homepage = "https://github.com/eraserhd/kak-ansi";
      license = licenses.unlicense;
      maintainers = with maintainers; [ eraserhd ];
      platforms = platforms.all;
    };
  };

  kak-plumb = stdenv.mkDerivation rec {
    pname = "kak-plumb";
    version = "0.1.1";

    src = fetchFromGitHub {
      owner = "eraserhd";
      repo = "kak-plumb";
      rev = "v${version}";
      sha256 = "1rz6pr786slnf1a78m3sj09axr4d2lb5rg7sfa4mfg1zcjh06ps6";
    };

    installPhase = ''
      mkdir -p $out/bin $out/share/kak/autoload/plugins/
      substitute rc/plumb.kak $out/share/kak/autoload/plugins/plumb.kak \
        --replace '9 plumb' '${plan9port}/bin/9 plumb'
      substitute edit-client $out/bin/edit-client \
        --replace '9 9p' '${plan9port}/bin/9 9p' \
        --replace 'kak -p' '${kakoune-unwrapped}/bin/kak -p'
      chmod +x $out/bin/edit-client
    '';

    meta = with lib; {
      description = "Kakoune integration with the Plan 9 plumber";
      homepage = "https://github.com/eraserhd/kak-plumb";
      license = licenses.unlicense;
      maintainers = with maintainers; [ eraserhd ];
      platforms = platforms.all;
    };
  };

  kakoune-rainbow = super.kakoune-rainbow.overrideAttrs(oldAttrs: rec {
    preFixup = ''
      mkdir -p $out/bin
      mv $out/share/kak/autoload/plugins/kakoune-rainbow/bin/kak-rainbow.scm $out/bin
      substituteInPlace $out/bin/kak-rainbow.scm \
        --replace '/usr/bin/env -S guile' '${guile}/bin/guile'
      substituteInPlace $out/share/kak/autoload/plugins/kakoune-rainbow/rainbow.kak \
        --replace '%sh{dirname "$kak_source"}' "'$out'"
    '';
  });

  kakoune-state-save = buildKakounePluginFrom2Nix {
    pname = "kakoune-state-save";
    version = "2020-02-09";

    src = fetchFromGitLab {
      owner = "Screwtapello";
      repo = "kakoune-state-save";
      rev = "ab7c0c765326a4a80af78857469ee8c80814c52a";
      sha256 = "AAOCG0TY3G188NnkkwMCSbkkNe487F4gwiFWwG9Yo+A=";
    };

    meta = with lib; {
      description = "Help Kakoune save and restore state between sessions";
      homepage = "https://gitlab.com/Screwtapello/kakoune-state-save";
      license = licenses.mit;
      maintainers = with maintainers; [ Flakebi ];
      platforms = platforms.all;
    };
  };

  powerline-kak = super.powerline-kak.overrideAttrs(oldAttrs: rec {
    preFixup = ''
      substituteInPlace $out/share/kak/autoload/plugins/powerline-kak/rc/modules/git.kak \
        --replace ' git ' ' ${git}/bin/git '
    '';
  });

  quickscope-kak = buildKakounePluginFrom2Nix rec {
    pname = "quickscope-kak";
    version = "1.0.0";

    src = fetchgit {
      url = "https://git.sr.ht/~voroskoi/quickscope.kak";
      rev = "v${version}";
      sha256 = "0y1g3zpa2ql8l9rl5i2w84bka8a09kig9nq9zdchaff5pw660mcx";
    };

    buildInputs = [ lua5_3 ];

    installPhase = ''
      mkdir -p $out/share/kak/autoload/plugins/
      cp quickscope.* $out/share/kak/autoload/plugins/
      # substituteInPlace does not like the pipe
      sed -e 's,[|] *lua,|${lua5_3}/bin/lua,' quickscope.kak >$out/share/kak/autoload/plugins/quickscope.kak
    '';

    meta = with lib; {
      description = "Highlight f and t jump positions";
      homepage = "https://sr.ht/~voroskoi/quickscope.kak/";
      license = licenses.unlicense;
      maintainers = with maintainers; [ eraserhd ];
      platforms = platforms.all;
    };
  };
}