blob: 0f98063745bca8c64aef1936d13d5032deda94af (
plain) (
tree)
|
|
let pkgs = import <nixpkgs> { };
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
++ [ (pkgs.hunspellWithDicts (with pkgs.hunspellDicts; [ en-us ])) ];
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 pkgs.html-tidy ];
buildPhase = ''
jekyll build -d $out
find $out -type f -name '*.html' | xargs -I{} tidy -errors -utf8 -indent -modify {}
'';
});
};
test = utils.test [
utils.formatNix
(utils.shellcheck null)
(utils.fixme null)
subtasks.hunspellCheck
subtasks.assertContent
];
shell = pkgs.mkShell rec {
name = "website-shell";
buildInputs = [
jekyllEnv
(pkgs.hunspellWithDicts (with pkgs.hunspellDicts; [ en-us ]))
pkgs.html-tidy
];
};
publishScript = utils.overwritingPublishScript {
docsDerivation = subtasks.docs;
overwrite = false;
};
}
|