From a130d70f832e59799a2e86c1f8ff063b0fef9daa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Reynier?= <loic@loicreynier.fr>
Date: Tue, 26 Mar 2024 13:37:51 +0000
Subject: [PATCH] Fix typos and add pre-commit check

---
 .typos.toml       | 3 +++
 modules/hook.nix  | 2 +-
 modules/hooks.nix | 8 ++++----
 nix/default.nix   | 1 +
 4 files changed, 9 insertions(+), 5 deletions(-)
 create mode 100644 .typos.toml

diff --git a/.typos.toml b/.typos.toml
new file mode 100644
index 00000000..60efd63e
--- /dev/null
+++ b/.typos.toml
@@ -0,0 +1,3 @@
+[default.extend-words]
+edn = "edn"             # `cljfmt` option
+mosquitto = "mosquitto" # `typos` example
diff --git a/modules/hook.nix b/modules/hook.nix
index 3c353e46..d6195893 100644
--- a/modules/hook.nix
+++ b/modules/hook.nix
@@ -50,7 +50,7 @@ in
         ''
           An optional package that provides the hook.
 
-          For most hooks, the package name matches the name of the hook and can be overriden directly.
+          For most hooks, the package name matches the name of the hook and can be overridden directly.
 
           ```
           hooks.nixfmt.package = pkgs.nixfmt;
diff --git a/modules/hooks.nix b/modules/hooks.nix
index 70b99009..0805ceba 100644
--- a/modules/hooks.nix
+++ b/modules/hooks.nix
@@ -1450,14 +1450,14 @@ in
             quiet =
               mkOption {
                 type = types.bool;
-                description = lib.mdDoc "Less output per occurence.";
+                description = lib.mdDoc "Less output per occurrence.";
                 default = false;
               };
 
             verbose =
               mkOption {
                 type = types.bool;
-                description = lib.mdDoc "More output per occurence.";
+                description = lib.mdDoc "More output per occurrence.";
                 default = false;
               };
 
@@ -2301,7 +2301,7 @@ in
         };
       lychee = {
         name = "lychee";
-        description = "A fast, async, stream-based link checker that finds broken hyperlinks and mail adresses inside Markdown, HTML, reStructuredText, or any other text file or website.";
+        description = "A fast, async, stream-based link checker that finds broken hyperlinks and mail addresses inside Markdown, HTML, reStructuredText, or any other text file or website.";
         package = tools.lychee;
         entry =
           let
@@ -2925,7 +2925,7 @@ in
         package = tools.vale;
         entry =
           let
-            # TODO: was .vale.ini, throwed error in Nix
+            # TODO: was .vale.ini, threw error in Nix
             configFile = builtins.toFile "vale.ini" "${hooks.vale.settings.config}";
             cmdArgs =
               mkCmdArgs
diff --git a/nix/default.nix b/nix/default.nix
index edbb0924..26b6a6a4 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -23,6 +23,7 @@ let
           hooks = {
             shellcheck.enable = true;
             nixpkgs-fmt.enable = true;
+            typos.enable = true;
           };
         };
         all-tools-eval =