Make nki-kakoune slightly more extensible, expose it as an overlay
This commit is contained in:
parent
9156c6049c
commit
b3ebb46101
6 changed files with 539 additions and 505 deletions
|
@ -189,7 +189,12 @@
|
|||
|
||||
in
|
||||
{
|
||||
overlays.default = lib.composeManyExtensions overlays;
|
||||
overlays = {
|
||||
default = lib.composeManyExtensions overlays;
|
||||
kakoune = final: prev: {
|
||||
nki-kakoune = final.callPackage ./packages/common/nki-kakoune { };
|
||||
};
|
||||
};
|
||||
|
||||
packages.x86_64-linux.deploy-rs = deploy-rs.packages.x86_64-linux.default;
|
||||
apps.x86_64-linux.deploy-rs = deploy-rs.apps.x86_64-linux.default;
|
||||
|
|
|
@ -2,21 +2,24 @@
|
|||
callPackage,
|
||||
kakoune,
|
||||
kakoune-unwrapped,
|
||||
nki-kak-util ? callPackage ./util.nix { },
|
||||
nki-kak-lsp ? callPackage ./lsp.nix { },
|
||||
nki-kak-rc ? callPackage ./rc.nix { },
|
||||
nki-kak-plugins ? callPackage ./plugins.nix { util = nki-kak-util; },
|
||||
nki-kak-kaktex ? callPackage ./kaktex { },
|
||||
nki-kak-themes ? callPackage ./themes.nix { },
|
||||
nki-kak-faces ? callPackage ./faces.nix { util = nki-kak-util; },
|
||||
...
|
||||
}:
|
||||
let
|
||||
lsp = callPackage ./lsp.nix { };
|
||||
rc = (callPackage ./rc.nix { });
|
||||
in
|
||||
(kakoune.override {
|
||||
plugins =
|
||||
callPackage ./plugins.nix { }
|
||||
++ callPackage ./themes.nix { }
|
||||
nki-kak-plugins
|
||||
++ nki-kak-themes
|
||||
++ [
|
||||
(callPackage ./kaktex { })
|
||||
(callPackage ./faces.nix { })
|
||||
rc
|
||||
lsp.plugin
|
||||
nki-kak-kaktex
|
||||
nki-kak-faces
|
||||
nki-kak-rc
|
||||
nki-kak-lsp.plugin
|
||||
];
|
||||
}).overrideAttrs
|
||||
(attrs: {
|
||||
|
@ -27,6 +30,15 @@ in
|
|||
rm "$out/bin/kak"
|
||||
makeWrapper "${kakoune-unwrapped}/bin/kak" "$out/bin/kak" \
|
||||
--set KAKOUNE_RUNTIME "$out/share/kak" \
|
||||
--suffix PATH ":" "${lsp.extraPaths}"
|
||||
--suffix PATH ":" "${nki-kak-lsp.extraPaths}"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
lsp = nki-kak-lsp;
|
||||
rc = nki-kak-rc;
|
||||
plugins = nki-kak-plugins;
|
||||
kaktex = nki-kak-kaktex;
|
||||
themes = nki-kak-themes;
|
||||
faces = nki-kak-faces;
|
||||
};
|
||||
})
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ callPackage, ... }:
|
||||
{
|
||||
callPackage,
|
||||
utils ? callPackage ./utils.nix { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
utils = callPackage ./utils.nix { };
|
||||
faces = {
|
||||
Default = "%opt{text},%opt{base}";
|
||||
BufferPadding = "%opt{base},%opt{base}";
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
marksman,
|
||||
templ,
|
||||
rust-analyzer,
|
||||
overrideConfig ? (baseConfig: baseConfig),
|
||||
extraSetup ? "",
|
||||
...
|
||||
}:
|
||||
let
|
||||
# Configuration for kak-lsp
|
||||
config = {
|
||||
config =
|
||||
let
|
||||
baseConfig = {
|
||||
languageIDs = {
|
||||
c = "c_cpp";
|
||||
cpp = "c_cpp";
|
||||
|
@ -462,6 +466,8 @@ let
|
|||
verbosity = 255;
|
||||
};
|
||||
};
|
||||
in
|
||||
overrideConfig baseConfig;
|
||||
|
||||
per-lang-config =
|
||||
lang:
|
||||
|
@ -602,6 +608,9 @@ in
|
|||
|
||||
## Faces
|
||||
${faces-config}
|
||||
|
||||
## Extra setup
|
||||
${extraSetup}
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,59 +1,14 @@
|
|||
{
|
||||
pkgs,
|
||||
symlinkJoin,
|
||||
writeTextDir,
|
||||
kakouneUtils,
|
||||
callPackage,
|
||||
utils ? callPackage ./utils.nix { },
|
||||
fetchFromGitHub,
|
||||
fetchFromGitLab,
|
||||
luajit,
|
||||
...
|
||||
}:
|
||||
with {
|
||||
inherit (kakouneUtils) buildKakounePluginFrom2Nix;
|
||||
inherit (utils) toDir writeModuleWrapper kakounePlugin;
|
||||
};
|
||||
let
|
||||
toDir = name: file: writeTextDir name (builtins.readFile file);
|
||||
|
||||
writeActivationScript =
|
||||
script:
|
||||
writeTextDir "on-load.kak" ''
|
||||
hook global KakBegin .* %{
|
||||
${script}
|
||||
}
|
||||
'';
|
||||
|
||||
writeModuleWrapper =
|
||||
name: script:
|
||||
writeTextDir "module.kak" ''
|
||||
provide-module ${name} %◍
|
||||
${script}
|
||||
◍
|
||||
'';
|
||||
|
||||
kakounePlugin =
|
||||
{
|
||||
name,
|
||||
src,
|
||||
wrapAsModule ? false,
|
||||
activationScript ? null,
|
||||
...
|
||||
}@attrs:
|
||||
let
|
||||
module = if wrapAsModule then writeModuleWrapper name (builtins.readFile src) else src;
|
||||
in
|
||||
buildKakounePluginFrom2Nix {
|
||||
pname = name;
|
||||
version = attrs.version or "latest";
|
||||
src =
|
||||
if activationScript == null then
|
||||
module
|
||||
else
|
||||
symlinkJoin {
|
||||
name = "${name}-src";
|
||||
paths = [
|
||||
module
|
||||
(writeActivationScript activationScript)
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
builtins.map kakounePlugin [
|
||||
# My own scripts
|
||||
{
|
||||
|
@ -68,7 +23,7 @@ builtins.map kakounePlugin [
|
|||
# Plugins
|
||||
{
|
||||
name = "luar";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "gustavo-hms";
|
||||
repo = "luar";
|
||||
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
|
||||
|
@ -78,12 +33,12 @@ builtins.map kakounePlugin [
|
|||
# Enable luar
|
||||
require-module luar
|
||||
# Use luajit
|
||||
set-option global luar_interpreter ${pkgs.luajit}/bin/luajit
|
||||
set-option global luar_interpreter ${luajit}/bin/luajit
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "peneira";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "gustavo-hms";
|
||||
repo = "peneira";
|
||||
rev = "b56dd10bb4771da327b05a9071b3ee9a092f9788";
|
||||
|
@ -128,7 +83,7 @@ builtins.map kakounePlugin [
|
|||
}
|
||||
{
|
||||
name = "kakoune-focus";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "caksoylar";
|
||||
repo = "kakoune-focus";
|
||||
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
|
||||
|
@ -140,7 +95,7 @@ builtins.map kakounePlugin [
|
|||
}
|
||||
{
|
||||
name = "kakoune-inc-dec";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
src = fetchFromGitLab {
|
||||
owner = "Screwtapello";
|
||||
repo = "kakoune-inc-dec";
|
||||
rev = "7bfe9c51";
|
||||
|
@ -158,14 +113,10 @@ builtins.map kakounePlugin [
|
|||
})
|
||||
+ "/rc";
|
||||
}
|
||||
# {
|
||||
# name = "kakoune-discord";
|
||||
# src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
|
||||
# }
|
||||
rec {
|
||||
name = "kakoune-mirror";
|
||||
src =
|
||||
pkgs.fetchFromGitHub {
|
||||
fetchFromGitHub {
|
||||
owner = "Delapouite";
|
||||
repo = "kakoune-mirror";
|
||||
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
|
||||
|
@ -182,7 +133,7 @@ builtins.map kakounePlugin [
|
|||
}
|
||||
{
|
||||
name = "unicode-math";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "kakoune-unicode-math";
|
||||
rev = "08dff25da2b86ee0b0777091992bc7fb28c3cb1d";
|
||||
|
@ -199,7 +150,7 @@ builtins.map kakounePlugin [
|
|||
}
|
||||
{
|
||||
name = "kakoune-buffers";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "Delapouite";
|
||||
repo = "kakoune-buffers";
|
||||
rev = "6b2081f5b7d58c72de319a5cba7bf628b6802881";
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
{ lib, writeTextDir, ... }:
|
||||
{
|
||||
lib,
|
||||
writeTextDir,
|
||||
kakouneUtils,
|
||||
symlinkJoin,
|
||||
...
|
||||
}:
|
||||
with {
|
||||
inherit (kakouneUtils) buildKakounePluginFrom2Nix;
|
||||
};
|
||||
rec {
|
||||
mkFacesScript =
|
||||
name: faces:
|
||||
writeTextDir "share/kak/autoload/${name}/faces.kak" ''
|
||||
|
@ -9,4 +18,49 @@
|
|||
)}
|
||||
}
|
||||
'';
|
||||
|
||||
toDir = name: file: writeTextDir name (builtins.readFile file);
|
||||
|
||||
writeActivationScript =
|
||||
script:
|
||||
writeTextDir "on-load.kak" ''
|
||||
hook global KakBegin .* %{
|
||||
${script}
|
||||
}
|
||||
'';
|
||||
|
||||
writeModuleWrapper =
|
||||
name: script:
|
||||
writeTextDir "module.kak" ''
|
||||
provide-module ${name} %◍
|
||||
${script}
|
||||
◍
|
||||
'';
|
||||
|
||||
kakounePlugin =
|
||||
{
|
||||
name,
|
||||
src,
|
||||
wrapAsModule ? false,
|
||||
activationScript ? null,
|
||||
...
|
||||
}@attrs:
|
||||
let
|
||||
module = if wrapAsModule then writeModuleWrapper name (builtins.readFile src) else src;
|
||||
in
|
||||
buildKakounePluginFrom2Nix {
|
||||
pname = name;
|
||||
version = attrs.version or "latest";
|
||||
src =
|
||||
if activationScript == null then
|
||||
module
|
||||
else
|
||||
symlinkJoin {
|
||||
name = "${name}-src";
|
||||
paths = [
|
||||
module
|
||||
(writeActivationScript activationScript)
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue