nixos/documentation: avoid copying nixpkgs subpaths
the docs build should work well even when called from a git checkout of nixpkgs, but should avoid as much work as possible in all cases. if pkgs.path is already a store path we can avoid copying parts of it into the docs build sandbox by wrapping pkgs.path in builtins.storePath
This commit is contained in:
parent
50954ad1c5
commit
1511e72b75
|
@ -67,11 +67,15 @@ let
|
||||||
(t == "directory" -> baseNameOf n != "tests")
|
(t == "directory" -> baseNameOf n != "tests")
|
||||||
&& (t == "file" -> hasSuffix ".nix" n)
|
&& (t == "file" -> hasSuffix ".nix" n)
|
||||||
);
|
);
|
||||||
|
pull = dir:
|
||||||
|
if isStorePath pkgs.path
|
||||||
|
then "${builtins.storePath pkgs.path}/${dir}"
|
||||||
|
else filter "${toString pkgs.path}/${dir}";
|
||||||
in
|
in
|
||||||
pkgs.runCommand "lazy-options.json" {
|
pkgs.runCommand "lazy-options.json" {
|
||||||
libPath = filter "${toString pkgs.path}/lib";
|
libPath = pull "lib";
|
||||||
pkgsLibPath = filter "${toString pkgs.path}/pkgs/pkgs-lib";
|
pkgsLibPath = pull "pkgs/pkgs-lib";
|
||||||
nixosPath = filter "${toString pkgs.path}/nixos";
|
nixosPath = pull "nixos";
|
||||||
modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy;
|
modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy;
|
||||||
} ''
|
} ''
|
||||||
export NIX_STORE_DIR=$TMPDIR/store
|
export NIX_STORE_DIR=$TMPDIR/store
|
||||||
|
|
Loading…
Reference in a new issue