···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;
5151-5252- # NOTE: This assumes that `nixpkgs.config` is _not_ used when
5353- # nixpkgs.pkgs is set OR _module.args.pkgs is set.
5454- nixpkgs.config.path = self.outPath;
5551 }
5652 ];
5753 });
···6662 }).nixos.manual.x86_64-linux;
6763 };
68646969- legacyPackages = forAllSystems (system: import ./. { inherit system; config.path = self.outPath; });
6565+ legacyPackages = forAllSystems (system: import ./. { inherit system; });
70667167 nixosModules = {
7268 notDetected = import ./nixos/modules/installer/scan/not-detected.nix;
+4-72
nixos/modules/misc/documentation.nix
···6161 in scrubbedEval.options;
6262 baseOptionsJSON =
6363 let
6464- filterIntoStore =
6464+ filter =
6565 builtins.filterSource
6666 (n: t:
6767 (t == "directory" -> baseNameOf n != "tests")
6868 && (t == "file" -> hasSuffix ".nix" n)
6969 );
7070-7171- # Figure out if Nix runs in pure evaluation mode. May return true in
7272- # impure mode, but this is highly unlikely.
7373- # We need to know because of https://github.com/NixOS/nix/issues/1888
7474- # and https://github.com/NixOS/nix/issues/5868
7575- isPureEval = builtins.getEnv "PATH" == "" && builtins.getEnv "_" == "";
7676-7777- # Return a nixpkgs subpath with minimal copying.
7878- #
7979- # The sources for the base options json derivation can come in one of
8080- # two forms:
8181- # - single source: a store path with all of nixpkgs, postfix with
8282- # subpaths to access various directories. This has the benefit of
8383- # not creating copies of these subtrees in the Nix store, but
8484- # can cause unnecessary rebuilds if you update the Nixpkgs `pkgs`
8585- # tree often.
8686- # - split sources: multiple store paths with subdirectories of
8787- # nixpkgs that exclude the bulk of the pkgs directory.
8888- # This requires more copying and hashing during evaluation but
8989- # requires fewer files to be copied. This method produces fewer
9090- # unnecessary rebuilds of the base options json.
9191- #
9292- # Flake
9393- #
9494- # Flakes always put a copy of the full nixpkgs sources in the store,
9595- # so we can use the "single source" method. This method is ideal
9696- # for using nixpkgs as a dependency, as the base options json will be
9797- # substitutable from cache.nixos.org.
9898- #
9999- # This requires that the `self.outPath` is wired into `pkgs` correctly,
100100- # which is done for you if `pkgs` comes from the `lib.nixosSystem` or
101101- # `legacyPackages` flake attributes.
102102- #
103103- # Other Nixpkgs invocation
104104- #
105105- # If you do not use the known-correct flake attributes, but rather
106106- # invoke Nixpkgs yourself, set `config.path` to the correct path value,
107107- # e.g. `import nixpkgs { config.path = nixpkgs; }`.
108108- #
109109- # Choosing between single or split source paths
110110- #
111111- # We make assumptions based on the type and contents of `pkgs.path`.
112112- # By passing a different `config.path` to Nixpkgs, you can influence
113113- # how your documentation cache is evaluated and rebuilt.
114114- #
115115- # Single source
116116- # - If pkgs.path is a string containing a store path, the code has no
117117- # choice but to create this store path, if it hasn't already been.
118118- # We assume that the "single source" method is most efficient.
119119- # - If pkgs.path is a path value containing that is a store path,
120120- # we try to convert it to a string with context without copying.
121121- # This occurs for example when nixpkgs was fetched and using its
122122- # default `config.path`, which is `./.`.
123123- # Nix currently does not allow this conversion when evaluating in
124124- # pure mode. If the conversion is not possible, we use the
125125- # "split source" method.
126126- #
127127- # Split source
128128- # - If pkgs.path is a path value that is not a store path, we assume
129129- # that it's unlikely for all of nixpkgs to end up in the store for
130130- # other reasons and try to keep both the copying and rebuilds low.
131131- pull =
132132- if builtins.typeOf pkgs.path == "string" && isStorePath pkgs.path then
133133- dir: "${pkgs.path}/${dir}"
134134- else if !isPureEval && isStorePath pkgs.path then
135135- dir: "${builtins.storePath pkgs.path}/${dir}"
136136- else
137137- dir: filterIntoStore "${toString pkgs.path}/${dir}";
13870 in
13971 pkgs.runCommand "lazy-options.json" {
140140- libPath = pull "lib";
141141- pkgsLibPath = pull "pkgs/pkgs-lib";
142142- nixosPath = pull "nixos";
7272+ libPath = filter "${toString pkgs.path}/lib";
7373+ pkgsLibPath = filter "${toString pkgs.path}/pkgs/pkgs-lib";
7474+ nixosPath = filter "${toString pkgs.path}/nixos";
14375 modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy;
14476 } ''
14577 export NIX_STORE_DIR=$TMPDIR/store
-2
nixos/modules/misc/nixpkgs.nix
···5959 inherit (cfg) config overlays localSystem crossSystem;
6060 };
61616262- # NOTE: flake.nix assumes that nixpkgs.config is only used with ../../..
6363- # as nixpkgs.config.path should be equivalent to ../../..
6462 finalPkgs = if opt.pkgs.isDefined then cfg.pkgs.appendOverlays cfg.overlays else defaultPkgs;
65636664in
+1-1
pkgs/top-level/all-packages.nix
···6767 clangStdenvNoLibs = mkStdenvNoLibs clangStdenv;
68686969 # For convenience, allow callers to get the path to Nixpkgs.
7070- path = config.path;
7070+ path = ../..;
717172727373 ### Helper functions.
-14
pkgs/top-level/config.nix
···3232 feature = "run <literal>checkPhase</literal> by default";
3333 };
34343535- path = mkOption {
3636- type = types.path;
3737- default = ../..;
3838- defaultText = lib.literalDocBook "a path expression";
3939- internal = true;
4040- description = ''
4141- A reference to Nixpkgs' own sources.
4242-4343- This is overridable in order to avoid copying sources unnecessarily,
4444- as a path expression that references a store path will not short-circuit
4545- to the store path itself, but copy the store path instead.
4646- '';
4747- };
4848-4935 };
50365137in {