File tree 1 file changed +18
-8
lines changed
1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change 31
31
# FIXME: This requires human interaction to update!
32
32
# See ./CONTRIBUTING.md for details.
33
33
# Using Nix from Nixpkgs could simplify handling, but would requires a bit more setup here
34
- releases = [
35
- "2.19"
36
- "2.18"
37
- "2.13"
38
- ] ;
34
+ releases = {
35
+ latest = "2.19" ;
36
+ rolling = "2.18" ;
37
+ stable = "2.18" ;
38
+ prev-stable = "2.13" ;
39
+ } ;
39
40
inputName = version : pkgs . lib . strings . replaceStrings [ "." ] [ "-" ] version ;
40
41
src = version : inputs . "nix_${ inputName version } " ;
41
42
manual = version : ( import ( src version ) ) . default . doc ;
42
43
copy = version : ''
43
44
cp -Rf ${ manual version } /share/doc/nix/manual/* $out/manual/nix/${ version }
44
- # use upstream page redirects
45
+ '' ;
46
+ redirects = version : ''
45
47
sed 's#^\(.*\) \(.*\) #/manual/nix/${ version } \1 /manual/nix/${ version } \2 #g' ${ src version } /doc/manual/_redirects >> $out/_redirects
46
48
'' ;
49
+ shortlink = release : version : ''
50
+ echo /manual/nix/${ release } /manual/nix/${ version } >> $out/_redirects
51
+ '' ;
52
+ versions = with pkgs . lib ; lists . unique ( attrsets . attrValues releases ) ;
47
53
in
54
+ with pkgs . lib . attrsets ;
48
55
with pkgs . lib . strings ;
49
56
''
57
+ mkdir -p $out
58
+ cp -R build/html/* $out/
50
59
# NOTE: the comma in the shell expansion makes it also work for singleton lists
51
60
mkdir -p $out/manual/nix/{${ concatStringsSep "," releases } ,}
52
- cp -R build/html/* $out/
53
- ${ concatStringsSep "\n " ( map copy releases ) }
61
+ ${ concatStringsSep "\n " ( map copy versions ) }
62
+ ${ concatStringsSep "\n " ( map redirects versions ) }
63
+ ${ concatStringsSep "\n " ( mapAttrsToList shortlink releases ) }
54
64
'' ;
55
65
} ;
56
66
You can’t perform that action at this time.
0 commit comments