From 89eb86d89e4f4d69eab23653e03f42a5fea20473 Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Sun, 24 Nov 2024 21:38:00 -0700 Subject: [PATCH] Improve nixd config --- home-manager/modules/vscode.nix | 20 ++++++++++++++++++++ hosts/laptop/default.nix | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/home-manager/modules/vscode.nix b/home-manager/modules/vscode.nix index 47205dc..c2dab9d 100644 --- a/home-manager/modules/vscode.nix +++ b/home-manager/modules/vscode.nix @@ -46,6 +46,26 @@ # Nix "nix.enableLanguageServer" = true; "nix.serverPath" = "nixd"; + "nix.serverSettings" = { + nixd = { + formatting = { + command = [ "nixfmt" ]; + }; + + nixpkgs = { + expr = ''import (builtins.getFlake "/etc/nixos").inputs.nixpkgs { }''; + }; + + options = { + nixos = { + expr = ''(builtins.getFlake "/etc/nixos").nixosConfigurations.ty-nixos.options''; + }; + home-manager = { + expr = ''(builtins.getFlake "/etc/nixos").homeConfigurations."ty".options''; + }; + }; + }; + }; }; }; } \ No newline at end of file diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 257f0a4..7be3629 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ inputs, ... }: { imports = [ ./hardware-configuration.nix @@ -8,4 +8,5 @@ system.stateVersion = "24.05"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; } \ No newline at end of file