From 2b49d644ad8e4191e204f97925bd2924c5793d96 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Thu, 10 Oct 2024 03:04:12 +0000 Subject: [PATCH] fixed zls freezing nvim issue --- flake.lock | 152 ++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 13 ++-- modules/neovim.nix | 18 ++++-- 3 files changed, 173 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 83e0fba..fe0b54d 100644 --- a/flake.lock +++ b/flake.lock @@ -131,6 +131,22 @@ "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -224,6 +240,42 @@ "type": "github" } }, + "flake-utils_5": { + "inputs": { + "systems": "systems_8" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { + "inputs": { + "systems": "systems_9" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "git-hooks": { "inputs": { "flake-compat": [ @@ -276,6 +328,27 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "zls", + "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" + } + }, "headscale": { "inputs": { "flake-utils": [ @@ -729,7 +802,8 @@ "nixpkgs": "nixpkgs_7", "nixpkgs-stable": "nixpkgs-stable", "nixvim": "nixvim", - "utils": "utils" + "utils": "utils", + "zls": "zls" } }, "rust-analyzer-src": { @@ -891,6 +965,36 @@ "type": "github" } }, + "systems_8": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_9": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -929,6 +1033,52 @@ "repo": "flake-utils", "type": "github" } + }, + "zig-overlay": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_6", + "nixpkgs": [ + "zls", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726402199, + "narHash": "sha256-Q1NZ72dNZivH7KFkzW3wN1AHdAier+Xido+7XDzc++I=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "ca646ec2a1eebe15b2b6bd33811de6f12aa576c4", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zls": { + "inputs": { + "flake-utils": "flake-utils_5", + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixpkgs" + ], + "zig-overlay": "zig-overlay" + }, + "locked": { + "lastModified": 1728483147, + "narHash": "sha256-WWLzEZm9E6aBxoJqahYw4wCwUYV1+ndwGz1gwv87Wzc=", + "owner": "zigtools", + "repo": "zls", + "rev": "6ae67e89267440380f63544312b9113c0a895882", + "type": "github" + }, + "original": { + "owner": "zigtools", + "repo": "zls", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6eadfb1..4fe82fe 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,10 @@ inputs = { utils.url = "github:numtide/flake-utils"; nixvim.url = "github:nix-community/nixvim"; + zls = { + url = "github:zigtools/zls"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; # url = "github:NixOS/nixpkgs/b477b25191fc94ce764428520b83b6b64366e3c8"; @@ -51,6 +55,7 @@ kmonad, atuin, nixos-wsl, + zls, ... } @ inputs: let @@ -84,7 +89,7 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { - inherit user ewwtilities atuin pkgs-stable; + inherit user ewwtilities atuin pkgs-stable zls; }; users.${user} = { imports = [ @@ -127,7 +132,7 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { - inherit user ewwtilities atuin pkgs-stable; + inherit user ewwtilities atuin pkgs-stable zls; }; users.${user} = { imports = [ @@ -160,7 +165,7 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { - inherit user ewwtilities atuin pkgs-stable; + inherit user ewwtilities atuin pkgs-stable zls; }; users.${user} = { imports = [ @@ -192,7 +197,7 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { - inherit user ewwtilities atuin pkgs-stable; + inherit user ewwtilities atuin pkgs-stable zls; }; users.${user} = { imports = [ diff --git a/modules/neovim.nix b/modules/neovim.nix index 9b9f7a0..eb70412 100644 --- a/modules/neovim.nix +++ b/modules/neovim.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, zls, ... }: let in { @@ -163,16 +163,24 @@ in plugins = { web-devicons.enable = true; # text icons typescript-tools.enable = true; - zig.enable = true; + zig = { + enable = true; + settings = { + fmt_autosave = 0; + }; + }; lsp = { enable = true; servers = { - zls.enable = true; - gleam = { + zls = { enable = true; - autostart = true; + package = zls.packages.${pkgs.system}.zls; }; + # gleam = { + # enable = true; + # autostart = true; + # }; gopls = { enable = true; };