about summary refs log tree commit diff
path: root/doc/default.nix
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-06-16 00:15:12 +0000
committerGitHub <noreply@github.com>2024-06-16 00:15:12 +0000
commit7b8f253d6599933d883ea91c1dcfc1d3e3f60628 (patch)
tree5aa93d00225161abe76b0bff0e5c6af1129d88f3 /doc/default.nix
parent7070f7baf75ce6a10aa215f0b5c1957482659d5a (diff)
parent242522b8fed8d63f262fd6e747ba1e4372b59a8e (diff)
Merge master into haskell-updates
Diffstat (limited to 'doc/default.nix')
-rw-r--r--doc/default.nix29
1 files changed, 20 insertions, 9 deletions
diff --git a/doc/default.nix b/doc/default.nix
index 14c828b02a061..fd623cf15b8c8 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -2,6 +2,7 @@
 let
   inherit (pkgs) lib;
   inherit (lib) hasPrefix removePrefix;
+  fs = lib.fileset;
 
   common = import ./common.nix;
 
@@ -99,20 +100,30 @@ in pkgs.stdenv.mkDerivation {
     nixos-render-docs
   ];
 
-  src = ./.;
+  src = fs.toSource {
+    root = ./.;
+    fileset = fs.unions [
+      (fs.fileFilter (file:
+        file.hasExt "md"
+        || file.hasExt "md.in"
+      ) ./.)
+      ./style.css
+      ./anchor-use.js
+      ./anchor.min.js
+      ./manpage-urls.json
+    ];
+  };
 
   postPatch = ''
     ln -s ${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
   '';
 
-  buildPhase = let
-    pythonInterpreterTable = pkgs.callPackage ./doc-support/python-interpreter-table.nix {};
-    pythonSection = with lib.strings; replaceStrings
-      [ "@python-interpreter-table@" ]
-      [ pythonInterpreterTable ]
-      (readFile ./languages-frameworks/python.section.md);
-  in ''
-    cp ${builtins.toFile "python.section.md" pythonSection} ./languages-frameworks/python.section.md
+  pythonInterpreterTable = pkgs.callPackage ./doc-support/python-interpreter-table.nix {};
+
+  passAsFile = [ "pythonInterpreterTable" ];
+
+  buildPhase = ''
+    substituteInPlace ./languages-frameworks/python.section.md --subst-var-by python-interpreter-table "$(<"$pythonInterpreterTablePath")"
 
     cat \
       ./functions/library.md.in \