1 # A replacement for the traditional nixpkgs module, such that none of the modules
2 # can add their own configuration. This ensures that the Nixpkgs configuration is
3 # exactly as the user intends.
4 # This may also be used as a performance optimization when evaluating multiple
5 # configurations at once, with a shared `pkgs`.
7 # This is a separate module, because merging this logic into the nixpkgs module
8 # is too burdensome, considering that it is already burdened with legacy.
9 # Moving this logic into a module does not lose any composition benefits, because
10 # its purpose is not something that composes anyway.
16 inherit (lib) mkOption types;
26 type = lib.types.pkgs;
27 description = ''The pkgs module argument.'';
31 type = types.unique { message = "nixpkgs.config is set to read-only"; } types.anything;
33 The Nixpkgs `config` that `pkgs` was initialized with.
38 type = types.unique { message = "nixpkgs.overlays is set to read-only"; } types.anything;
40 The Nixpkgs overlays that `pkgs` was initialized with.
43 hostPlatform = mkOption {
47 The platform of the machine that is running the NixOS configuration.
50 buildPlatform = mkOption {
54 The platform of the machine that built the NixOS configuration.
57 # NOTE: do not add the legacy options such as localSystem here. Let's keep
58 # this module simple and let module authors upgrade their code instead.
63 # find mistaken definitions
64 builtins.seq cfg.config
65 builtins.seq cfg.overlays
66 builtins.seq cfg.hostPlatform
67 builtins.seq cfg.buildPlatform
69 nixpkgs.config = cfg.pkgs.config;
70 nixpkgs.overlays = cfg.pkgs.overlays;
71 nixpkgs.hostPlatform = cfg.pkgs.stdenv.hostPlatform;
72 nixpkgs.buildPlatform = cfg.pkgs.stdenv.buildPlatform;