Switch the option type to `deferredModuleWith`, which collects definitions without evaluating them.
The raw definitions are forwarded to nixpkgs function via a new internal `_configDefinitions` parameter.
`apply` on the option returns `finalPkgs.config`, preserving
backwards compatibility for external readers of `config.nixpkgs.config`
This makes it so that the `nixpkgs.config` options can be merged with the module system
It also makes the defined options show up in search and the manual.
Include the moved-out modular service infrastructure into the set of
files to evaluate during the docs build.
This was previously unnecessary because even the portable parts were
stored inside the nixos tree.
Move the portable modular service base from
nixos/modules/system/service/portable/ to lib/services/, making it
importable by any module system (home-manager, nix-darwin) without
reaching into the nixos/ tree.
Moved files: service.nix, lib.nix, config-data.nix, config-data-item.nix,
test.nix. All external references updated (systemd/system.nix,
doc/manual/default.nix, assertions.nix, README.md).
No functional changes - only import paths differ.
Move the inline modularServicesModule to a separate file so the module
system sets _file automatically from the file path, removing the need
for __curPos.
default.target is an alias[1] to either multi-user.target or
graphical.target. It makes a bit more sense to trigger mandb
generation by multi-user.target since the generation does not depend
on graphics.
[1]: man bootup
Enables faster and fully asynchronous generation of the cache at runtime
by maintaining a separate copy of `cfg.manualPages` with appropriate
timestamps so that mandb can pick up relevant changes without having to
re-generate the full cache on nearly every system rebuild.
Nixpkgs config, for defining things like which licenses are
permitted, can either be an attrset or a function that is passed a
`pkgs` argument. Evaluating that `pkgs` argument requires computing the
Nixpkgs fixpoint, which requires checking whether the derivations used
in the Nixpkgs bootstrap have valid licenses. This works provided
nothing tries to use Nixpkgs functions to validate or merge anything
included in the configuration.
f5deefd463 (config: add and document {allow,block}listedLicenses,
2025-08-31), in #437723, added type checking and merging to the lists of
permitted/forbidden licenses. That resulted in a recursion loop if a
list of licenses included, say, `pkgs.lib.licenses.bsd0`.
To allow licenses to be specified from Nixpkgs' library, pass `lib` as
well as `pkgs` to any config function. Computing `lib` doesn't require
working out the full Nixpkgs fixpoint. The change in #437723 will still
break things for some people, but it at least provides a sensible route
to getting the config working again.
Fixes#456994.
Inspired by https://github.com/NixOS/nixpkgs/issues/197325 this adds a
new option nixpkgs.allowUnfreePackages, which merges additively and can
thus be defined in multiple modules close to where the unfree package is
installed.
I would have liked ot name this option
nixpkgs.config.allowUnfreePackages, to define it closer to where the
allowUnfree and allowUnfreePredicate are defined, but I didn't see how
this could be achived. I would welcome some guidance on how to do this.
Currently the defaultText of nixpkgs.pkgs uses the cfg variable. The search.nixos.org page is not able to resolve that variable.
Replacing "cfg" within this docs text with the non-aliased "config.nixpkgs".
When we _must_ build, prefer building locally since we probably already have the manpages here. Otherwise, Nix would send all the manpages to a remote builder which isn't likely to be much faster since building the DB is single-threaded. Hopefully a best-of-both worlds between keeping or removing 39e63f110e.
This factors out `meta.maintainers` from NixOS `misc/meta.nix` for use in arbitrary
Module System applications.
It is useful beyond NixOS and not coupled to it, although it is currently coupled to Nixpkgs'
`lib.maintainers`.
That restriction could be lifted optionally if there's future demand.