From d0e49183a00437587cef87a491683d03e708d0bf Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Thu, 19 May 2022 19:58:26 +0200 Subject: [PATCH] IDE mode letsgoo --- machines/thor/configuration.nix | 10 +++++++++- modules/gui/terminal.nix | 4 +++- modules/kak/colors.nix | 4 ++-- modules/kak/default.nix | 33 ++++++++++++++++++++++++--------- modules/kak/kak-lsp.nix | 16 ++++++++-------- modules/kak/kakrc.nix | 32 ++++++++++++++++++++------------ 6 files changed, 66 insertions(+), 33 deletions(-) diff --git a/machines/thor/configuration.nix b/machines/thor/configuration.nix index b4dcc9b..809b4aa 100644 --- a/machines/thor/configuration.nix +++ b/machines/thor/configuration.nix @@ -8,7 +8,15 @@ riley = { gui = true; - kak.ide = true; + kak = { + + enable = true; + + haskell = true; + rust = true; + nix = true; + + }; }; system.stateVersion = "21.11"; diff --git a/modules/gui/terminal.nix b/modules/gui/terminal.nix index 0701be8..327342d 100644 --- a/modules/gui/terminal.nix +++ b/modules/gui/terminal.nix @@ -8,11 +8,13 @@ with lib; (mkIf config.riley.gui { enable = true; font = { - name = "Fira Code Medium"; + name = "Fira Code"; size = 11; }; settings = with config.riley.theme.hex; { + + bold_font = "Fira Code Medium"; background = background.primary; foreground = foreground.primary; diff --git a/modules/kak/colors.nix b/modules/kak/colors.nix index 78a9928..c137d2e 100644 --- a/modules/kak/colors.nix +++ b/modules/kak/colors.nix @@ -5,7 +5,7 @@ pkgs.writeTextFile (rec { destination = "/share/kak/colors/${name}"; text = with theme; '' - face global comment rgb:525252 + face global comment rgb:828282 face global value rgb:${blue.normal} face global string rgb:${green.normal} @@ -20,7 +20,7 @@ pkgs.writeTextFile (rec { face global LineNumbers rgb:${background.slight} face global BufferPadding rgb:${background.slight} 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 MenuBackground "default,rgb:313131" diff --git a/modules/kak/default.nix b/modules/kak/default.nix index ce0b45e..3f99dca 100644 --- a/modules/kak/default.nix +++ b/modules/kak/default.nix @@ -1,10 +1,23 @@ { 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; { - options.editor = { + options.riley = { 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 = [ - (kakoune { + (import ./kakoune.nix { - inherit (kak) haskell python rust nix; - typescript = kak.ts; + typescript = cfg.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; - theme = config.riley.theme; + inherit pkgs lib theme; }) ]; diff --git a/modules/kak/kak-lsp.nix b/modules/kak/kak-lsp.nix index c8d681c..a85d864 100644 --- a/modules/kak/kak-lsp.nix +++ b/modules/kak/kak-lsp.nix @@ -52,9 +52,9 @@ let semantic-tokens = "punctuation" = "punctuation"; }); - kak-lsp-config-text = - (optionalString (rust || haskell) semantic-tokens) - ++ (optionalString rust '' + kak-lsp-config-text = concatStringsSep "\n" ( + (optional (rust || haskell) semantic-tokens) + ++ (optional rust '' [language.rust] filetypes = [ "rust" ] roots = [ "Cargo.toml" ] @@ -65,31 +65,31 @@ let semantic-tokens = cargo.loadOutDirsFromCheck = true procMacro.enable = false '') - ++ (optionalString nix '' + ++ (optional nix '' [language.nix] filetypes = [ "nix" ] roots = [ "flake.nix", "shell.nix", ".git", ".hg" ] command = "rnix-lsp" '') - ++ (optionalString haskell '' + ++ (optional haskell '' [language.haskell] filetypes = [ "haskell" ] roots = [ "Setup.hs", "stack.yaml", "*.cabal" ] command = "haskell-language-server-wrapper" args = [ "--lsp" ] '') - ++ (optionalString python '' + ++ (optional python '' [language.python] filetypes = [ "python" ] roots = [ "setup.py", ".git", ".hg" ] command = "pylsp" '') - ++ (optionalString typescript '' + ++ (optional typescript '' [language.typescript] filetypes = ["typescript", "javascript"] roots = ["package.json"] command = "rslint-lsp" - ''); + '')); kak-lsp-config = (pkgs.writeTextFile (rec { name = "kak-lsp.toml"; diff --git a/modules/kak/kakrc.nix b/modules/kak/kakrc.nix index 34bfe51..1738805 100644 --- a/modules/kak/kakrc.nix +++ b/modules/kak/kakrc.nix @@ -94,7 +94,7 @@ let nix-config = (lib.optionalString nix '' ${ide-core} - face window keyword rgb:${green.bright} + face window keyword rgb:${theme.green.bright} face window meta keyword } @@ -109,12 +109,12 @@ let nix-config = (lib.optionalString nix '' set-option buffer tabstop 2 - face global variable rgb:${purple.normal} + face global variable rgb:${theme.purple.normal} face global attribute keyword face global operator keyword - face global keyword rgb:${blue.bright} + face global keyword rgb:${theme.blue.bright} 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 { name = "kakrc.kak"; 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 @@ -159,10 +161,16 @@ in pkgs.writeTextFile (rec { face global InlayDiagnosticHint rgb:4d965a+f face global InlayDiagnosticInfo rgb:4d965a+f - '' ++ keybinds - ++ typescript-config - ++ haskell-config - ++ python-config - ++ rust-config - ++ nix-config; + ${keybinds} + + ${typescript-config} + ${haskell-config} + ${python-config} + ${rust-config} + ${nix-config} + + hook global KakBegin .* %{ + cursorline + } + ''; })