inputs: { config, lib, pkgs, ... }: let inherit (pkgs.unstable) clang clang-tools elixir_ls haskell-language-server marksman nixd ltex-ls lua-language-server typos-lsp typst-lsp vimPlugins ; pylsp-env = pkgs.unstable.python3.withPackages (p: with p; [ python-lsp-server python-lsp-server.passthru.optional-dependencies.rope python-lsp-ruff pylsp-rope ]); luaFormat = inputs.self.lib.generators.lua {}; in { imports = [ (import ./development/adb.nix inputs) (import ./development/latex.nix inputs) (import ./development/nixvim-dev.nix inputs) ]; options = with lib; with luaFormat.lib; { vim.lsp = mkOption { description = '' Configure Neovim to use these LSP servers; ''; type = with types; attrsOf (submodule { freeformType = luaFormat.type; options = { capabilities = mkOption { default = mkRaw "capabilities"; }; cmd = mkOption { type = with types; listOf str; }; on_attach = mkOption { default = mkRaw "on_attach"; }; }; }); default = {}; }; }; config = { users.extraUsers.minijackson.packages = with pkgs.unstable; [ bintools clang clang-tools delta diffoscopeMinimal difftastic elixir gcc gdb graphviz hyperfine man-pages nix-output-monitor python3Packages.ipython rr watchexec xh git-absorb shfmt taplo # Rust dev bacon cargo-info rustup lldb # Python python3Packages.tox ruff neovide deadnix nix-init nix-top nixpkgs-fmt nixpkgs-hammering nurl statix # TODO: add global vale config vale ]; vim = { extraPlugins = with vimPlugins; [ actions-preview-nvim vim-pandoc clangd_extensions-nvim lsp_signature-nvim neodev-nvim nvim-lspconfig playground vim-grammarous # DAP # nvim-dap # nvim-dap-ui # nvim-dap-virtual-text # telescope-dap-nvim rustaceanvim ]; lsp = { bashls.cmd = ["${pkgs.unstable.nodePackages.bash-language-server}/bin/bash-language-server" "start"]; clangd = { cmd = [ "${clang-tools}/bin/clangd" "--background-index" "--clang-tidy" "--fallback-style=WebKit" "--header-insertion-decorators" "--header-insertion=iwyu" ]; capabilities = luaFormat.lib.mkRaw ''vim.tbl_extend("force", capabilities, { offsetEncoding = "utf-8" })''; }; elixirls.cmd = ["${elixir_ls}/bin/elixir-ls"]; hls.cmd = ["${haskell-language-server}/bin/haskell-language-server" "--lsp"]; ltex = { cmd = ["${ltex-ls}/bin/ltex-ls"]; filetypes = [ "bib" "gitcommit" "markdown" "org" "plaintex" "rst" "rnoweb" "tex" "typst" "pandoc" "quarto" "rmd" "context" "html" "xhtml" ]; }; lua_ls = { cmd = ["${lua-language-server}/bin/lua-language-server"]; settings.Lua = { completion.callSnippet = "Replace"; telemetry.enable = false; }; }; marksman.cmd = ["${marksman}/bin/marksman"]; nixd = { cmd = [(lib.getExe nixd)]; settings.nixd.formatting.command = ["alejandra"]; }; pylsp = { cmd = ["${pylsp-env}/bin/pylsp"]; settings.pylsp.plugins.ruff.enabled = true; }; taplo.cmd = ["${pkgs.unstable.taplo}/bin/taplo" "lsp" "stdio"]; typos_lsp.cmd = [(lib.getExe typos-lsp)]; typst_lsp.cmd = [(lib.getExe typst-lsp)]; }; luaConfig = with lib; let toLua = luaFormat.generate; lspconfigFor = name: settings: "lspconfig['${name}'].setup ${toLua settings}"; lspconfig = concatStringsSep "\n" (mapAttrsToList lspconfigFor config.vim.lsp); in '' require('vim-dev') local on_attach = require('myConfig.exports').on_attach local capabilities = require('myConfig.exports').capabilities local lspconfig = require('lspconfig') ${lspconfig} ''; }; programs.zsh.interactiveShellInit = '' (( $+commands[rustc] )) && fpath+="$(rustc --print sysroot)/share/zsh/site-functions" ''; programs.liboping.enable = true; documentation.dev.enable = true; boot.kernel.sysctl = { # For RR "kernel.perf_event_paranoid" = 1; }; home-manager.users.minijackson = {config, ...}: { home.file.".clang-format".source = (pkgs.formats.yaml {}).generate "clang-format.yml" { BasedOnStyle = "Mozilla"; ColumnLimit = 100; TabWidth = 4; IndentWidth = 4; UseTab = "ForIndentation"; AlignAfterOpenBracket = "AlwaysBreak"; AccessModifierOffset = -4; AlwaysBreakAfterDefinitionReturnType = "None"; AlwaysBreakAfterReturnType = "None"; AlwaysBreakTemplateDeclarations = true; BinPackArguments = false; BinPackParameters = false; BreakConstructorInitializers = "BeforeComma"; Cpp11BracedListStyle = true; DerivePointerAlignment = false; NamespaceIndentation = "Inner"; PenaltyBreakBeforeFirstCallParameter = 2; PointerAlignment = "Left"; Standard = "Latest"; }; programs.direnv = { enable = true; enableBashIntegration = true; enableZshIntegration = true; nix-direnv.enable = true; }; home.sessionVariables = { MIX_XDG = "1"; RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; CARGO_HOME = "${config.xdg.dataHome}/cargo"; RUFF_CACHE_DIR = "${config.xdg.cacheHome}/ruff"; PYTHONPYCACHEPREFIX = "${config.xdg.cacheHome}/python"; PYTHONUSERBASE = "${config.xdg.dataHome}/python"; _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${config.xdg.configHome}/java"; }; }; nixpkgs.overlays = [ (self: super: { inherit (self.unstable) nix-direnv direnv; }) ]; }; }