From b27ddf6aadd22ea679d8cb88a12af8a1af0667cb Mon Sep 17 00:00:00 2001 From: Toast Date: Fri, 9 Feb 2024 14:12:43 +0100 Subject: [PATCH 1/2] Common/helix: manually write languages.toml and configure nil for formatting --- roles/common/programs/helix.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/roles/common/programs/helix.nix b/roles/common/programs/helix.nix index 5a535fb..00f0af2 100644 --- a/roles/common/programs/helix.nix +++ b/roles/common/programs/helix.nix @@ -22,12 +22,17 @@ indent-guides.render = true; }; }; - languages = [ - { - name = "nix"; - formatter.command = "nixpkgs-fmt"; - } - ]; + }; + # The builtin languages options have issues + # https://github.com/nix-community/home-manager/issues/3299 + xdg.configFile."helixLanguages" = { + target = "helix/languages.toml"; + text = '' + [language-server.nil] + config.nil.formatting.command = [ "nixpkgs-fmt" ] + [[language]] + name = "nix" + ''; }; }; } From fea701c7b85002d4899bee1a27ad54020cc026ae Mon Sep 17 00:00:00 2001 From: Toast Date: Fri, 9 Feb 2024 15:40:43 +0100 Subject: [PATCH 2/2] Desktop/vscode: configure nil to use nixpkgs-fmt to format --- roles/desktop/programs/vscode.nix | 56 ++++++++++++++++++------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/roles/desktop/programs/vscode.nix b/roles/desktop/programs/vscode.nix index bfd7c38..d75c465 100644 --- a/roles/desktop/programs/vscode.nix +++ b/roles/desktop/programs/vscode.nix @@ -2,31 +2,39 @@ let inputs = flakeSelf.inputs; in { nixpkgs.overlays = [ inputs.catppuccin-vsc.overlays.default ]; - home-manager.users.toast.programs.vscode = { - enable = true; - package = pkgs.vscodium; - mutableExtensionsDir = false; - extensions = with inputs.vscode-extensions.extensions.x86_64-linux.open-vsx; [ - jnoortheen.nix-ide - (pkgs.catppuccin-vsc.override { - workbenchMode = "flat"; - extraBordersEnabled = true; - }) - catppuccin.catppuccin-vsc-icons - waderyan.gitblame + home-manager.users.toast = { + home.packages = with pkgs; [ + nixpkgs-fmt ]; - userSettings = { - # VSCode doesn't like nested settings - # https://stackoverflow.com/questions/74134436/is-it-possible-to-express-settings-in-vs-codes-settings-json-where-each-dot-sep - # TODO: write a function that unnests settings - "workbench.colorTheme" = "Catppuccin Mocha"; - "workbench.iconTheme" = "catppuccin-mocha"; - "editor.fontFamily" = "JetBrainsMono Nerd Font"; - "editor.semanticHighlighting.enabled" = true; - "nix.enableLanguageServer" = true; - "nix.serverPath" = "${pkgs.nil}/bin/nil"; - "terminal.integrated.minimumContrastRatio" = 1; - "window.titleBarStyle" = "custom"; + programs.vscode = { + enable = true; + package = pkgs.vscodium; + mutableExtensionsDir = false; + extensions = with inputs.vscode-extensions.extensions.x86_64-linux.open-vsx; [ + jnoortheen.nix-ide + (pkgs.catppuccin-vsc.override { + workbenchMode = "flat"; + extraBordersEnabled = true; + }) + catppuccin.catppuccin-vsc-icons + waderyan.gitblame + ]; + userSettings = { + # VSCode doesn't like nested settings + # https://stackoverflow.com/questions/74134436/is-it-possible-to-express-settings-in-vs-codes-settings-json-where-each-dot-sep + # TODO: write a function that unnests settings + "workbench.colorTheme" = "Catppuccin Mocha"; + "workbench.iconTheme" = "catppuccin-mocha"; + "editor.fontFamily" = "JetBrainsMono Nerd Font"; + "editor.semanticHighlighting.enabled" = true; + "nix.enableLanguageServer" = true; + "nix.serverPath" = "${pkgs.nil}/bin/nil"; + "nix.serverSettings" = { + "nil"."formatting"."command" = [ "nixpkgs-fmt" ]; + }; + "terminal.integrated.minimumContrastRatio" = 1; + "window.titleBarStyle" = "custom"; + }; }; }; }