Skip to content

Commit

Permalink
Add documentation.strict flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tfc committed Mar 27, 2024
1 parent c24fd64 commit 1754864
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@
};
};

documentation.mkdocs-root = ./documentation;
documentation = {
mkdocs-root = ./documentation;
strict = true;
};

apps = {
default = {
Expand Down
9 changes: 6 additions & 3 deletions modules/documentation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

let
cfg = config.documentation;

strict = lib.optionalString cfg.strict "--strict";
in

{
Expand All @@ -17,19 +19,20 @@ in
default = mkdocs-flake.withSystem system ({ config, ... }: config.packages.mkdocs);
description = lib.mdDoc "The mkdocs package to use.";
};

strict = lib.mkEnableOption "build the documentation with `--strict`";
};

config = lib.mkIf (cfg.mkdocs-root != null) {
packages.documentation = pkgs.runCommand "mkdocs-flake-documentation" {} ''
cp -r ${cfg.mkdocs-root}/* .
${cfg.mkdocs-package}/bin/mkdocs build --strict
mv site $out
${cfg.mkdocs-package}/bin/mkdocs build ${strict} --site-dir $out
'';

apps.watch-documentation = {
type = "app";
program = pkgs.writeScriptBin "mkdocs-watch" ''
${cfg.mkdocs-package}/bin/mkdocs serve
${cfg.mkdocs-package}/bin/mkdocs serve ${strict}
'';
};
};
Expand Down

0 comments on commit 1754864

Please sign in to comment.