Skip to content

Commit 3ab69e3

Browse files
use upstream page redirects for Nix manual
1 parent 3569f20 commit 3ab69e3

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

Diff for: _redirects

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# format documentation:
2+
# - https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file
3+
# - https://docs.netlify.com/routing/redirects/redirect-options/
4+
15
/tutorials/install-nix /install-nix 301
26
/anti-patterns/language /recipes/best-practices 301
37
/faq /recipes/faq 301

Diff for: default.nix

+10-7
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,28 @@ let
2727
'';
2828
installPhase =
2929
let
30-
# Various versions of the Nix manuals, grep for (nix-manual)=
31-
# FIXME: This requires human interaction to update!
32-
# See ./CONTRIBUTING.md for details.
30+
# Various versions of the Nix manuals, grep for (nix-manual)= to find where they are displayed
31+
# FIXME: This requires human interaction to update! See ./CONTRIBUTING.md for details.
3332
releases = [
3433
"2.19"
3534
"2.18"
3635
"2.13"
3736
];
3837
inputName = version: pkgs.lib.strings.replaceStrings [ "." ] [ "-" ] version;
39-
src = version: (import inputs."nix_${inputName version}").default.doc;
38+
src = version: inputs."nix_${inputName version}";
39+
manual = version: (import (src version)).default.doc;
4040
copy = version: ''
41-
cp -R ${src version}/share/doc/nix/manual/* $out/manual/nix/${version}
41+
cp -Rf ${manual version}/share/doc/nix/manual/* $out/manual/nix/${version}
42+
# add upstream page redirects of the form `<from> <to> <status>`, excluding comment lines
43+
sed '/^#/d;/^$/d;s#^\(.*\) \(.*\) #/manual/nix/${version}\1 /manual/nix/${version}\2 #g' ${src version}/doc/manual/_redirects >> $out/_redirects
4244
'';
4345
in
4446
with pkgs.lib.strings;
4547
''
46-
mkdir -p $out/manual/nix/{${concatStringsSep "," releases}}
47-
${concatStringsSep "\n" (map copy releases)}
48+
# NOTE: the comma in the shell expansion makes it also work for singleton lists
49+
mkdir -p $out/manual/nix/{${concatStringsSep "," releases},}
4850
cp -R build/html/* $out/
51+
${concatStringsSep "\n" (map copy releases)}
4952
'';
5053
};
5154

Diff for: nix/sources.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"homepage": "https://nixos.org/",
66
"owner": "nixos",
77
"repo": "nix",
8-
"rev": "56eb17906822f14bb348017315cb1ca643da900a",
9-
"sha256": "1k0x63l9crkrhdgdclcx8mp6r9mcp4brs67l6hsii1ag8gy2gmj4",
8+
"rev": "25f2dfc6e41d8c30e7abc443a7b262e34e49253b",
9+
"sha256": "0lbp6yq92wpzi7kihbbma8d1c6q33msw95y0kmirfiikd8yvpvs7",
1010
"type": "tarball",
11-
"url": "https://github.com/nixos/nix/archive/56eb17906822f14bb348017315cb1ca643da900a.tar.gz",
11+
"url": "https://github.com/nixos/nix/archive/25f2dfc6e41d8c30e7abc443a7b262e34e49253b.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
1414
"nix_2-18": {
@@ -17,10 +17,10 @@
1717
"homepage": "https://nixos.org/",
1818
"owner": "nixos",
1919
"repo": "nix",
20-
"rev": "f5f4de6a550327b4b1a06123c2e450f1b92c73b6",
21-
"sha256": "1g23sxsh9aj7sard5d3ijqfjqbh4fvlvyr73sj3dcdzcqiys5naq",
20+
"rev": "60eb80593f3a18aebc7672ad7007cb23c14db061",
21+
"sha256": "0nyssab6skn9qd7mz4v0y3ycnhck7is6agm0i26l1anrgs90x37l",
2222
"type": "tarball",
23-
"url": "https://github.com/nixos/nix/archive/f5f4de6a550327b4b1a06123c2e450f1b92c73b6.tar.gz",
23+
"url": "https://github.com/nixos/nix/archive/60eb80593f3a18aebc7672ad7007cb23c14db061.tar.gz",
2424
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2525
},
2626
"nix_2-19": {
@@ -29,10 +29,10 @@
2929
"homepage": "https://nixos.org/",
3030
"owner": "nixos",
3131
"repo": "nix",
32-
"rev": "33bacbe220b49ceaaeb817354592a0102fbae087",
33-
"sha256": "17fjz3mxqcszxfzpj48f8rqzdqavnnpibpi0ssw7vxmyybrqsqly",
32+
"rev": "dc09e6193bffcab37d3d43107eae9464395ab51d",
33+
"sha256": "0n117h0jz3aih41mg0kns8v6rjhmrg7r6p8azl55p32zrj02zyvm",
3434
"type": "tarball",
35-
"url": "https://github.com/nixos/nix/archive/33bacbe220b49ceaaeb817354592a0102fbae087.tar.gz",
35+
"url": "https://github.com/nixos/nix/archive/dc09e6193bffcab37d3d43107eae9464395ab51d.tar.gz",
3636
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
3737
},
3838
"nixpkgs": {

0 commit comments

Comments
 (0)