blob: c20c47efa1c499e11a27bc515a3b913d831c5214 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
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;
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
baseName = "website";
};
jekyllEnv = pkgs.bundlerEnv {
name = "jekyll-env";
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
subtasks = rec {
hunspellCheck = utils.baseTask.overrideAttrs (baseAttrs: {
name = "${baseAttrs.name}-hunspell";
buildInputs = baseAttrs.buildInputs ++ [ myHunspell ];
buildPhase = ''
patchShebangs .
./spelling/check-spelling.sh "${subtasks.docs}"
touch $out
'';
});
assertContent = utils.baseTask.overrideAttrs (baseAttrs: {
name = "${baseAttrs.name}-assert-content";
buildInputs = baseAttrs.buildInputs ++ [ pkgs.jq ];
buildPhase = ''
patchShebangs .
./scripts/assert-content.sh "${subtasks.docs}/site.json"
touch $out
'';
});
docs = utils.baseTask.overrideAttrs (baseAttrs: {
name = "${baseAttrs.name}-docs";
buildInputs = [ jekyllEnv ];
buildPhase = ''
patchShebangs .
jekyll build -d $out
'';
});
};
test = utils.test [
utils.formatNix
(utils.shellcheck null)
(utils.fixme [
"utils.nix"
"TODOs.org"
"_pastebins/"
"_posts/"
"_tils/"
"drafts/"
"templates/"
])
subtasks.hunspellCheck
subtasks.assertContent
subtasks.docs
];
shell = pkgs.mkShell rec {
name = "website-shell";
buildInputs = [ jekyllEnv myHunspell ];
};
publishScript = utils.overwritingPublishScript {
docsDerivation = subtasks.docs;
overwrite = true;
};
fastPublishScript = utils.overwritingPublishScript {
docsDerivation = subtasks.docs;
overwrite = false;
};
}
|