From 91764a64883f53c35f8e7b84d19660eb52493b89 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 22 May 2019 03:56:40 -0300 Subject: Setup hunspell spellchecking to run against HTML output --- default.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'default.nix') 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" '' -- cgit v1.2.3