|
67 | 67 | description = "Runtime inputs of mkdocs. Allows to make additional tools available when building the documentation."; |
68 | 68 | }; |
69 | 69 |
|
| 70 | + overrideAttrs = lib.mkOption { |
| 71 | + type = lib.types.raw; |
| 72 | + default = _final: _prev: { }; |
| 73 | + defaultText = "final: prev: {}"; |
| 74 | + example = '' |
| 75 | + final: prev: { |
| 76 | + requiredSystemFeatures = [ "recursive-nix" ]; |
| 77 | + NIX_CONFIG = ''' |
| 78 | + experimental-features = nix-command recursive-nix |
| 79 | + store = unix:///build/.nix-socket |
| 80 | + substituters = unix:///build/.nix-socket |
| 81 | + '''; |
| 82 | + } |
| 83 | + ''; |
| 84 | + description = "Extension (`overrideAttrs`) for the `documentation` derivation."; |
| 85 | + }; |
| 86 | + |
70 | 87 | strict = lib.mkEnableOption '' |
71 | 88 | Build the documentation with `--strict` |
72 | 89 |
|
|
106 | 123 | # so we link to the project from the build dir. |
107 | 124 | # the hook allows the user to prepopulate font files to help avoid mkdocs |
108 | 125 | # connecting to the internet. |
109 | | - packages.documentation = pkgs.runCommand "mkdocs-flake-documentation" { } '' |
110 | | - cd ${abs_docs_dir} |
111 | | - mkdocs_args=( |
112 | | - --site-dir $out |
113 | | - ${strict} |
114 | | - ) |
115 | | - config_file=${lib.optionalString (configFile != null) (toString configFile)} |
116 | | - if [[ ! -z "$config_file" ]]; then |
117 | | - mkdocs_args+=( |
118 | | - --config-file "$config_file" |
| 126 | + packages.documentation = |
| 127 | + (pkgs.runCommand "mkdocs-flake-documentation" { } '' |
| 128 | + cd ${abs_docs_dir} |
| 129 | + mkdocs_args=( |
| 130 | + --site-dir $out |
| 131 | + ${strict} |
119 | 132 | ) |
120 | | - if [[ -f mkdocs.yml ]]; then |
121 | | - 2>&1 echo 'warning: local file `mkdocs.yml'"'"' ignored due to `documentation.settings'"'" |
| 133 | + config_file=${lib.optionalString (configFile != null) (toString configFile)} |
| 134 | + if [[ ! -z "$config_file" ]]; then |
| 135 | + mkdocs_args+=( |
| 136 | + --config-file "$config_file" |
| 137 | + ) |
| 138 | + if [[ -f mkdocs.yml ]]; then |
| 139 | + 2>&1 echo 'warning: local file `mkdocs.yml'"'"' ignored due to `documentation.settings'"'" |
| 140 | + fi |
| 141 | + elif [[ -f mkdocs.yml ]]; then |
| 142 | + mkdocs_args+=( |
| 143 | + --config-file mkdocs.yml |
| 144 | + ) |
122 | 145 | fi |
123 | | - elif [[ -f mkdocs.yml ]]; then |
124 | | - mkdocs_args+=( |
125 | | - --config-file mkdocs.yml |
126 | | - ) |
127 | | - fi |
128 | | - eval "${cfg.mkdocs-preBuildHook}" |
129 | | - ${cfg.mkdocs-package}/bin/mkdocs build "''${mkdocs_args[@]}" |
130 | | - ''; |
| 146 | + eval "${cfg.mkdocs-preBuildHook}" |
| 147 | + ${cfg.mkdocs-package}/bin/mkdocs build "''${mkdocs_args[@]}" |
| 148 | + '').overrideAttrs |
| 149 | + cfg.overrideAttrs; |
131 | 150 |
|
132 | 151 | apps.watch-documentation = { |
133 | 152 | type = "app"; |
|
0 commit comments