From a85ac83182fe4507cc2ed1a4ff408c4022a61bce Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 24 Sep 2024 06:05:47 +0300 Subject: [PATCH 1/4] flake: minor cleanup - Get rid of Zig input (nixpkgs one is alright.) - Minor typo fixes --- flake.lock | 70 +----------------------------------------------------- flake.nix | 7 ++---- 2 files changed, 3 insertions(+), 74 deletions(-) diff --git a/flake.lock b/flake.lock index a39bf460..780614bf 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -52,21 +36,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "mnw": { "locked": { "lastModified": 1726188505, @@ -171,22 +140,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1702350026, - "narHash": "sha256-A+GNZFZdfl4JdDphYKBJ5Ef1HOiFsP18vQe9mqjmUis=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9463103069725474698139ab10f17a9d125da859", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nmd": { "flake": false, "locked": { @@ -1933,8 +1886,7 @@ "plugin-vim-vsnip": "plugin-vim-vsnip", "plugin-which-key": "plugin-which-key", "rnix-lsp": "rnix-lsp", - "systems": "systems_2", - "zig": "zig" + "systems": "systems_2" } }, "rust-overlay": { @@ -2006,26 +1958,6 @@ "repo": "flake-utils", "type": "github" } - }, - "zig": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1716725305, - "narHash": "sha256-LIz08gALt2wlutGXAEhNroEoIuPV5ePQB8LI4WzXcy8=", - "owner": "mitchellh", - "repo": "zig-overlay", - "rev": "93b02a697561ecd438cfa5779727b5a1c300cb4c", - "type": "github" - }, - "original": { - "owner": "mitchellh", - "repo": "zig-overlay", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 06849729..c4996fcf 100644 --- a/flake.nix +++ b/flake.nix @@ -90,10 +90,7 @@ flake = false; }; - # TODO: get zig from the zig overlay instead of nixpkgs - zig.url = "github:mitchellh/zig-overlay"; - - # Langauge server (use master instead of nixpkgs) + # Language servers (use master instead of nixpkgs) rnix-lsp.url = "github:nix-community/rnix-lsp"; nil = { url = "github:oxalica/nil"; @@ -159,7 +156,7 @@ flake = false; }; - # language support + # Language support plugin-sqls-nvim = { url = "github:nanotee/sqls.nvim"; flake = false; From 27b3524508075bcede63de961b974e04734d5974 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 24 Sep 2024 06:07:44 +0300 Subject: [PATCH 2/4] flake: bump nixpkgs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 780614bf..6b4b7155 100644 --- a/flake.lock +++ b/flake.lock @@ -98,11 +98,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726142289, - "narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=", + "lastModified": 1726871744, + "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "280db3decab4cbeb22a4599bd472229ab74d25e1", + "rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2", "type": "github" }, "original": { From 842b45b969c8280e474f0bb55b93ab0e32e47033 Mon Sep 17 00:00:00 2001 From: raf Date: Tue, 24 Sep 2024 03:20:56 +0000 Subject: [PATCH 3/4] languages/ts: update lspconfig; rename tsserver to ts_ls (#379) Silence lspconfig, Microsoft naming convention is speaking. --- flake.lock | 6 ++-- modules/plugins/languages/ts.nix | 47 ++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 6b4b7155..377c0847 100644 --- a/flake.lock +++ b/flake.lock @@ -1136,11 +1136,11 @@ "plugin-nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1716498901, - "narHash": "sha256-PMMqPDnq4Q8gWeKQ2WPE+pOf1R1G61wJ+bAWkHpQlzE=", + "lastModified": 1727085470, + "narHash": "sha256-IPpUZEMIL7+4mmqQLy9JeT0cW15/SH3Hx8kyksVcqC0=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "b972e7154bc94ab4ecdbb38c8edbccac36f83996", + "rev": "dd329912c8d446240584a2dbcd3802af3a19105a", "type": "github" }, "original": { diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index dd1bde69..e6e718ed 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -17,12 +17,12 @@ cfg = config.vim.languages.ts; - defaultServer = "tsserver"; + defaultServer = "ts_ls"; servers = { - tsserver = { + ts_ls = { package = pkgs.typescript-language-server; lspConfig = '' - lspconfig.tsserver.setup { + lspconfig.ts_ls.setup { capabilities = capabilities; on_attach = attach_keymaps, cmd = ${ @@ -49,6 +49,24 @@ } ''; }; + + # Here for backwards compatibility. Still consider tsserver a valid + # configuration in the enum, but assert if it's set to *properly* + # redirect the user to the correct server. + tsserver = { + package = pkgs.typescript-language-server; + lspConfig = '' + lspconfig.ts_ls.setup { + capabilities = capabilities; + on_attach = attach_keymaps, + cmd = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}'' + } + } + ''; + }; }; # TODO: specify packages @@ -65,6 +83,7 @@ ) ''; }; + prettierd = { package = pkgs.prettierd; nullConfig = '' @@ -94,6 +113,7 @@ }; }; in { + _file = ./ts.nix; options.vim.languages.ts = { enable = mkEnableOption "Typescript/Javascript language support"; @@ -190,11 +210,32 @@ in { }; }) + # Extensions (mkIf cfg.extensions."ts-error-translator".enable { vim.startPlugins = ["ts-error-translator"]; vim.pluginRC.ts-error-translator = entryAnywhere '' require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts}) ''; }) + + # Warn the user if they have set the default server name to tsserver to match upstream (us) + # The name "tsserver" has been deprecated in lspconfig, and now should be called ts_ls. This + # is a purely cosmetic change, but emits a warning if not accounted for. + { + assertions = [ + { + assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver"; + message = '' + As of a recent lspconfig update, he `tsserver` configuration has been renamed + to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver` + is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server` + to `"ts_ls"` instead of to `${cfg.lsp.server}` + + Please see for more details + about this change. + ''; + } + ]; + } ]); } From 316f25a0f62696b289ad4b944789beaae7fa9415 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 24 Sep 2024 06:27:06 +0300 Subject: [PATCH 4/4] docs: minor formatting changes Gerg I swear to god... --- docs/default.nix | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 4a9d2f8e..cce02b1d 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -100,11 +100,9 @@ in { # TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream # `nixosOptionsDoc` is more customizable. options.json = - pkgs.runCommand "options.json" - { + pkgs.runCommand "options.json" { meta.description = "List of nvf options in JSON format"; - } - '' + } '' mkdir -p $out/{share/doc,nix-support} cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf substitute \ @@ -117,15 +115,13 @@ in { # Generate the `man home-configuration.nix` package manPages = - pkgs.runCommand "nvf-reference-manpage" - { + pkgs.runCommand "nvf-reference-manpage" { nativeBuildInputs = [ pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs ]; allowedReferences = ["out"]; - } - '' + } '' # Generate manpages. mkdir -p $out/share/man/{man5,man1}