10
10
# The root directory of the site
11
11
baseHref ? "/" ,
12
12
# A list of all available docs that should be linked to
13
- # Each element should contain { branch; nixpkgsBranch; baseHref; }
13
+ # Each element should contain { branch; nixpkgsBranch; baseHref; status; }
14
14
availableVersions ? [ ] ,
15
15
} :
16
16
let
305
305
# Zip the list of attrs into an attr of lists, for use as bash arrays
306
306
zippedVersions =
307
307
assert lib . assertMsg
308
- ( lib . all ( o : o ? branch && o ? nixpkgsBranch && o ? baseHref ) availableVersions )
308
+ ( lib . all ( o : o ? branch && o ? nixpkgsBranch && o ? baseHref && o ? status ) availableVersions )
309
309
''
310
- Expected all "availableVersions" docs entries to contain { branch, nixpkgsBranch, baseHref } attrs!
310
+ Expected all "availableVersions" docs entries to contain { branch, nixpkgsBranch, baseHref, status } attrs!
311
311
'' ;
312
312
lib . zipAttrs availableVersions ;
313
313
in
@@ -337,9 +337,10 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
337
337
{ type , hasExt , ... } :
338
338
type == "regular"
339
339
&& lib . any hasExt [
340
+ "css"
341
+ "js"
340
342
"md"
341
343
"toml"
342
- "js"
343
344
]
344
345
) ./. )
345
346
] ;
@@ -428,6 +429,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
428
429
branches = zippedVersions . branch or [ ] ;
429
430
nixpkgsBranches = zippedVersions . nixpkgsBranch or [ ] ;
430
431
baseHrefs = zippedVersions . baseHref or [ ] ;
432
+ statuses = zippedVersions . status or [ ] ;
431
433
current = baseHref ;
432
434
}
433
435
''
@@ -437,6 +439,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
437
439
nixpkgs="'' ${nixpkgsBranches[i]}"
438
440
baseHref="'' ${baseHrefs[i]}"
439
441
linkText="\`$branch\` branch"
442
+ status="'' ${statuses[i]}"
440
443
441
444
link=
442
445
suffix=
@@ -448,7 +451,25 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
448
451
link="[$linkText]($baseHref)"
449
452
fi
450
453
451
- echo "- The $link, for use with nixpkgs \`$nixpkgs\`$suffix" >> "$out"
454
+ statusClass=
455
+ statusText=
456
+ if [ "$status" = "beta" ]; then
457
+ statusClass="label label-info"
458
+ statusText=Beta
459
+ elif [ "$status" = "deprecated" ]; then
460
+ statusClass="label label-warning"
461
+ statusText=Deprecated
462
+ fi
463
+
464
+ {
465
+ echo -n '- '
466
+ if [ -n "$statusClass" ] && [ -n "$statusText" ]; then
467
+ echo -n '<span class="'"$statusClass"'">'"$statusText"'</span> '
468
+ fi
469
+ echo -n "The $link"
470
+ echo -n ", for use with nixpkgs \`$nixpkgs\`"
471
+ echo "$suffix"
472
+ } >> "$out"
452
473
done
453
474
'' ;
454
475
user-configs = callPackage ../user-configs { } ;
0 commit comments