git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #156992 from hercules-ci/revert-153594-doc-optimization

Revert 153594 doc optimization

commitd0947df00682c44dfa65c53299b63cb52757378b authorRobert Hensing <roberth@users.noreply.github.com> dateThu 27 Jan 2022, 15:46 (5 years ago) parent8328d4a4acad30
5 files changed+6−94
flake.nix+1−5 nixos/modules/misc/documentation.nix+4−72 nixos/modules/misc/nixpkgs.nix−2 pkgs/top-level/all-packages.nix+1−1 pkgs/top-level/config.nix−14
flake.nix+1−5
@@ -48,10 +48,6 @@
4848 system.nixos.versionSuffix =
4949 ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";
5050 system.nixos.revision = final.mkIf (self ? rev) self.rev;
51−
52− # NOTE: This assumes that `nixpkgs.config` is _not_ used when
53− # nixpkgs.pkgs is set OR _module.args.pkgs is set.
54− nixpkgs.config.path = self.outPath;
5551 }
5652 ];
5753 });
@@ -66,7 +62,7 @@
6662 }).nixos.manual.x86_64-linux;
6763 };
6864
69− legacyPackages = forAllSystems (system: import ./. { inherit system; config.path = self.outPath; });
65+ legacyPackages = forAllSystems (system: import ./. { inherit system; });
7066
7167 nixosModules = {
7268 notDetected = import ./nixos/modules/installer/scan/not-detected.nix;
nixos/modules/misc/documentation.nix+4−72
@@ -61,85 +61,17 @@ let
6161 in scrubbedEval.options;
6262 baseOptionsJSON =
6363 let
64− filterIntoStore =
64+ filter =
6565 builtins.filterSource
6666 (n: t:
6767 (t == "directory" -> baseNameOf n != "tests")
6868 && (t == "file" -> hasSuffix ".nix" n)
6969 );
70−
71− # Figure out if Nix runs in pure evaluation mode. May return true in
72− # impure mode, but this is highly unlikely.
73− # We need to know because of https://github.com/NixOS/nix/issues/1888
74− # and https://github.com/NixOS/nix/issues/5868
75− isPureEval = builtins.getEnv "PATH" == "" && builtins.getEnv "_" == "";
76−
77− # Return a nixpkgs subpath with minimal copying.
78− #
79− # The sources for the base options json derivation can come in one of
80− # two forms:
81− # - single source: a store path with all of nixpkgs, postfix with
82− # subpaths to access various directories. This has the benefit of
83− # not creating copies of these subtrees in the Nix store, but
84− # can cause unnecessary rebuilds if you update the Nixpkgs `pkgs`
85− # tree often.
86− # - split sources: multiple store paths with subdirectories of
87− # nixpkgs that exclude the bulk of the pkgs directory.
88− # This requires more copying and hashing during evaluation but
89− # requires fewer files to be copied. This method produces fewer
90− # unnecessary rebuilds of the base options json.
91− #
92− # Flake
93− #
94− # Flakes always put a copy of the full nixpkgs sources in the store,
95− # so we can use the "single source" method. This method is ideal
96− # for using nixpkgs as a dependency, as the base options json will be
97− # substitutable from cache.nixos.org.
98− #
99− # This requires that the `self.outPath` is wired into `pkgs` correctly,
100− # which is done for you if `pkgs` comes from the `lib.nixosSystem` or
101− # `legacyPackages` flake attributes.
102− #
103− # Other Nixpkgs invocation
104− #
105− # If you do not use the known-correct flake attributes, but rather
106− # invoke Nixpkgs yourself, set `config.path` to the correct path value,
107− # e.g. `import nixpkgs { config.path = nixpkgs; }`.
108− #
109− # Choosing between single or split source paths
110− #
111− # We make assumptions based on the type and contents of `pkgs.path`.
112− # By passing a different `config.path` to Nixpkgs, you can influence
113− # how your documentation cache is evaluated and rebuilt.
114− #
115− # Single source
116− # - If pkgs.path is a string containing a store path, the code has no
117− # choice but to create this store path, if it hasn't already been.
118− # We assume that the "single source" method is most efficient.
119− # - If pkgs.path is a path value containing that is a store path,
120− # we try to convert it to a string with context without copying.
121− # This occurs for example when nixpkgs was fetched and using its
122− # default `config.path`, which is `./.`.
123− # Nix currently does not allow this conversion when evaluating in
124− # pure mode. If the conversion is not possible, we use the
125− # "split source" method.
126− #
127− # Split source
128− # - If pkgs.path is a path value that is not a store path, we assume
129− # that it's unlikely for all of nixpkgs to end up in the store for
130− # other reasons and try to keep both the copying and rebuilds low.
131− pull =
132− if builtins.typeOf pkgs.path == "string" && isStorePath pkgs.path then
133− dir: "${pkgs.path}/${dir}"
134− else if !isPureEval && isStorePath pkgs.path then
135− dir: "${builtins.storePath pkgs.path}/${dir}"
136− else
137− dir: filterIntoStore "${toString pkgs.path}/${dir}";
13870 in
13971 pkgs.runCommand "lazy-options.json" {
140− libPath = pull "lib";
141− pkgsLibPath = pull "pkgs/pkgs-lib";
142− nixosPath = pull "nixos";
72+ libPath = filter "${toString pkgs.path}/lib";
73+ pkgsLibPath = filter "${toString pkgs.path}/pkgs/pkgs-lib";
74+ nixosPath = filter "${toString pkgs.path}/nixos";
14375 modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy;
14476 } ''
14577 export NIX_STORE_DIR=$TMPDIR/store
nixos/modules/misc/nixpkgs.nix−2
@@ -59,8 +59,6 @@ let
5959 inherit (cfg) config overlays localSystem crossSystem;
6060 };
6161
62− # NOTE: flake.nix assumes that nixpkgs.config is only used with ../../..
63− # as nixpkgs.config.path should be equivalent to ../../..
6462 finalPkgs = if opt.pkgs.isDefined then cfg.pkgs.appendOverlays cfg.overlays else defaultPkgs;
6563
6664in
pkgs/top-level/all-packages.nix+1−1
@@ -67,7 +67,7 @@ with pkgs;
6767 clangStdenvNoLibs = mkStdenvNoLibs clangStdenv;
6868
6969 # For convenience, allow callers to get the path to Nixpkgs.
70− path = config.path;
70+ path = ../..;
7171
7272
7373 ### Helper functions.
pkgs/top-level/config.nix−14
@@ -32,20 +32,6 @@ let
3232 feature = "run <literal>checkPhase</literal> by default";
3333 };
3434
35− path = mkOption {
36− type = types.path;
37− default = ../..;
38− defaultText = lib.literalDocBook "a path expression";
39− internal = true;
40− description = ''
41− A reference to Nixpkgs' own sources.
42−
43− This is overridable in order to avoid copying sources unnecessarily,
44− as a path expression that references a store path will not short-circuit
45− to the store path itself, but copy the store path instead.
46− '';
47− };
48−
4935 };
5036
5137in {