Add grammar/style checker to neomutt
This commit is contained in:
parent
e0b3200645
commit
55f89c4e0a
4 changed files with 243 additions and 43 deletions
60
flake.nix
60
flake.nix
|
|
@ -84,7 +84,7 @@
|
|||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } (
|
||||
{ withSystem, ... }:
|
||||
{ config, withSystem, ... }:
|
||||
{
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
|
|
@ -100,6 +100,35 @@
|
|||
./nix-on-droid/flake-module.nix
|
||||
./nixos/flake-module.nix
|
||||
];
|
||||
dictionary = [
|
||||
"ASLR"
|
||||
"Boycat"
|
||||
"DLR"
|
||||
"Floorp"
|
||||
"gpg"
|
||||
"Guix"
|
||||
"Haseeb"
|
||||
"iterm"
|
||||
"JMAP"
|
||||
"Jujutsu"
|
||||
"lajp"
|
||||
"LanguageTool"
|
||||
"LicenseRef"
|
||||
"LLMs"
|
||||
"LTeX"
|
||||
"Majid"
|
||||
"MatthewCroughan"
|
||||
"MWMBL"
|
||||
"Niri"
|
||||
"Nix"
|
||||
"Reece"
|
||||
"TODO"
|
||||
"TrackMeNot"
|
||||
"twiter"
|
||||
"UTD"
|
||||
"Vivado"
|
||||
"Xilinx"
|
||||
];
|
||||
profiles =
|
||||
let
|
||||
name = "Ethan Reece";
|
||||
|
|
@ -206,34 +235,7 @@
|
|||
languages = {
|
||||
en-us = {
|
||||
enable = true;
|
||||
dictionary = [
|
||||
"ASLR"
|
||||
"Boycat"
|
||||
"DLR"
|
||||
"Floorp"
|
||||
"Guix"
|
||||
"Haseeb"
|
||||
"iterm"
|
||||
"JMAP"
|
||||
"Jujutsu"
|
||||
"lajp"
|
||||
"LanguageTool"
|
||||
"LicenseRef"
|
||||
"LLMs"
|
||||
"LTeX"
|
||||
"Majid"
|
||||
"MatthewCroughan"
|
||||
"MWMBL"
|
||||
"Niri"
|
||||
"Nix"
|
||||
"Reece"
|
||||
"TODO"
|
||||
"TrackMeNot"
|
||||
"twiter"
|
||||
"UTD"
|
||||
"Vivado"
|
||||
"Xilinx"
|
||||
];
|
||||
dictionary = config.dictionary;
|
||||
excludes = [
|
||||
".sops.yaml"
|
||||
"sops/*"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
inputs.stylix.homeModules.stylix
|
||||
./browser.nix
|
||||
./desktop.nix
|
||||
./editor.nix
|
||||
./media.nix
|
||||
./secrets.nix
|
||||
./shell.nix
|
||||
|
|
@ -41,7 +42,6 @@
|
|||
kitty.variant256Colors = true;
|
||||
bat.enable = false;
|
||||
fzf.enable = false;
|
||||
helix.enable = false;
|
||||
qt.enable = false;
|
||||
starship.enable = false;
|
||||
};
|
||||
|
|
@ -161,19 +161,6 @@
|
|||
vim = {
|
||||
enable = true;
|
||||
};
|
||||
# TODO: Disable Guix integration
|
||||
# password-store = {
|
||||
# enable = true;
|
||||
# };
|
||||
helix = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
settings = {
|
||||
editor.soft-wrap = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
delta = {
|
||||
|
|
|
|||
204
home-manager/editor.nix
Normal file
204
home-manager/editor.nix
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{
|
||||
config,
|
||||
flakeConfig,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# SPDX-SnippetBegin
|
||||
# SPDX-License-Identifier: MIT
|
||||
# SPDX-SnippetCopyrightText: 2003-2025 Eelco Dolstra and the Nixpkgs/NixOS contributors <https://github.com/NixOS/nixpkgs/blob/92c2e04a475523e723c67ef872d8037379073681/pkgs/by-name/va/vale/styles.nix#L9>
|
||||
buildStyle =
|
||||
{
|
||||
name,
|
||||
stylePath ? name,
|
||||
...
|
||||
}@args:
|
||||
pkgs.stdenvNoCC.mkDerivation (
|
||||
{
|
||||
pname = "vale-style-${lib.toLower name}";
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
doCheck = false;
|
||||
dontFixup = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/share/vale/styles
|
||||
cp -R ${stylePath} "$out/share/vale/styles/${name}"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# passthru.updateScript = nix-update-script { };
|
||||
# TODO: https://github.com/Mic92/nix-update
|
||||
|
||||
meta = {
|
||||
platforms = lib.platforms.all;
|
||||
maintainers = with lib.maintainers; [ katexochen ];
|
||||
}
|
||||
// (args.meta or { });
|
||||
}
|
||||
// removeAttrs args [
|
||||
"meta"
|
||||
"name"
|
||||
]
|
||||
);
|
||||
# SPDX-SnippetEnd
|
||||
tomlFormatter = pkgs.formats.toml { };
|
||||
vale = {
|
||||
dictionary = rec {
|
||||
name = "accept.txt";
|
||||
text = builtins.concatStringsSep "\n" flakeConfig.dictionary;
|
||||
path = pkgs.writeTextFile { inherit name text; };
|
||||
};
|
||||
config = rec {
|
||||
name = ".vale.ini";
|
||||
text = ''
|
||||
StylesPath = styles
|
||||
|
||||
MinAlertLevel = suggestion
|
||||
|
||||
Vocab = General
|
||||
|
||||
Packages = Joblint, RedHat, alex, proselint, Readability, write-good
|
||||
|
||||
[{**/neomutt-*}]
|
||||
BasedOnStyles = Vale, Joblint, RedHat, alex, Readability, proselint, write-good
|
||||
'';
|
||||
path = pkgs.writeTextFile { inherit name text; };
|
||||
};
|
||||
directory = {
|
||||
name = "share/vale";
|
||||
path = pkgs.buildEnv {
|
||||
name = "vale-config";
|
||||
paths = [
|
||||
(pkgs.linkFarm vale.directory.name [
|
||||
{
|
||||
name = "${vale.directory.name}/${vale.config.name}";
|
||||
path = vale.config.path;
|
||||
}
|
||||
{
|
||||
name = "${vale.directory.name}/styles/config/vocabularies/General/${vale.dictionary.name}";
|
||||
path = vale.dictionary.path;
|
||||
}
|
||||
])
|
||||
pkgs.valeStyles.alex
|
||||
pkgs.valeStyles.joblint
|
||||
pkgs.valeStyles.proselint
|
||||
pkgs.valeStyles.readability
|
||||
pkgs.valeStyles.write-good
|
||||
(buildStyle rec {
|
||||
name = "RedHat";
|
||||
version = "608";
|
||||
stylePath = ".vale/styles/${name}";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "redhat-documentation";
|
||||
repo = "vale-at-red-hat";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-jAAWb0QHhk7UyfqKa9tUByyG11W/hlHESgywqinFiT4=";
|
||||
};
|
||||
meta = {
|
||||
description = "Vale-compatible implementation of the Red Hat Style Guide";
|
||||
homepage = "https://github.com/vale-at-red-hat/redhat-documentation";
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
})
|
||||
# TODO: Integrate with `nix-flake-base` somehow
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
typos = rec {
|
||||
# https://github.com/crate-ci/typos/blob/master/docs/reference.md
|
||||
dictionary = builtins.listToAttrs (
|
||||
builtins.map (x: {
|
||||
name = x;
|
||||
value = x;
|
||||
}) flakeConfig.dictionary
|
||||
);
|
||||
content = {
|
||||
default = {
|
||||
extend-words = dictionary;
|
||||
extend-identifiers = dictionary;
|
||||
extend-ignore-re = [
|
||||
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"
|
||||
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on"
|
||||
"(#|//)\\s*spellchecker:ignore-next-line\\n.*"
|
||||
"(?Rm)^.*<!--\\s*spellchecker:disable-line\\s*-->.*$"
|
||||
"(?s)<!--\\s*spellchecker:off\\s*-->.*?<!--\\s*spellchecker:on\\s*-->"
|
||||
"<!--\\s*spellchecker:ignore-next-line\\s*-->\\n.*"
|
||||
];
|
||||
};
|
||||
# files.extend-exclude = config.languages.${module-name}.excludes;
|
||||
};
|
||||
file = tomlFormatter.generate "typos.toml" content;
|
||||
};
|
||||
harper = {
|
||||
dictionary = rec {
|
||||
name = "dictionary.txt";
|
||||
text = builtins.concatStringsSep "\n" flakeConfig.dictionary;
|
||||
path = pkgs.writeTextFile { inherit name text; };
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
stylix = {
|
||||
targets = {
|
||||
helix.enable = false;
|
||||
};
|
||||
};
|
||||
programs = {
|
||||
helix = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
settings = {
|
||||
editor.soft-wrap = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
languages = {
|
||||
language-server = {
|
||||
ltex-ls-plus = {
|
||||
command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus";
|
||||
config.ltex = {
|
||||
dictionary.en-US = flakeConfig.dictionary;
|
||||
additionalRules.enablePickyRules = true;
|
||||
};
|
||||
};
|
||||
vale-ls = {
|
||||
command = "${pkgs.vale-ls}/bin/vale-ls";
|
||||
config.configPath = "${vale.directory.path}/${vale.directory.name}/${vale.config.name}";
|
||||
};
|
||||
harper-ls = {
|
||||
command = "${pkgs.harper}/bin/harper-ls";
|
||||
config.harper-ls.userDictPath = harper.dictionary.path;
|
||||
};
|
||||
typos = {
|
||||
command = "${pkgs.typos-lsp}/bin/typos-lsp";
|
||||
config.config = typos.file.outPath;
|
||||
};
|
||||
};
|
||||
language = [
|
||||
{
|
||||
name = "en-us_email";
|
||||
scope = "source.txt";
|
||||
file-types = [ { glob = "neomutt-*"; } ];
|
||||
language-servers = [
|
||||
"ltex-ls-plus"
|
||||
"vale-ls"
|
||||
"typos"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -5,6 +5,13 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
options = {
|
||||
dictionary = lib.mkOption {
|
||||
description = ''
|
||||
Dictionary.
|
||||
'';
|
||||
default = [ ];
|
||||
type = lib.types.listOf lib.types.str;
|
||||
};
|
||||
profiles = lib.mkOption {
|
||||
description = ''
|
||||
Profiles for Flake configurations.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue