|
28 | 28 | pkgs.perl |
29 | 29 | ]; |
30 | 30 | # generated with nix run github:rgri/tex2nix -- *.tex *.sty |
31 | | - nix-dev-latex = [ (pkgs.callPackage ./nix/tex-env.nix { |
32 | | - extraTexPackages = { |
33 | | - inherit (pkgs.texlive) latexmk gnu-freefont; |
34 | | - }; |
35 | | - }) ]; |
36 | | - nix-dev = |
37 | | - pkgs.stdenv.mkDerivation { |
38 | | - name = "nix-dev"; |
39 | | - src = ./.; |
40 | | - nativeBuildInputs = [ |
41 | | - nix-dev-python-pkgs |
42 | | - nix-dev-latex |
43 | | - ]; |
44 | | - buildPhase = |
45 | | - let |
46 | | - substitutedNixManualReference = pkgs.substitute { |
47 | | - src = ./source/reference/nix-manual.md; |
48 | | - substitutions = lib.concatLists (lib.mapAttrsToList (from: to: [ "--subst-var-by" from to ]) releases.substitutions); |
49 | | - }; |
50 | | - in |
51 | | - '' |
52 | | - ${lib.optionalString withManuals "cp -f ${substitutedNixManualReference} source/reference/nix-manual.md"} |
53 | | - make html |
54 | | - make latexpdf |
55 | | - ''; |
56 | | - installPhase = |
57 | | - let |
58 | | - # Various versions of the Nix manuals, grep for (nix-manual)= to find where they are displayed. |
59 | | - # FIXME: This requires human interaction to update! See ./CONTRIBUTING.md for details. |
60 | | - release = version: nix: '' |
61 | | - cp -R --no-preserve=mode ${nix.doc}/share/doc/nix/manual $out/manual/nix/${version} |
| 31 | + nix-dev-latex = [ |
| 32 | + (pkgs.callPackage ./nix/tex-env.nix { |
| 33 | + extraTexPackages = { |
| 34 | + inherit (pkgs.texlive) latexmk gnu-freefont; |
| 35 | + }; |
| 36 | + }) |
| 37 | + ]; |
| 38 | + nix-dev = pkgs.stdenv.mkDerivation { |
| 39 | + name = "nix-dev"; |
| 40 | + src = ./.; |
| 41 | + nativeBuildInputs = [ |
| 42 | + nix-dev-python-pkgs |
| 43 | + nix-dev-latex |
| 44 | + ]; |
| 45 | + buildPhase = |
| 46 | + let |
| 47 | + substitutedNixManualReference = pkgs.substitute { |
| 48 | + src = ./source/reference/nix-manual.md; |
| 49 | + substitutions = lib.concatLists ( |
| 50 | + lib.mapAttrsToList (from: to: [ |
| 51 | + "--subst-var-by" |
| 52 | + from |
| 53 | + to |
| 54 | + ]) releases.substitutions |
| 55 | + ); |
| 56 | + }; |
| 57 | + in |
| 58 | + '' |
| 59 | + ${lib.optionalString withManuals "cp -f ${substitutedNixManualReference} source/reference/nix-manual.md"} |
| 60 | + make html |
| 61 | + make latexpdf |
| 62 | + ''; |
| 63 | + installPhase = |
| 64 | + let |
| 65 | + # Various versions of the Nix manuals, grep for (nix-manual)= to find where they are displayed. |
| 66 | + # FIXME: This requires human interaction to update! See ./CONTRIBUTING.md for details. |
| 67 | + release = version: nix: '' |
| 68 | + cp -R --no-preserve=mode ${nix.doc}/share/doc/nix/manual $out/manual/nix/${version} |
62 | 69 |
|
63 | | - # add upstream page redirects of the form `<from> <to> <status>`, excluding comments and empty lines |
64 | | - # not all releases have that though |
65 | | - if [[ -f ${nix.doc}/share/doc/nix/manual/_redirects ]]; then |
66 | | - sed '/^#/d;/^$/d;s#^\(.*\) \(.*\) #/manual/nix/${version}\1 /manual/nix/${version}\2 #g' ${nix.doc}/share/doc/nix/manual/_redirects >> $out/_redirects |
67 | | - fi |
| 70 | + # add upstream page redirects of the form `<from> <to> <status>`, excluding comments and empty lines |
| 71 | + # not all releases have that though |
| 72 | + if [[ -f ${nix.doc}/share/doc/nix/manual/_redirects ]]; then |
| 73 | + sed '/^#/d;/^$/d;s#^\(.*\) \(.*\) #/manual/nix/${version}\1 /manual/nix/${version}\2 #g' ${nix.doc}/share/doc/nix/manual/_redirects >> $out/_redirects |
| 74 | + fi |
68 | 75 |
|
69 | | - # provide a single-page view from mdBook's print feature. |
70 | | - # this is hacky but cheap and does work. |
71 | | - sed -z 's|\s*window\.addEventListener(\x27load\x27, function() {\s*window\.setTimeout(window.print, 100);\s*});||g' ${nix.doc}/share/doc/nix/manual/print.html > $out/manual/nix/${version}/nix-${version}.html |
72 | | - ''; |
73 | | - # Redirects from mutable URLs like /manual/nix/latest/... to /manual/nix/2.21/... |
74 | | - mutableRedirect = mutable: immutable: '' |
75 | | - echo "/manual/nix/${mutable}/* /manual/nix/${immutable}/:splat 302" >> $out/_redirects |
76 | | - ''; |
77 | | - in |
78 | | - '' |
79 | | - mkdir -p $out/manual/nix |
80 | | - cp -R build/html/* $out/ |
81 | | - cp build/latex/nix-dev.pdf $out/ |
82 | | - cp netlify.toml $out/ |
83 | | - '' + lib.optionalString withManuals '' |
84 | | - ${lib.concatStringsSep "\n" (lib.mapAttrsToList release releases.nixReleases)} |
85 | | - ${lib.concatStringsSep "\n" (lib.mapAttrsToList mutableRedirect releases.mutableNixManualRedirects)} |
| 76 | + # provide a single-page view from mdBook's print feature. |
| 77 | + # this is hacky but cheap and does work. |
| 78 | + sed -z 's|\s*window\.addEventListener(\x27load\x27, function() {\s*window\.setTimeout(window.print, 100);\s*});||g' ${nix.doc}/share/doc/nix/manual/print.html > $out/manual/nix/${version}/nix-${version}.html |
86 | 79 | ''; |
87 | | - }; |
| 80 | + # Redirects from mutable URLs like /manual/nix/latest/... to /manual/nix/2.21/... |
| 81 | + mutableRedirect = mutable: immutable: '' |
| 82 | + echo "/manual/nix/${mutable}/* /manual/nix/${immutable}/:splat 302" >> $out/_redirects |
| 83 | + ''; |
| 84 | + in |
| 85 | + '' |
| 86 | + mkdir -p $out/manual/nix |
| 87 | + cp -R build/html/* $out/ |
| 88 | + cp build/latex/nix-dev.pdf $out/ |
| 89 | + cp netlify.toml $out/ |
| 90 | + '' |
| 91 | + + lib.optionalString withManuals '' |
| 92 | + ${lib.concatStringsSep "\n" (lib.mapAttrsToList release releases.nixReleases)} |
| 93 | + ${lib.concatStringsSep "\n" (lib.mapAttrsToList mutableRedirect releases.mutableNixManualRedirects)} |
| 94 | + ''; |
| 95 | + }; |
88 | 96 |
|
89 | 97 | devmode = pkgs.devmode.override { |
90 | 98 | buildArgs = ''-A build --show-trace''; |
|
0 commit comments