aboutsummaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-05-22 03:56:40 -0300
committerEuAndreh <eu@euandre.org>2019-05-22 03:58:44 -0300
commit91764a64883f53c35f8e7b84d19660eb52493b89 (patch)
treef9997e1bb2aa6e0288621a1299edcd20d02f1bdb /default.nix
parentAdd formatNix subtask and use it as buildInput for test derivation (diff)
downloadeuandre.org-91764a64883f53c35f8e7b84d19660eb52493b89.tar.gz
euandre.org-91764a64883f53c35f8e7b84d19660eb52493b89.tar.xz
Setup hunspell spellchecking to run against HTML output
Diffstat (limited to '')
-rw-r--r--default.nix23
1 files changed, 22 insertions, 1 deletions
diff --git a/default.nix b/default.nix
index 9a8af74..a5d6f4e 100644
--- a/default.nix
+++ b/default.nix
@@ -67,7 +67,26 @@ with pkgs.stdenv; rec {
name = "${baseAttrs.name}-nixfmt";
buildInputs = baseAttrs.buildInputs ++ [nixfmt];
buildPhase = ''
- diff <(nixfmt < default.nix) default.nix
+ diff <(nixfmt < default.nix) default.nix || {
+ echo "The default.nix is unformatted. To fix it, run:"
+ echo " nixfmt default.nix"
+ exit 1
+ }
+ touch $out
+ '';
+ });
+ hunspellCheck = baseTask.overrideAttrs (baseAttrs: {
+ name = "${baseAttrs.name}-hunspell";
+ buildInputs = baseAttrs.buildInputs
+ ++ [(hunspellWithDicts (with hunspellDicts; [en-us]))];
+ buildPhase = ''
+ DICT="spelling/en_US-dict.txt"
+ diff <(sort --ignore-case $DICT) $DICT || {
+ echo "The $DICT dictionary is unsorted. To fix it, run:"
+ echo " sort $DICT | sort --ignore-case | sponge $DICT"
+ exit 1
+ }
+
touch $out
'';
});
@@ -95,6 +114,7 @@ with pkgs.stdenv; rec {
subtasks.batsTest
subtasks.perlInternalTest
subtasks.formatNix
+ subtasks.hunspellCheck
];
buildPhase = ''
echo "Ran tests for:"
@@ -111,6 +131,7 @@ with pkgs.stdenv; rec {
websiteBuilder
(pkgs.haskellPackages.ghcWithPackages (p: with p; [hakyll]))
nixfmt
+ (hunspellWithDicts (with hunspellDicts; [en-us]))
];
};
publishScript = pkgs.writeShellScriptBin "publish.sh" ''