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