Skip to content

Commit aef7822

Browse files
use upstream page redirects for Nix manual
this currently won't build because the pinned versions don't have the redirects yet, and bumping them would require an expensive local build that may fail as it does for Hydra.
1 parent 3569f20 commit aef7822

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

default.nix

+9-4
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,27 @@ let
3030
# Various versions of the Nix manuals, grep for (nix-manual)=
3131
# FIXME: This requires human interaction to update!
3232
# See ./CONTRIBUTING.md for details.
33+
# Using Nix from Nixpkgs could simplify handling, but would requires a bit more setup here
3334
releases = [
3435
"2.19"
3536
"2.18"
3637
"2.13"
3738
];
3839
inputName = version: pkgs.lib.strings.replaceStrings [ "." ] [ "-" ] version;
39-
src = version: (import inputs."nix_${inputName version}").default.doc;
40+
src = version: inputs."nix_${inputName version}";
41+
manual = version: (import (src version)).default.doc;
4042
copy = version: ''
41-
cp -R ${src version}/share/doc/nix/manual/* $out/manual/nix/${version}
43+
cp -Rf ${manual version}/share/doc/nix/manual/* $out/manual/nix/${version}
44+
# use upstream page redirects
45+
sed 's#^\(.*\) \(.*\) #/manual/nix/${version}\1 /manual/nix/${version}\2 #g' ${src version}/doc/manual/_redirects >> $out/_redirects
4246
'';
4347
in
4448
with pkgs.lib.strings;
4549
''
46-
mkdir -p $out/manual/nix/{${concatStringsSep "," releases}}
47-
${concatStringsSep "\n" (map copy releases)}
50+
# NOTE: the comma in the shell expansion makes it also work for singleton lists
51+
mkdir -p $out/manual/nix/{${concatStringsSep "," releases},}
4852
cp -R build/html/* $out/
53+
${concatStringsSep "\n" (map copy releases)}
4954
'';
5055
};
5156

0 commit comments

Comments
 (0)