Nixify the documentation build

This commit is contained in:
Antoine Eiche 2021-07-23 21:25:14 +02:00
parent 68b9397a30
commit 42db23553d
1 changed files with 26 additions and 0 deletions

View File

@ -56,6 +56,10 @@
modules = [ modules = [
mailserverModule mailserverModule
{ {
# Because the blockbook package is currently broken (we
# don't care about this package but it is part of the
# NixOS module evaluation)
nixpkgs.config.allowBroken = true;
mailserver.fqdn = "mx.example.com"; mailserver.fqdn = "mx.example.com";
} }
]; ];
@ -84,11 +88,33 @@
echo "test: ok" > $out echo "test: ok" > $out
''; '';
documentation = pkgs.stdenv.mkDerivation {
name = "documentation";
src = pkgs.lib.sourceByRegex ./docs ["logo.png" "conf.py" "Makefile" ".*rst$"];
buildInputs = [(
pkgs.python3.withPackages(p: [
p.sphinx
p.sphinx_rtd_theme
])
)];
buildPhase = ''
cp ${generateRstOptions} options.rst
mkdir -p _static
# Workaround for https://github.com/sphinx-doc/sphinx/issues/3451
export SOURCE_DATE_EPOCH=$(${pkgs.coreutils}/bin/date +%s)
make html
'';
installPhase = ''
cp -r _build/html $out
'';
};
in rec { in rec {
nixosModules.mailserver = mailserverModule ; nixosModules.mailserver = mailserverModule ;
nixosModule = self.nixosModules.mailserver; nixosModule = self.nixosModules.mailserver;
hydraJobs.${system} = allTests // { hydraJobs.${system} = allTests // {
test-rst-options = testRstOptions; test-rst-options = testRstOptions;
inherit documentation;
}; };
checks.${system} = allTests; checks.${system} = allTests;
devShell.${system} = pkgs.mkShell { devShell.${system} = pkgs.mkShell {