refactor(docs): cleanup variables

This commit is contained in:
Sk7Str1p3 2026-07-26 18:49:40 +00:00
parent 645fa542ee
commit 7d3133cc3c
Signed by: Sk7Str1p3
SSH key fingerprint: SHA256:GcXqjfo0IHK280c6aH9o5SmcOWyqMS8gjfOtDQ3gr/Q

View file

@ -18,33 +18,23 @@ stdenvNoCC.mkDerivation {
]; ];
patchPhase = patchPhase =
let let
shouldExclude = relPath: lib.any (pattern: builtins.match pattern relPath != null) excluded; relPath = file: lib.removePrefix (toString ../. + "/") (toString file);
nixFiles = nixFiles =
with lib.fileset; with lib.fileset;
let lib.filter (file: !(lib.any (pattern: builtins.match pattern (relPath file) != null) excluded)) (
allFiles = toList (fileFilter (f: f.hasExt "nix") ../.); toList (fileFilter (f: f.hasExt "nix") ../.)
in );
lib.filter (
file:
let
relPath = lib.removePrefix (toString ../. + "/") (toString file);
in
!shouldExclude relPath
) allFiles;
chapters = lib.sort (a: b: a.sortKey < b.sortKey) ( chapters = lib.sort (a: b: a.sortKey < b.sortKey) (
map ( map (
file: file:
let let
relPath = lib.removePrefix (toString ../. + "/") (toString file);
mdPath = mdPath =
( (
if baseNameOf file == "default.nix" then if baseNameOf file == "default.nix" then
lib.removeSuffix "/" (dirOf relPath) lib.removeSuffix "/" (dirOf (relPath file))
else else
lib.removeSuffix ".nix" relPath lib.removeSuffix ".nix" (relPath file)
) )
+ ".md"; + ".md";
@ -55,7 +45,7 @@ stdenvNoCC.mkDerivation {
hosts = 3; hosts = 3;
users = 4; users = 4;
}; };
order = orderMap.${lib.head (lib.splitString "/" relPath)}; order = orderMap.${lib.head (lib.splitString "/" (relPath file))};
category = lib.removeSuffix ".md" (lib.replaceStrings [ "/" ] [ "." ] mdPath); category = lib.removeSuffix ".md" (lib.replaceStrings [ "/" ] [ "." ] mdPath);
title = title =