diff options
author | EuAndreh <eu@euandre.org> | 2020-08-31 11:54:07 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-31 11:54:07 -0300 |
commit | 038f5713b8ca9dce79e17ac85e57ad1ce2644e09 (patch) | |
tree | 29d8e2cc23715028390484c6f85e7310ed4a5859 /default.nix | |
parent | Add missing timestamp on database post (diff) | |
download | euandre.org-038f5713b8ca9dce79e17ac85e57ad1ce2644e09.tar.gz euandre.org-038f5713b8ca9dce79e17ac85e57ad1ce2644e09.tar.xz |
Add spellchecking back to tests, with support for en, pt and fr dicts
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/default.nix b/default.nix index 2d35725..c20c47e 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,30 @@ let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") { }; + dicts = rec { + mkDict = let + prefix = + "https://raw.githubusercontent.com/wooorm/dictionaries/61016e00e276f9bf5e52cbc6c02a45f2e49b2c7e/dictionaries"; + in lang: + pkgs.stdenv.mkDerivation { + name = "songbooks-dict-${lang}"; + builder = builtins.toFile "builder.sh" '' + source $stdenv/setup + install -dm755 $out/share/hunspell + install -m644 ${ + builtins.fetchurl "${prefix}/${lang}/index.dic" + } $out/share/hunspell/${lang}.dic + install -m644 ${ + builtins.fetchurl "${prefix}/${lang}/index.aff" + } $out/share/hunspell/${lang}.aff + runHook postInstall + ''; + }; + pt = mkDict "pt"; + en = mkDict "en"; + fr = mkDict "fr"; + }; + myHunspell = (pkgs.hunspellWithDicts (with dicts; [ en pt fr ])); in rec { utils = import ./utils.nix { pkgs = pkgs; @@ -16,8 +40,7 @@ in rec { subtasks = rec { hunspellCheck = utils.baseTask.overrideAttrs (baseAttrs: { name = "${baseAttrs.name}-hunspell"; - buildInputs = baseAttrs.buildInputs - ++ [ (pkgs.hunspellWithDicts (with pkgs.hunspellDicts; [ en-us ])) ]; + buildInputs = baseAttrs.buildInputs ++ [ myHunspell ]; buildPhase = '' patchShebangs . ./spelling/check-spelling.sh "${subtasks.docs}" @@ -60,10 +83,7 @@ in rec { ]; shell = pkgs.mkShell rec { name = "website-shell"; - buildInputs = [ - jekyllEnv - (pkgs.hunspellWithDicts (with pkgs.hunspellDicts; [ en-us ])) - ]; + buildInputs = [ jekyllEnv myHunspell ]; }; publishScript = utils.overwritingPublishScript { docsDerivation = subtasks.docs; |