From a9bf27f1ec2ff4b53937ef6971f8395d3d9c5b2a Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sat, 11 Mar 2023 16:29:57 +0100 Subject: development: additional tools --- usecases/desktop/development.nix | 229 ++++++++++++++++++++++----------------- 1 file changed, 131 insertions(+), 98 deletions(-) (limited to 'usecases') diff --git a/usecases/desktop/development.nix b/usecases/desktop/development.nix index d15afec..bc936b8 100644 --- a/usecases/desktop/development.nix +++ b/usecases/desktop/development.nix @@ -1,9 +1,11 @@ -inputs: - -{ config, lib, pkgs, ... }: - -let - inherit (pkgs.unstable) +inputs: { + config, + lib, + pkgs, + ... +}: let + inherit + (pkgs.unstable) clang clang-tools elixir_ls @@ -11,67 +13,82 @@ let marksman rust-analyzer-unwrapped lua-language-server - - vimPlugins; - - inherit (pkgs.unstable.python3Packages) python-lsp-server; - - luaFormat = inputs.self.lib.generators.lua { }; - -in -{ + vimPlugins + ; + + pylsp = with pkgs.unstable.python3Packages; + python-lsp-server.overrideAttrs (old: { + propagatedBuildInputs = + old.propagatedBuildInputs + ++ python-lsp-server.passthru.optional-dependencies.all; + }); + + luaFormat = inputs.self.lib.generators.lua {}; +in { imports = [ (import ./development/latex.nix inputs) ]; - options = with lib; with luaFormat.lib; { + 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"; + 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 = { }; + }); + default = {}; }; }; config = { # TODO: add cargo-info - users.extraUsers.minijackson.packages = with pkgs.unstable; [ - bintools - bacon - clang - clang-tools - diffoscopeMinimal - elixir - gcc - gdb - graphviz - man-pages - python3Packages.ipython - rr - rustup - watchexec - - # Python - black - python3Packages.isort - python3Packages.mypy - python3Packages.tox - ]; + users.extraUsers.minijackson.packages = with pkgs.unstable; + [ + bintools + bacon + clang + clang-tools + diffoscopeMinimal + elixir + gcc + gdb + graphviz + man-pages + python3Packages.ipython + rr + rustup + watchexec + + shfmt + taplo + + # Python + black + python3Packages.isort + python3Packages.mypy + python3Packages.tox + # TODO: how to install into pylsp's python env? + # python-lsp-black + # pyls-isort + # pylsp-mypy + + ruff + ]; vim = { extraPlugins = with vimPlugins; [ @@ -91,28 +108,45 @@ in }; lsp = { - elixirls.cmd = [ "${elixir_ls}/bin/elixir-ls" ]; - hls.cmd = [ "${haskell-language-server}/bin/haskell-language-server" "--lsp" ]; + elixirls.cmd = ["${elixir_ls}/bin/elixir-ls"]; + hls.cmd = ["${haskell-language-server}/bin/haskell-language-server" "--lsp"]; lua_ls = { - cmd = [ "${lua-language-server}/bin/lua-language-server" ]; - settings.Lua.completion.callSnippet = "Replace"; + cmd = ["${lua-language-server}/bin/lua-language-server"]; + settings.Lua = { + completion.callSnippet = "Replace"; + telemetry.enable = false; + }; + }; + marksman.cmd = ["${marksman}/bin/marksman"]; + pylsp = { + cmd = ["${pylsp}/bin/pylsp"]; + settings.pylsp.plugins = { + autopep8.enabled = false; + flake8.ignore = ["E501"]; + pycodestyle.ignore = ["E501"]; + yapf.enabled = false; + + # See TODO above + #black.enabled = true; + #isort.enabled = true; + #mypy.enabled = true; + }; }; - marksman.cmd = [ "${marksman}/bin/marksman" ]; - pylsp.cmd = [ "${python-lsp-server}/bin/pylsp" ]; }; luaConfig = with lib; let toLua = luaFormat.generate; lspconfigFor = name: settings: "lspconfig['${name}'].setup ${toLua settings}"; - lspconfig = concatStringsSep + lspconfig = + concatStringsSep "\n" (mapAttrsToList lspconfigFor config.vim.lsp); in - mkMerge [ - "require('vim-dev')" - "local lspconfig = require('lspconfig')" - lspconfig - ]; + mkMerge [ + "require('vim-dev')" + "local lspconfig = require('lspconfig')" + lspconfig + ]; }; programs.zsh.interactiveShellInit = '' @@ -128,47 +162,46 @@ in "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"; - }; + 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; + programs.direnv = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; - nix-direnv.enable = true; - }; + nix-direnv.enable = true; }; + }; nixpkgs.overlays = [ (self: super: { inherit (self.unstable) nix-direnv direnv; }) ]; - }; } -- cgit v1.2.3