IDE mode letsgoo

This commit is contained in:
Riley Apeldoorn 2022-05-19 19:58:26 +02:00
parent 55a7cb8b00
commit d0e49183a0
6 changed files with 66 additions and 33 deletions

View File

@ -8,7 +8,15 @@
riley = { riley = {
gui = true; gui = true;
kak.ide = true; kak = {
enable = true;
haskell = true;
rust = true;
nix = true;
};
}; };
system.stateVersion = "21.11"; system.stateVersion = "21.11";

View File

@ -8,11 +8,13 @@ with lib; (mkIf config.riley.gui {
enable = true; enable = true;
font = { font = {
name = "Fira Code Medium"; name = "Fira Code";
size = 11; size = 11;
}; };
settings = with config.riley.theme.hex; { settings = with config.riley.theme.hex; {
bold_font = "Fira Code Medium";
background = background.primary; background = background.primary;
foreground = foreground.primary; foreground = foreground.primary;

View File

@ -5,7 +5,7 @@ pkgs.writeTextFile (rec {
destination = "/share/kak/colors/${name}"; destination = "/share/kak/colors/${name}";
text = with theme; '' text = with theme; ''
face global comment rgb:525252 face global comment rgb:828282
face global value rgb:${blue.normal} face global value rgb:${blue.normal}
face global string rgb:${green.normal} face global string rgb:${green.normal}
@ -20,7 +20,7 @@ pkgs.writeTextFile (rec {
face global LineNumbers rgb:${background.slight} face global LineNumbers rgb:${background.slight}
face global BufferPadding rgb:${background.slight} face global BufferPadding rgb:${background.slight}
face global LineNumberCursor rgb:${foreground.primary} face global LineNumberCursor rgb:${foreground.primary}
face global crosshairs_line "default,rgb:${background.normal}" face global crosshairs_line "default,rgb:212121"
face global MenuForeground "default,rgb:${blue.normal}" face global MenuForeground "default,rgb:${blue.normal}"
face global MenuBackground "default,rgb:313131" face global MenuBackground "default,rgb:313131"

View File

@ -1,10 +1,23 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
let kakoune = import ./kakoune.nix; in with pkgs.kakouneUtils;
let cfg = config.riley.kak;
theme = config.riley.theme;
kak-crosshairs = buildKakounePlugin (rec {
name = "kak-crosshairs";
src = (pkgs.fetchFromGitHub {
owner = "insipx";
repo = name;
rev = "7edba13c535ce1bc67356b1c9461f5d261949d29";
sha256 = "sha256-VOn9GGHludJasEwcCv6t1Q3/63w9139MCEkdRDnTw6E";
});
});
in
with lib; { with lib; {
options.editor = { options.riley = {
kak.enable = (mkEnableOption "kakoune editor") // { default = true; }; kak.enable = (mkEnableOption "kakoune editor") // { default = true; };
@ -16,18 +29,20 @@ with lib; {
}; };
config = with config.editor; mkIf (kak.enable) { config = mkIf (cfg.enable) {
environment.systemPackages = [ environment.systemPackages = [
(kakoune { (import ./kakoune.nix {
inherit (kak) haskell python rust nix; typescript = cfg.ts;
typescript = kak.ts; haskell = cfg.haskell;
python = cfg.python;
rust = cfg.rust;
nix = cfg.nix;
kak-crosshairs = pkgs.kakounePlugins.kak-crosshairs; inherit kak-crosshairs;
inherit pkgs lib; inherit pkgs lib theme;
theme = config.riley.theme;
}) })
]; ];

View File

@ -52,9 +52,9 @@ let semantic-tokens =
"punctuation" = "punctuation"; "punctuation" = "punctuation";
}); });
kak-lsp-config-text = kak-lsp-config-text = concatStringsSep "\n" (
(optionalString (rust || haskell) semantic-tokens) (optional (rust || haskell) semantic-tokens)
++ (optionalString rust '' ++ (optional rust ''
[language.rust] [language.rust]
filetypes = [ "rust" ] filetypes = [ "rust" ]
roots = [ "Cargo.toml" ] roots = [ "Cargo.toml" ]
@ -65,31 +65,31 @@ let semantic-tokens =
cargo.loadOutDirsFromCheck = true cargo.loadOutDirsFromCheck = true
procMacro.enable = false procMacro.enable = false
'') '')
++ (optionalString nix '' ++ (optional nix ''
[language.nix] [language.nix]
filetypes = [ "nix" ] filetypes = [ "nix" ]
roots = [ "flake.nix", "shell.nix", ".git", ".hg" ] roots = [ "flake.nix", "shell.nix", ".git", ".hg" ]
command = "rnix-lsp" command = "rnix-lsp"
'') '')
++ (optionalString haskell '' ++ (optional haskell ''
[language.haskell] [language.haskell]
filetypes = [ "haskell" ] filetypes = [ "haskell" ]
roots = [ "Setup.hs", "stack.yaml", "*.cabal" ] roots = [ "Setup.hs", "stack.yaml", "*.cabal" ]
command = "haskell-language-server-wrapper" command = "haskell-language-server-wrapper"
args = [ "--lsp" ] args = [ "--lsp" ]
'') '')
++ (optionalString python '' ++ (optional python ''
[language.python] [language.python]
filetypes = [ "python" ] filetypes = [ "python" ]
roots = [ "setup.py", ".git", ".hg" ] roots = [ "setup.py", ".git", ".hg" ]
command = "pylsp" command = "pylsp"
'') '')
++ (optionalString typescript '' ++ (optional typescript ''
[language.typescript] [language.typescript]
filetypes = ["typescript", "javascript"] filetypes = ["typescript", "javascript"]
roots = ["package.json"] roots = ["package.json"]
command = "rslint-lsp" command = "rslint-lsp"
''); ''));
kak-lsp-config = (pkgs.writeTextFile (rec { kak-lsp-config = (pkgs.writeTextFile (rec {
name = "kak-lsp.toml"; name = "kak-lsp.toml";

View File

@ -94,7 +94,7 @@ let nix-config = (lib.optionalString nix ''
${ide-core} ${ide-core}
face window keyword rgb:${green.bright} face window keyword rgb:${theme.green.bright}
face window meta keyword face window meta keyword
} }
@ -109,12 +109,12 @@ let nix-config = (lib.optionalString nix ''
set-option buffer tabstop 2 set-option buffer tabstop 2
face global variable rgb:${purple.normal} face global variable rgb:${theme.purple.normal}
face global attribute keyword face global attribute keyword
face global operator keyword face global operator keyword
face global keyword rgb:${blue.bright} face global keyword rgb:${theme.blue.bright}
face global value string face global value string
face global meta rgb:${pink.normal} face global meta rgb:${theme.pink.normal}
} }
''); '');
@ -147,9 +147,11 @@ let nix-config = (lib.optionalString nix ''
in pkgs.writeTextFile (rec { in pkgs.writeTextFile (rec {
name = "kakrc.kak"; name = "kakrc.kak";
destination = "/share/kak/autoload/${name}"; destination = "/share/kak/autoload/${name}";
text = with theme; '' text = ''
add-highlighter global/ number-lines -separator ' ' -hlcursor colorscheme colors;
add-highlighter global/ number-lines -separator ' ' -hlcursor
set global tabstop 4 set global tabstop 4
@ -159,10 +161,16 @@ in pkgs.writeTextFile (rec {
face global InlayDiagnosticHint rgb:4d965a+f face global InlayDiagnosticHint rgb:4d965a+f
face global InlayDiagnosticInfo rgb:4d965a+f face global InlayDiagnosticInfo rgb:4d965a+f
'' ++ keybinds ${keybinds}
++ typescript-config
++ haskell-config ${typescript-config}
++ python-config ${haskell-config}
++ rust-config ${python-config}
++ nix-config; ${rust-config}
${nix-config}
hook global KakBegin .* %{
cursorline
}
'';
}) })