From 223b8bf04b509cb7e56c311f54adcf3be705aedb Mon Sep 17 00:00:00 2001 From: cnst Date: Sun, 14 Jul 2024 20:17:17 +0200 Subject: [PATCH] testing nixvim 2 --- flake.lock | 235 +++++++++++++++++- home/extra/neovim/plugins/default.nix | 6 +- home/extra/neovim/plugins/lsp.nix | 69 ++++- home/extra/neovim/plugins/tsserver-wrapper.sh | 4 + 4 files changed, 307 insertions(+), 7 deletions(-) create mode 100755 home/extra/neovim/plugins/tsserver-wrapper.sh diff --git a/flake.lock b/flake.lock index 6bd9783a..759a12a8 100644 --- a/flake.lock +++ b/flake.lock @@ -55,6 +55,28 @@ "type": "github" } }, + "devshell": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", + "owner": "numtide", + "repo": "devshell", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "firefox-nightly": { "inputs": { "cachix": "cachix", @@ -110,6 +132,20 @@ "type": "github" } }, + "flake-compat_3": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -131,6 +167,27 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -187,6 +244,54 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720524665, + "narHash": "sha256-ni/87oHPZm6Gv0ECYxr1f6uxB0UKBWJ6HvS7lwLU6oY=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "8d6a17d0cdf411c55f12602624df6368ad86fac1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -209,6 +314,28 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "hardware": { "locked": { "lastModified": 1720737798, @@ -244,6 +371,27 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720734513, + "narHash": "sha256-neWQ8eNtLTd+YMesb7WjKl1SVCbDyCm46LUgP/g/hdo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "90ae324e2c56af10f20549ab72014804a3064c7f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -304,6 +452,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720845312, + "narHash": "sha256-yPhAsJTpyoIPQZJGC8Fw8W2lAXyhLoTn+HP20bmfkfk=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "5ce8503cf402cf76b203eba4b7e402bea8e44abc", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1718714799, @@ -399,6 +568,33 @@ "type": "github" } }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat_3", + "flake-parts": "flake-parts_2", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1720910388, + "narHash": "sha256-gCudumUXHH+o0KFemXecDYySVCzjz7jYDGjdJbrN7gA=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "ac9a1cbf9c7145687e66a1c033d68fc72eca3fd8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ @@ -436,7 +632,8 @@ "lanzaboote": "lanzaboote", "nixpkgs": "nixpkgs_3", "nixpkgs-stable": "nixpkgs-stable_2", - "systems": "systems_3" + "nixvim": "nixvim", + "systems": "systems_4" } }, "rust-overlay": { @@ -495,6 +692,21 @@ } }, "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -508,6 +720,27 @@ "repo": "default-linux", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720818892, + "narHash": "sha256-f52x9srIcqQm1Df3T+xYR5P6VfdnDFa2vkkcLhlTp6U=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "5b002f8a53ed04c1a4177e7b00809d57bd2c696f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/home/extra/neovim/plugins/default.nix b/home/extra/neovim/plugins/default.nix index b851a571..d369a841 100644 --- a/home/extra/neovim/plugins/default.nix +++ b/home/extra/neovim/plugins/default.nix @@ -1,3 +1,4 @@ +{pkgs, ...}: { imports = [ ./barbar.nix @@ -8,7 +9,6 @@ ./lsp.nix ./lualine.nix ./markdown-preview.nix - ./neorg.nix ./neo-tree.nix ./startify.nix ./tagbar.nix @@ -18,7 +18,9 @@ ]; programs.nixvim = { - colorschemes.gruvbox.enable = true; + + extraPlugins = [pkgs.vimPlugins.gruvbox-material]; + colorscheme = "gruvbox-material"; plugins = { gitsigns = { diff --git a/home/extra/neovim/plugins/lsp.nix b/home/extra/neovim/plugins/lsp.nix index 6a55d2fd..350b26e2 100644 --- a/home/extra/neovim/plugins/lsp.nix +++ b/home/extra/neovim/plugins/lsp.nix @@ -23,11 +23,72 @@ }; servers = { - clangd.enable = true; - lua-ls.enable = true; - texlab.enable = true; + clangd = {enable = true;}; + lua-ls = { + enable = true; + extraOptions = { + settings = { + Lua = { + completion = { + callSnippet = "Replace"; + }; + telemetry = { + enabled = false; + }; + hint = {enable = true;}; + }; + }; + }; + }; + nil-ls = {enable = true;}; + tsserver = { + enable = true; + filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"]; + cmd = ["./tsserver-wrapper.sh"]; + extraOptions = { + settings = { + javascript = { + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + }; + typescript = { + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + }; + }; + }; + }; + eslint = {enable = true;}; + pyright = {enable = true;}; + ruff-lsp = {enable = true;}; + + rust-analyzer = { + enable = true; + installCargo = true; + installRustc = true; + settings = { + checkOnSave = true; + check = { + command = "clippy"; + }; }; }; }; - }; +}; +}; +}; } diff --git a/home/extra/neovim/plugins/tsserver-wrapper.sh b/home/extra/neovim/plugins/tsserver-wrapper.sh new file mode 100755 index 00000000..d414ee7e --- /dev/null +++ b/home/extra/neovim/plugins/tsserver-wrapper.sh @@ -0,0 +1,4 @@ +#!/bin/sh +export PATH="/etc/profiles/per-user/cnst/bin:$PATH" +echo "PATH=$PATH" > /tmp/tsserver-log.txt +exec /etc/profiles/per-user/cnst/bin/tsserver "$@" >> /tmp/tsserver-log.txt 2>&1