From 93f0d8c30d40859fa911b4f97e5942e8c75a4790 Mon Sep 17 00:00:00 2001 From: Ethan Reece Date: Mon, 14 Jul 2025 10:04:10 -0500 Subject: [PATCH] Move dictionary to flake-parts configuration --- base/languages/en-us/default.nix | 29 +++++++++++------------------ flake.nix | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/base/languages/en-us/default.nix b/base/languages/en-us/default.nix index fa3a30a..e0233f0 100644 --- a/base/languages/en-us/default.nix +++ b/base/languages/en-us/default.nix @@ -1,24 +1,17 @@ { flake-parts-lib, lib, ... }: -let - dictionary = [ - "Asahi" - "Catppuccin" - "Devshell" - "LanguageTool" - "LLMs" - "LTeX" - "NixOS" - "Nushell" - "SOPS" - "Stylix" - ]; -in { options.perSystem = flake-parts-lib.mkPerSystemOption ( - { pkgs, ... }: + { pkgs, config, ... }: { options.languages.en-us = { enable = lib.mkEnableOption "en_US"; + dictionary = lib.mkOption { + description = '' + Words to add to dictionary. + ''; + type = lib.types.listOf lib.types.string; + default = [ ]; + }; }; config = let @@ -34,7 +27,7 @@ in name = "config/vocabularies/General"; }; name = "accept.txt"; - text = builtins.concatStringsSep "\n" dictionary; + text = builtins.concatStringsSep "\n" config.languages.en-us.dictionary; path = pkgs.writeTextFile { name = vale.styles.dictionary.name; text = vale.styles.dictionary.text; @@ -86,7 +79,7 @@ in builtins.map (x: { name = x; value = x; - }) dictionary + }) config.languages.en-us.dictionary ); }; file = tomlFormatter.generate "typos.toml" typos.content; @@ -98,7 +91,7 @@ in ltex-ls-plus = { command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus"; config.ltex = { - dictionary.en-US = dictionary; + dictionary.en-US = config.languages.en-us.dictionary; additionalRules.enablePickyRules = true; }; }; diff --git a/flake.nix b/flake.nix index 7e6e1c1..0f7652d 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,21 @@ { editors.helix.enable = true; languages = { - en-us.enable = true; + en-us = { + enable = true; + dictionary = [ + "Asahi" + "Catppuccin" + "Devshell" + "LanguageTool" + "LLMs" + "LTeX" + "NixOS" + "Nushell" + "SOPS" + "Stylix" + ]; + }; markdown.enable = true; nix.enable = true; toml.enable = true;