Compare commits

...

8 commits

Author SHA1 Message Date
Bad
5830d76e34 Use the fenix overlay workaround recommended by upstream 2022-09-02 11:00:24 +02:00
Bad
f617ad6898 Fix fenix not using the cache 2022-09-01 17:27:11 +02:00
Bad
8356ba209f Add tailscale 2022-08-28 01:05:07 +02:00
Bad
a287f2d2e8 Clangd 2022-08-28 01:03:01 +02:00
Bad
b47f64dc27 Update flake.lock 2022-08-26 22:55:36 +02:00
Bad
87aeb4cfea Enable go-lsp 2022-08-26 22:55:16 +02:00
Bad
539646493a Switch over to nvim-lsp 2022-08-20 00:04:16 +02:00
Bad
a08b1d7277 Switch over to nix-lspconfig 2022-08-17 22:02:19 +02:00
16 changed files with 204 additions and 195 deletions

View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1652712410, "lastModified": 1662046976,
"narHash": "sha256-hMJ2TqLt0DleEnQFGUHK9sV2aAzJPU8pZeiZoqRozbE=", "narHash": "sha256-BrTReGRhkVm/Kmmf4zQrL+oYWy0sds/BDBgXNX1CL3c=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "7e5e58b98c3dcbf497543ff6f22591552ebfe65b", "rev": "9f136ecfa5bf954538aed3245e4408cf87c85097",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -42,11 +42,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1657835815, "lastModified": 1661882940,
"narHash": "sha256-CnZszAYpNKydh6N7+xg+eRtWNVoAAGqc6bg+Lpgq1xc=", "narHash": "sha256-4LaVFnV22WrOA0aolqqk9dXrM8crikcrLQt29G18F7M=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "54a24f042f93c79f5679f133faddedec61955cf2", "rev": "80cec5115aae74accc4ccfb9f84306d7863f0632",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -88,11 +88,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1645603310, "lastModified": 1661212356,
"narHash": "sha256-/CTQuJzFK8pO2d4S5uKhHwT+QiNfnbCKSx7O2tW0GXQ=", "narHash": "sha256-+9P849WIb/zhAMWXrW9g0IRd7vFRj5a5acLTtOFyY48=",
"owner": "input-output-hk", "owner": "input-output-hk",
"repo": "deploy-rs", "repo": "deploy-rs",
"rev": "feb44f80c634c799a661bf27c5cb4a905640fe93", "rev": "4da8eb9fc3e611adf4bbe8c8df5b1fc604c4f906",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -169,11 +169,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1660458418, "lastModified": 1662101031,
"narHash": "sha256-vBWAv4QhXa9VmyaJUsTfQmKs+uw83Pfv/FmN5GD3KkE=", "narHash": "sha256-dTlT6J6+Rv6zno/VhJusBwgV7iFNRUdY4GgH7BUPWYk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "54253fb23a5871466ada5c0334b6e39a0bcdb4db", "rev": "42e17909b3c69577303fd0c7ae138df3f4888de2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -379,11 +379,11 @@
}, },
"latest": { "latest": {
"locked": { "locked": {
"lastModified": 1660396586, "lastModified": 1662019588,
"narHash": "sha256-ePuWn7z/J5p2lO7YokOG1o01M0pDDVL3VrStaPpS5Ig=", "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e105167e98817ba9fe079c6c3c544c6ef188e276", "rev": "2da64a81275b68fdad38af669afeda43d401e94b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -415,11 +415,11 @@
}, },
"nixos": { "nixos": {
"locked": { "locked": {
"lastModified": 1660406417, "lastModified": 1662025319,
"narHash": "sha256-ekKl2IWxAEjwrAtE//PgR95UcvqFK+FaT4kR5XFcdjQ=", "narHash": "sha256-ZJlBQ7jXynq4+Jg9+DgOe8FJG8sDIeFFYP3V3K98KUs=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d816f474aa79d020a75cc3e69113759e32aabc2e", "rev": "b82ccafb54163ab9024e893e578d840577785fea",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -431,11 +431,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1660407119, "lastModified": 1662092548,
"narHash": "sha256-04lWO0pDbhAXFdL4v2VzzwgxrZ5IefKn+TmZPiPeKxg=", "narHash": "sha256-nmAbyJ5+DBXcNJ2Rcy/Gx84maqtLdr6xEe82+AXCaY8=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "12620020f76b1b5d2b0e6fbbda831ed4f5fe56e1", "rev": "786633331724f36967853b98d9100b5cfaa4d798",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -446,11 +446,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1660305968, "lastModified": 1662019588,
"narHash": "sha256-r0X1pZCSEA6mzt5OuTA7nHuLmvnbkwgpFAh1iLIx4GU=", "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d", "rev": "2da64a81275b68fdad38af669afeda43d401e94b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -567,11 +567,11 @@
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1660416638, "lastModified": 1662066014,
"narHash": "sha256-DllHrfAUUjg0tBYvj32jr4NQZrH0dC9sRiBPqN8C03w=", "narHash": "sha256-DE4FsE2sxd9nFtG+8+lnv/IBbtf+6rAlKjIdfpWN488=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "010f68cacfdddcc50234b54965e1326d7ad925ab", "rev": "93c52e41ec0d297c7512adf5936d8c464c820618",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -74,11 +74,12 @@
nixos = { nixos = {
imports = [ (digga.lib.importOverlays ./overlays) ]; imports = [ (digga.lib.importOverlays ./overlays) ];
overlays = [ overlays = [
# fenix.overlay breaks the cache, because it uses the system nixpkgs
(_: super: let pkgs = fenix.inputs.nixpkgs.legacyPackages.${super.system}; in fenix.overlay pkgs pkgs)
agenix.overlay agenix.overlay
nvfetcher.overlay nvfetcher.overlay
./pkgs/default.nix ./pkgs/default.nix
fenix.overlay
peerix.overlay peerix.overlay
]; ];
}; };

View file

@ -1 +1,2 @@
*.localhost localhost *.localhost localhost
*.notatld.localhost localhost

View file

@ -0,0 +1,3 @@
{ ... }: {
services.tailscale.enable = true;
}

View file

@ -1,7 +1,7 @@
{ profiles, ... }: { profiles, ... }:
with profiles; rec { with profiles; rec {
base = [ users.root core dnscrypt ]; base = [ users.root core dnscrypt ];
workstation = base ++ [ sway develop game profiles.workstation ssh flatpak torrents pwn tor rust virtualization java networkmanager pipewire flatpak peerix users.mae ]; workstation = base ++ [ sway develop game profiles.workstation ssh flatpak torrents pwn tor rust virtualization java networkmanager pipewire flatpak peerix tailscale users.mae ];
desktop = workstation ++ [ amd three_dee ]; desktop = workstation ++ [ amd three_dee ];
lap = workstation ++ [ laptop bluetooth print ]; lap = workstation ++ [ laptop bluetooth print ];
} }

View file

@ -0,0 +1,18 @@
{ lib, pkgs, config, ... }:
let
cfg = config.mae.nvim.clangd;
in
with lib;
{
options.mae.nvim.clangd.enable = lib.mkEnableOption "Enable C/C++ language support(with clangd) in neovim";
config = mkIf cfg.enable {
mae.nvim.lsp.servers.clangd = {
enable = true;
script = ''
{
cmd = { "${pkgs.clang-tools}/bin/clangd" },
}
'';
};
};
}

View file

@ -5,12 +5,14 @@ let
in in
{ {
imports = [ imports = [
./nvim-lsp.nix
./js.nix ./js.nix
./go.nix ./go.nix
./rust.nix ./rust.nix
./web_dev.nix ./nix.nix
./other_langs.nix ./clangd.nix
]; ];
options.mae.nvim = { options.mae.nvim = {
enable = mkEnableOption "enable neovim"; enable = mkEnableOption "enable neovim";
}; };
@ -30,6 +32,9 @@ in
vim-sleuth vim-sleuth
]; ];
extraPackages = with pkgs; [
nodePackages.prettier
];
extraConfig = '' extraConfig = ''
set background=dark set background=dark
set termguicolors set termguicolors
@ -38,22 +43,8 @@ in
set number set number
set autoindent set autoindent
set completeopt=menuone,noinsert,noselect
set shortmess+=c set shortmess+=c
''; set completeopt=menuone,noinsert,noselect
coc.pluginConfig = ''
nmap <silent> <F2> <Plug>(coc-rename)
nmap <silent> <F3> <Plug>(coc-codeaction-line)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
''; '';
}; };
}; };

View file

@ -4,14 +4,16 @@ let
in in
with lib; with lib;
{ {
options.mae.nvim.go = { options.mae.nvim.go.enable = lib.mkEnableOption "Enable go language support in neovim";
enable = mkEnableOption "Enable go support in nvim";
}; config = mkIf cfg.enable {
config.programs.neovim = mkIf cfg.enable { mae.nvim.lsp.servers.gopls = {
coc.enable = true; enable = true;
plugins = with pkgs.vimPlugins; [ script = ''
pkgs.go-fold-if-err-nil {
coc-go cmd = { "${pkgs.gopls}/bin/gopls" },
]; }
'';
};
}; };
} }

View file

@ -0,0 +1,15 @@
{ lib, pkgs, config, ... }:
let
cfg = config.mae.nvim.html;
in
with lib;
{
options.mae.nvim.html.enable = mkEnableOption "Enable html/css support in nvim";
config = mkIf cfg.nix.enable {
programs.neovim = {
plugins = with pkgs.vimPlugins; [
emmet-vim
];
};
};
}

View file

@ -1,26 +1,41 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
let let
typescript-lsp = pkgs.nodePackages.typescript-language-server;
tsserver-path = "${pkgs.nodePackages.typescript}/lib/node_modules/typescript/lib";
cfg = config.mae.nvim; cfg = config.mae.nvim;
in in
with lib; with lib;
{ {
options.mae.nvim.js = { options.mae.nvim.js = {
tsserver.enable = mkEnableOption "Enable js/ts support in nvim with tsserver"; tsserver.enable = mkEnableOption "Enable js/ts support in nvim with tsserver";
deno.enable = mkEnableOption "Enable deno support in nvim";
}; };
config = mkIf cfg.js.tsserver.enable { config = mkMerge [
programs.neovim = { (mkIf cfg.js.deno.enable
coc.enable = true; {
plugins = with pkgs.vimPlugins; [ mae.nvim.lsp.servers.denols = {
coc-tsserver enable = true;
{ script = ''
plugin = vim-jsdoc; {
config = '' cmd = { "${pkgs.deno}/bin/deno", "lsp" },
let g:jsdoc_formatter = "tsdoc" single_file_support = false,
let g:typescript_indent_disable = 1 }
''; '';
} };
]; }
}; )
}; (mkIf
cfg.js.tsserver.enable
{
mae.nvim.lsp.servers.tsserver = {
enable = true;
script = ''
{
cmd = { "${typescript-lsp}/bin/typescript-language-server", "--stdio", "--tsserver-path", "${tsserver-path}" }
}
'';
};
})
];
} }

View file

@ -0,0 +1,21 @@
{ lib, pkgs, config, ... }:
let
cfg = config.mae.nvim;
in
with lib;
{
options.mae.nvim.nix.enable = mkEnableOption "Enable nix support in nvim";
config = mkIf cfg.nix.enable {
programs.neovim = {
plugins = with pkgs.vimPlugins; [
vim-nix
];
};
mae.nvim.lsp.servers.rnix = {
enable = true;
script = '' {
cmd = { "${pkgs.rnix-lsp}/bin/rnix-lsp" }
}'';
};
};
}

View file

@ -0,0 +1,49 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.mae.nvim;
lspLangConfigType = types.submodule {
options = {
enable = mkEnableOption "Enable named lsp lang config";
script = mkOption {
type = types.lines;
default = "{}";
};
};
};
mkLspLangConfig = name: cfg: ''
require'lspconfig'["${name}"].setup(require'coq'.lsp_ensure_capabilities(${cfg.script}))
'';
mkLspLangConfigs = cfgs: lib.strings.concatStringsSep "\n" ((lib.attrsets.mapAttrsToList mkLspLangConfig cfgs));
in
{
options.mae.nvim.lsp = {
enable = mkEnableOption "Enable lsp support in nvim with nvim-lspconfig and cmp-nvim";
servers = mkOption {
type = types.attrsOf lspLangConfigType;
default = [ ];
};
};
config = mkIf cfg.lsp.enable {
programs.neovim = {
plugins = with pkgs.vimPlugins; [
{
plugin = coq_nvim;
config = ''
vim.g.coq_settings = {
xdg = true,
auto_start = true
}
'';
type = "lua";
}
{
plugin = nvim-lspconfig;
config = mkLspLangConfigs cfg.lsp.servers;
type = "lua";
}
];
};
};
}

View file

@ -1,68 +0,0 @@
{ lib, pkgs, config, ... }:
let
cfg = config.mae.nvim;
in
with lib;
{
imports = [
# Lua
({ ... }: {
options.mae.nvim.lua.enable = mkEnableOption "Enable lua support in nvim";
config.programs.neovim = mkIf cfg.lua.enable
{
coc.enable = true;
coc.settings.languageserver.lua = mkIf cfg.lua.enable {
command = "${pkgs.sumneko-lua-language-server}/bin/lua-language-server";
rootPatterns = [ ".git" ];
filetypes = [
"lua"
];
};
};
})
# Nix
({ ... }: {
options.mae.nvim.nix.enable = mkEnableOption "Enable nix support in nvim";
config.programs.neovim = mkIf cfg.nix.enable
{
plugins = with pkgs.vimPlugins; [
vim-nix
];
coc.enable = true;
coc.settings.languageserver.nix = mkIf cfg.nix.enable {
"command" = "${pkgs.rnix-lsp}/bin/rnix-lsp";
"filetypes" = [
"nix"
];
};
};
})
# Clangd
({ ... }: {
options.mae.nvim.clangd.enable = mkEnableOption "Enable clangd support in nvim";
config.programs.neovim = mkIf cfg.clangd.enable
{
plugins = with pkgs.vimPlugins; [
coc-clangd
];
coc.enable = true;
coc.settings = {
"clangd.checkUpdates" = false;
# Use whatever clangd is in path for dependency reasons I think I don't remember at this point
"clangd.path" = "clangd";
};
};
})
# Python
({ ... }: {
options.mae.nvim.python.enable = mkEnableOption "Enable python support in nvim";
config.programs.neovim = mkIf cfg.python.enable
{
coc.enable = true;
plugins = with pkgs.vimPlugins; [
coc-pyright
];
};
})
];
}

View file

@ -1,23 +1,22 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
let let
cfg = config.mae.nvim.rust; cfg = config.mae.nvim;
in in
with lib; with lib;
{ {
options.mae.nvim.rust = { options.mae.nvim.rust.enable = lib.mkEnableOption "Enable rust language support in neovim";
enable = mkEnableOption "Enable rust support in nvim";
}; config = mkIf cfg.rust.enable {
config.programs.neovim = mkIf cfg.enable { mae.nvim.lsp.servers.rust_analyzer = {
coc.enable = true; enable = true;
plugins = with pkgs.vimPlugins; [ script = ''
coc-rust-analyzer {
]; cmd = { "${pkgs.rust-analyzer}/bin/rust-analyzer" },
coc.settings = { settings = {
"rust-analyzer.server.path" = "${pkgs.rust-analyzer-nightly}/bin/rust-analyzer"; ["rust-analyzer"] = { cargo = { features = "all" } }
"rust-analyzer.updates.prompt" = false; }
"rust-analyzer.updates.checkOnStartup" = false; }
"rust-analyzer.cargo.loadOutDirsFromCheck" = true; '';
"rust-analyzer.procMacro.enable" = true;
}; };
}; };
} }

View file

@ -1,41 +0,0 @@
{ lib, pkgs, config, ... }:
let
cfg = config.mae.nvim;
in
with lib;
{
options.mae.nvim.web = {
enable = mkEnableOption "Enable webdev support in nvim";
};
options.mae.nvim.js = {
enable = mkEnableOption "Enable js/ts support in nvim";
};
config = mkMerge [
(mkIf cfg.js.enable {
programs.neovim = {
coc.enable = true;
plugins = with pkgs.vimPlugins; [
coc-tsserver
{
plugin = vim-jsdoc;
config = ''
let g:jsdoc_formatter = "tsdoc"
let g:typescript_indent_disable = 1
'';
}
];
};
})
(mkIf cfg.web.enable {
mae.nvim.js.enable = true;
programs.neovim = {
coc.enable = true;
plugins = with pkgs.vimPlugins; [
coc-emmet
coc-html
];
};
})
];
}

View file

@ -2,10 +2,13 @@
{ {
mae.nvim = { mae.nvim = {
enable = true; enable = true;
# js.tsserver.enable = true; lsp.enable = true;
js.tsserver.enable = true;
js.deno.enable = true;
nix.enable = true; nix.enable = true;
rust.enable = true; rust.enable = true;
go.enable = true;
clangd.enable = true; clangd.enable = true;
python.enable = true; #python.enable = true;
}; };
} }