Compare commits

..

4 commits

7 changed files with 59 additions and 23 deletions

View file

@ -7,10 +7,11 @@ let
name = "vscode-${name}-language-server"; name = "vscode-${name}-language-server";
value = { value = {
args = [ "--stdio" ]; args = [ "--stdio" ];
command = "${pkgs.nodePackages.vscode-langservers-extracted}/bin/vscode-${name}-language-server"; command = "vscode-${name}-language-server";
filetypes = [ name ]; filetypes = [ name ];
roots = [ "package.json" ".git" ]; roots = [ "package.json" ".git" ];
}; };
package = pkgs.nodePackages.vscode-langservers-extracted;
}; };
tailwind = { tailwind = {
@ -23,6 +24,7 @@ let
validate = "warning"; validate = "warning";
userLanguages.templ = "html"; userLanguages.templ = "html";
}; };
package = pkgs.tailwindcss-language-server;
}; };
templModule = { pkgs, lib, ... }: { templModule = { pkgs, lib, ... }: {
@ -33,9 +35,9 @@ let
args = [ "lsp" ]; args = [ "lsp" ];
filetypes = [ "templ" ]; filetypes = [ "templ" ];
roots = [ "go.mod" ".git" ]; roots = [ "go.mod" ".git" ];
package = pkgs.unstable.templ;
}; };
home.packages = [ pkgs.unstable.templ ];
}; };
in in
@ -45,11 +47,6 @@ let
programs.kak-lsp.languageServers = (builtins.listToAttrs (map langserver [ "html" "css" "json" ])) // { programs.kak-lsp.languageServers = (builtins.listToAttrs (map langserver [ "html" "css" "json" ])) // {
tailwindcss-language-server = tailwind; tailwindcss-language-server = tailwind;
}; };
home.packages = with pkgs; [
nodePackages.vscode-langservers-extracted
tailwindcss-language-server
];
}; };
ltexLsp = { pkgs, lib, ... }: { ltexLsp = { pkgs, lib, ... }: {
@ -58,9 +55,8 @@ let
args = [ "--log-file=/tmp" ]; args = [ "--log-file=/tmp" ];
filetypes = [ "latex" "typst" ]; filetypes = [ "latex" "typst" ];
roots = [ "main.tex" "main.typ" ".git" ]; roots = [ "main.tex" "main.typ" ".git" ];
package = pkgs.ltex-ls;
}; };
home.packages = [ pkgs.ltex-ls ];
}; };
in in
@ -72,8 +68,6 @@ in
universal-ctags universal-ctags
# tree-sitter for kak # tree-sitter for kak
kak-tree-sitter kak-tree-sitter
# LSPs
metals
]; ];
# xdg.configFile."kak-tree-sitter/config.toml".source = ./kak-tree-sitter.toml; # xdg.configFile."kak-tree-sitter/config.toml".source = ./kak-tree-sitter.toml;
@ -106,8 +100,9 @@ in
programs.kak-lsp.languageServers.typescript-language-server = { programs.kak-lsp.languageServers.typescript-language-server = {
args = [ "--stdio" ]; args = [ "--stdio" ];
command = "typescript-language-server"; command = "typescript-language-server";
filetypes = [ "typescript" ]; filetypes = [ "typescript" "javascript" ];
roots = [ "package.json" ]; roots = [ "package.json" ];
package = pkgs.nodePackages.typescript-language-server;
}; };
programs.kak-lsp.languageServers.fsautocomplete = { programs.kak-lsp.languageServers.fsautocomplete = {
args = [ "--adaptive-lsp-server-enabled" "--project-graph-enabled" "--source-text-factory" "RoslynSourceText" ]; args = [ "--adaptive-lsp-server-enabled" "--project-graph-enabled" "--source-text-factory" "RoslynSourceText" ];
@ -135,6 +130,7 @@ in
statusBarProvider = "log-message"; statusBarProvider = "log-message";
compilerOptions = { overrideDefFormat = "unicode"; }; compilerOptions = { overrideDefFormat = "unicode"; };
}; };
package = pkgs.metals;
}; };
programs.kak-lsp.languageServers.texlab = { programs.kak-lsp.languageServers.texlab = {
command = "texlab"; command = "texlab";

View file

@ -61,12 +61,8 @@ map global normal D ": delete-current-brackets<ret>"
# Tab sizes # Tab sizes
hook global InsertChar \t %{ exec -draft -itersel h@ } hook global InsertChar \t %{ exec -draft -itersel h@ }
set global tabstop 4 set global tabstop 2
set global indentwidth 4 set global indentwidth 2
hook global WinSetOption filetype=(c|cpp|haskell|nix|yaml) %{
set global tabstop 2
set global indentwidth 2
}
# Ctrl + a in insert mode = esc # Ctrl + a in insert mode = esc
map global insert <c-a> '<esc>' map global insert <c-a> '<esc>'
@ -91,6 +87,7 @@ hook global InsertCompletionHide .* %{
# Enable LSP # Enable LSP
try %{ try %{
eval %sh{test -z "$WE_STARTED_KAK" && kak-lsp --kakoune -s $kak_session} eval %sh{test -z "$WE_STARTED_KAK" && kak-lsp --kakoune -s $kak_session}
set-option global lsp_cmd "kak-lsp -s %val{session}"
} }
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|fsharp|ocaml|haskell|nix|scala|typst|html|css|json|markdown|templ|elixir) %{ hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|fsharp|ocaml|haskell|nix|scala|typst|html|css|json|markdown|templ|elixir) %{
lsp-enable-window lsp-enable-window

View file

@ -143,10 +143,28 @@ let
default = null; default = null;
description = "Additional settings to be passed to the LSP server."; description = "Additional settings to be passed to the LSP server.";
}; };
package = mkOption {
type = types.nullOr types.package;
default = null;
description = "The default package of the language server. Will be appended as the ending segments of the PATH to kak-lsp";
};
}; };
}; };
cfg = config.programs.kak-lsp; cfg = config.programs.kak-lsp;
serverPackages =
filter (v: v != null)
(lib.mapAttrsToList (_: serv: serv.package) cfg.languageServers);
wrappedPackage = pkgs.symlinkJoin {
name = "kak-lsp-wrapped";
nativeBuildInputs = [ pkgs.makeWrapper ];
paths = [ cfg.package ];
postBuild = ''
wrapProgram $out/bin/kak-lsp --suffix PATH ":" ${lib.makeBinPath serverPackages}
'';
};
in in
{ {
options.programs.kak-lsp = { options.programs.kak-lsp = {
@ -195,13 +213,13 @@ in
config = mkIf cfg.enable config = mkIf cfg.enable
{ {
home.packages = [ cfg.package ]; home.packages = [ wrappedPackage ];
# Configurations # Configurations
xdg.configFile."kak-lsp/kak-lsp.toml" = xdg.configFile."kak-lsp/kak-lsp.toml" =
let let
toml = pkgs.formats.toml { }; toml = pkgs.formats.toml { };
stripNulls = lib.filterAttrsRecursive (n: v: v != null); toLspConfig = lib.filterAttrsRecursive (n: v: n != "package" && v != null);
in in
{ {
source = toml.generate "config.toml" source = toml.generate "config.toml"
@ -210,7 +228,7 @@ in
server.timeout = cfg.serverTimeout; server.timeout = cfg.serverTimeout;
snippet_support = cfg.enableSnippets; snippet_support = cfg.enableSnippets;
verbosity = 255; verbosity = 255;
language_server = stripNulls (lspConfig.language_servers // cfg.languageServers); language_server = toLspConfig (lspConfig.language_servers // cfg.languageServers);
language_ids = lspConfig.language_ids // cfg.languageIds; language_ids = lspConfig.language_ids // cfg.languageIds;
}; };
}; };

View file

@ -119,7 +119,7 @@ in
dnsServers = mkOption { dnsServers = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = "DNS server list"; description = "DNS server list";
default = [ "8.8.8.8" "8.8.4.4" ]; default = [ "1.1.1.1" "2606:4700:4700:1111" ];
}; };
networks = mkOption { networks = mkOption {
type = types.attrsOf (types.submodule { type = types.attrsOf (types.submodule {

View file

@ -13,6 +13,8 @@
../modules/personal/fonts ../modules/personal/fonts
# Encrypted DNS # Encrypted DNS
../modules/services/edns ../modules/services/edns
# Wireless card
./wireless.nix
]; ];
# services.xserver.enable = true; # services.xserver.enable = true;

View file

@ -0,0 +1,13 @@
{ pkgs, lib, ... }: {
environment.systemPackages = with pkgs; [ iw ];
# Disable power_save on boot
services.udev.packages = [
(pkgs.writeTextFile {
name = "udev_disable_wifi_power_save";
destination = "/etc/udev/rules.d/10-wifi-power_save.rules";
text = ''
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", RUN+="${lib.getExe pkgs.iw} dev $name set power_save off"
'';
})
];
}

View file

@ -86,6 +86,17 @@ let
}) })
]; ];
}; };
# rbw: https://github.com/doy/rbw/pull/189
rbw = prev.rbw.overrideAttrs (attrs: {
patches = (attrs.patches or [ ]) ++ [
(final.fetchurl
{
url = "https://github.com/doy/rbw/pull/189.patch";
hash = "sha256-617nYL9Jmu+inpAzDu/+iYXhajckzpsxW+jlhcRwseM=";
})
];
});
}; };
overlay-libs = final: prev: { overlay-libs = final: prev: {
@ -95,7 +106,6 @@ let
overlay-packages = final: prev: { overlay-packages = final: prev: {
kak-tree-sitter = final.callPackage ./packages/common/kak-tree-sitter.nix { rustPlatform = final.unstable.rustPlatform; }; kak-tree-sitter = final.callPackage ./packages/common/kak-tree-sitter.nix { rustPlatform = final.unstable.rustPlatform; };
kak-lsp = kak-lsp =
let let
src = inputs.kak-lsp; src = inputs.kak-lsp;