diff options
Diffstat (limited to 'nixos/doc/manual/default.nix')
-rw-r--r-- | nixos/doc/manual/default.nix | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 5a4d36d9dcc0..de3f9a95d95a 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -17,7 +17,7 @@ let # Clean up declaration sites to not refer to the NixOS source tree. optionsList' = flip map optionsList (opt: opt // { - declarations = map (fn: stripAnyPrefixes fn) opt.declarations; + declarations = map stripAnyPrefixes opt.declarations; } // optionalAttrs (opt ? example) { example = substFunction opt.example; } // optionalAttrs (opt ? default) { default = substFunction opt.default; } @@ -28,16 +28,16 @@ let # or else the build will fail. # # E.g. if some `options` came from modules in ${pkgs.customModules}/nix, - # you'd need to include `extraSources = [ "#{pkgs.customModules}" ]` - herePrefix = toString ../../..; - prefixesToStrip = [ herePrefix ] ++ extraSources; - - stripAnyPrefixes = fn: - flip (flip fold fn) prefixesToStrip (prefix: fn: - if substring 0 (stringLength prefix) fn == prefix then - substring (stringLength prefix + 1) 1000 fn - else - fn); + # you'd need to include `extraSources = [ pkgs.customModules ]` + prefixesToStrip = map toString ([ ../../.. ] ++ extraSources); + + stripPrefix = prefix: fullPath: + if substring 0 (stringLength prefix) fullPath == prefix then + substring (stringLength prefix + 1) 1000 fullPath + else + fileName; + + stripAnyPrefixes = fullPath: fold stripPrefix fullPath prefixesToStrip; # Convert the list of options into an XML file. optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList'); |