From bdbde5464800ed814f2749a7cd1a73d35320abad Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Wed, 23 Apr 2025 18:34:02 +0300 Subject: [PATCH] Added nix LSP (nil_ls) I love it, it just works out of the box, unlike nixd which was so broken I couldn't get it to work, and it's so much more featureful, it has insane autocompletion for keywords and vars and I can go to definition/go to references on files/vars etc and it has diagnostics and shows when there is an error, it's so much better, and it has completion for nix options --- .../lua/custom/config/language-servers.lua | 18 +----------------- flake.nix | 4 ++-- hosts/hardware-configuration-laptop.nix | 2 +- hosts/home.nix | 2 +- hosts/lapsktop.nix | 2 +- hosts/laptop.nix | 2 +- modules/common.nix | 2 +- modules/kde.nix | 3 +-- modules/laptop.nix | 4 +--- modules/networking.nix | 3 +-- 10 files changed, 11 insertions(+), 31 deletions(-) diff --git a/.config/nvim/lua/custom/config/language-servers.lua b/.config/nvim/lua/custom/config/language-servers.lua index e3d7d29..f7e28c1 100644 --- a/.config/nvim/lua/custom/config/language-servers.lua +++ b/.config/nvim/lua/custom/config/language-servers.lua @@ -147,23 +147,7 @@ return { }, }, }, -- zig - -- nixd = { - -- mason = false, - -- cmd = { 'nixd' }, - -- settings = { - -- nixd = { - -- nixpkgs = { expr = 'import { }' }, - -- -- options = { - -- -- nixos = { - -- -- expr = '(builtins.getFlake \\"/home/kyren/dotfiles/flake.nix").nixosConfigurations.laptop-nixos.options', - -- -- }, - -- -- home_manager = { - -- -- expr = '(builtins.getFlake \\"/home/kyren/dotfiles/flake.nix").homeConfigurations.laptop-nixos.options', - -- -- }, - -- -- }, - -- }, - -- }, - -- }, + nil_ls = {}, -- nix asm_lsp = { mason = false, cmd = { 'asm-lsp' }, diff --git a/flake.nix b/flake.nix index dd2df2d..86914b7 100644 --- a/flake.nix +++ b/flake.nix @@ -13,13 +13,13 @@ outputs = { self, nixpkgs, ... }@inputs: { nixosConfigurations = { laptop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; + specialArgs = { inherit inputs; }; modules = [ ./hosts/laptop.nix ]; }; lapsktop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; + specialArgs = { inherit inputs; }; modules = [ ./hosts/lapsktop.nix ]; diff --git a/hosts/hardware-configuration-laptop.nix b/hosts/hardware-configuration-laptop.nix index 5dbd889..327f8c8 100644 --- a/hosts/hardware-configuration-laptop.nix +++ b/hosts/hardware-configuration-laptop.nix @@ -1,7 +1,7 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/hosts/home.nix b/hosts/home.nix index 2bec371..ac9520e 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: { +{ pkgs, inputs, ... }: { home.username = "kyren"; home.homeDirectory = "/home/kyren"; diff --git a/hosts/lapsktop.nix b/hosts/lapsktop.nix index c9eea83..bf25017 100644 --- a/hosts/lapsktop.nix +++ b/hosts/lapsktop.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: { +{ pkgs, inputs, ... }: { imports = [ ./hardware-configuration-laptop.nix diff --git a/hosts/laptop.nix b/hosts/laptop.nix index c9eea83..bf25017 100644 --- a/hosts/laptop.nix +++ b/hosts/laptop.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: { +{ pkgs, inputs, ... }: { imports = [ ./hardware-configuration-laptop.nix diff --git a/modules/common.nix b/modules/common.nix index e7bd415..0e5fdda 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -4,7 +4,7 @@ # # #--------------------------------------# -{config, pkgs, ...}: { +{pkgs, ...}: { # User users.users.kyren = { diff --git a/modules/kde.nix b/modules/kde.nix index 833e40d..7b3ea95 100644 --- a/modules/kde.nix +++ b/modules/kde.nix @@ -1,6 +1,5 @@ -{ config, pkgs, ... }: +{ ... }: { -{ # Enable the KDE Plasma Desktop Environment. services.displayManager.sddm.enable = true; services.desktopManager.plasma6.enable = true; diff --git a/modules/laptop.nix b/modules/laptop.nix index 60def67..c5e0409 100644 --- a/modules/laptop.nix +++ b/modules/laptop.nix @@ -1,6 +1,4 @@ -{ config, pkgs, ... }: - -{ +{ ... }: { # battery levels notifier systemd.timers."battery-notifier" = { diff --git a/modules/networking.nix b/modules/networking.nix index 6574955..955e0b1 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -1,6 +1,5 @@ -{ config, pkgs, ... }: +{ ... }: { -{ # Enable networking networking.networkmanager.enable = true;