make building the manuals optional

since we currently can't fetch the manuals as a tarball from Hydra, we
have to evaluate all the Nix releases under the sun, which takes quite
a while. most of the time this is not needed and is in the way to work
on the site, so disable it by default.
This commit is contained in:
Valentin Gagarin 2024-08-15 11:43:06 +02:00
parent 174bdff866
commit ec7b0e9fbb
3 changed files with 16 additions and 3 deletions

View File

@ -20,7 +20,7 @@ jobs:
- name: Build
run: |
nix-build
nix-build --arg withManuals true
# The netlify action doesn't follow symlinks properly.
mkdir ./dist

View File

@ -27,6 +27,16 @@ To manually test [redirects](./_redirects):
[nix-shell:nix.dev]$ netlify dev -d result
```
## Building the reference manuals
By default nix.dev builds without the various versions of the Nix reference manual, as that takes quite a while due to how it's currently implemented.
To enable building the manuals:
```shell-session
[nix-shell:nix.dev]$ nix-build -A build --arg withManuals true
[nix-shell:nix.dev]$ devmode --arg withManuals true
```
## Updating reference manuals
With the current setup, the [Nix manual hosted on nix.dev](https://nix.dev/reference/nix-manual) does not get updated automatically with new releases.

View File

@ -6,6 +6,7 @@
overlays = [ (import ./nix/overlay.nix) ];
inherit system;
},
withManuals ? false, # building the manuals is expensive
}:
let
lib = pkgs.lib;
@ -34,7 +35,7 @@ let
};
in
''
cp -f ${substitutedNixManualReference} source/reference/nix-manual.md
${lib.optionalString withManuals "cp -f ${substitutedNixManualReference} source/reference/nix-manual.md"}
make html
'';
installPhase =
@ -62,6 +63,7 @@ let
''
mkdir -p $out/manual/nix
cp -R build/html/* $out/
'' + lib.optionalString withManuals ''
${lib.concatStringsSep "\n" (lib.mapAttrsToList release releases.nixReleases)}
${lib.concatStringsSep "\n" (lib.mapAttrsToList mutableRedirect releases.mutableNixManualRedirects)}
'';
@ -76,12 +78,13 @@ let
from livereload import Server
from subprocess import Popen, PIPE
import shlex
import sys
server = Server()
def nix_build():
p = Popen(
shlex.split("nix-build -A build"),
shlex.split("nix-build -A build") + sys.argv[1:],
# capture output as text
stdout=PIPE,
stderr=PIPE,