···7373 defaultPkgs =
7474 if opt.hostPlatform.isDefined then
7575 let
7676- isCross =
7777- !(lib.systems.equals (lib.systems.elaborate cfg.buildPlatform) (
7878- lib.systems.elaborate cfg.hostPlatform
7979- ));
7676+ isCross = cfg.buildPlatform != cfg.hostPlatform;
8077 systemArgs =
8178 if isCross then
8279 {
···198195 };
199196200197 hostPlatform = lib.mkOption {
201201- type = lib.types.either lib.types.str lib.types.attrs;
198198+ type = lib.types.either lib.types.str lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
202199 example = {
203200 system = "aarch64-linux";
204201 };
202202+ # Make sure that the final value has all fields for sake of other modules
203203+ # referring to this. TODO make `lib.systems` itself use the module system.
204204+ apply = lib.systems.elaborate;
205205 defaultText = lib.literalExpression ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
206206 description = ''
207207 Specifies the platform where the NixOS configuration will run.
···213213 };
214214215215 buildPlatform = lib.mkOption {
216216- type = lib.types.either lib.types.str lib.types.attrs;
216216+ type = lib.types.either lib.types.str lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
217217 default = cfg.hostPlatform;
218218 example = {
219219 system = "x86_64-linux";
220220 };
221221 # Make sure that the final value has all fields for sake of other modules
222222 # referring to this.
223223+ apply =
224224+ inputBuildPlatform:
225225+ let
226226+ elaborated = lib.systems.elaborate inputBuildPlatform;
227227+ in
228228+ if lib.systems.equals elaborated cfg.hostPlatform then
229229+ cfg.hostPlatform # make identical, so that `==` equality works; see https://github.com/NixOS/nixpkgs/issues/278001
230230+ else
231231+ elaborated;
223232 defaultText = lib.literalExpression ''config.nixpkgs.hostPlatform'';
224233 description = ''
225234 Specifies the platform on which NixOS should be built.
···236245 };
237246238247 localSystem = lib.mkOption {
239239- type = lib.types.attrs;
248248+ type = lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
240249 default = { inherit (cfg) system; };
241250 example = {
242251 system = "aarch64-linux";
243252 };
253253+ # Make sure that the final value has all fields for sake of other modules
254254+ # referring to this. TODO make `lib.systems` itself use the module system.
255255+ apply = lib.systems.elaborate;
244256 defaultText = lib.literalExpression ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
245257 description = ''
246258 Systems with a recently generated `hardware-configuration.nix`
···268280 # is a relation between at least 2 systems in the context of a
269281 # specific build step, not a single system.
270282 crossSystem = lib.mkOption {
271271- type = lib.types.nullOr lib.types.attrs;
283283+ type = lib.types.nullOr lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
272284 default = null;
273285 example = {
274286 system = "aarch64-linux";
···402414403415 Defined in:
404416 ${lib.concatMapStringsSep "\n" (file: " - ${file}") opt.config.files}
405405- '';
406406- }
407407- {
408408- assertion =
409409- (opt.hostPlatform.isDefined -> builtins.isAttrs cfg.buildPlatform -> !(cfg.buildPlatform ? parsed))
410410- && (opt.hostPlatform.isDefined -> builtins.isAttrs cfg.hostPlatform -> !(cfg.hostPlatform ? parsed))
411411- && (builtins.isAttrs cfg.localSystem -> !(cfg.localSystem ? parsed))
412412- && (builtins.isAttrs cfg.crossSystem -> !(cfg.crossSystem ? parsed));
413413- message = ''
414414- Passing fully elaborated systems to `nixpkgs.localSystem`, `nixpkgs.crossSystem`, `nixpkgs.buildPlatform`
415415- or `nixpkgs.hostPlatform` will break composability of package sets in nixpkgs. For example, pkgs.pkgsStatic
416416- would not work in modules anymore.
417417 '';
418418 }
419419 ];
+19-6
nixos/modules/misc/nixpkgs/read-only.nix
···4040 The Nixpkgs overlays that `pkgs` was initialized with.
4141 '';
4242 };
4343- # buildPlatform and hostPlatform left out on purpose:
4444- # - They are not supposed to be changed with this read-only module.
4545- # - They are not supposed to be read either, according to the description
4646- # of "system" in the traditional nixpkgs module.
4747- #
4343+ hostPlatform = mkOption {
4444+ internal = true;
4545+ readOnly = true;
4646+ description = ''
4747+ The platform of the machine that is running the NixOS configuration.
4848+ '';
4949+ };
5050+ buildPlatform = mkOption {
5151+ internal = true;
5252+ readOnly = true;
5353+ description = ''
5454+ The platform of the machine that built the NixOS configuration.
5555+ '';
5656+ };
4857 # NOTE: do not add the legacy options such as localSystem here. Let's keep
4958 # this module simple and let module authors upgrade their code instead.
5059 };
···5261 config = {
5362 _module.args.pkgs =
5463 # find mistaken definitions
5555- builtins.seq cfg.config builtins.seq cfg.overlays cfg.pkgs;
6464+ builtins.seq cfg.config builtins.seq cfg.overlays builtins.seq cfg.hostPlatform builtins.seq
6565+ cfg.buildPlatform
6666+ cfg.pkgs;
5667 nixpkgs.config = cfg.pkgs.config;
5768 nixpkgs.overlays = cfg.pkgs.overlays;
6969+ nixpkgs.hostPlatform = cfg.pkgs.stdenv.hostPlatform;
7070+ nixpkgs.buildPlatform = cfg.pkgs.stdenv.buildPlatform;
5871 };
5972}
+1-1
nixos/modules/programs/chromium.nix
···22222323 options = {
2424 programs.chromium = {
2525- enable = lib.mkEnableOption "{command}`chromium` policies";
2525+ enable = lib.mkEnableOption "policies for chromium based browsers like Chromium, Google Chrome or Brave";
26262727 enablePlasmaBrowserIntegration = lib.mkEnableOption "Native Messaging Host for Plasma Browser Integration";
2828
···4040 verityStore = {
4141 enable = true;
4242 # by default the module works with systemd-boot, for simplicity this test directly boots the UKI
4343- ukiPath = "/EFI/BOOT/BOOT${lib.toUpper pkgs.stdenv.hostPlatform.efiArch}.EFI";
4343+ ukiPath = "/EFI/BOOT/BOOT${lib.toUpper config.nixpkgs.hostPlatform.efiArch}.EFI";
4444 };
45454646 name = "appliance-verity-store-image";
···5151 repartConfig = {
5252 Type = "esp";
5353 Format = "vfat";
5454- SizeMinBytes = if pkgs.stdenv.hostPlatform.isx86_64 then "64M" else "96M";
5454+ SizeMinBytes = if config.nixpkgs.hostPlatform.isx86_64 then "64M" else "96M";
5555 };
5656 };
5757 ${partitionIds.store-verity}.repartConfig = {
+2-2
nixos/tests/appliance-repart-image.nix
···5353 "esp" = {
5454 contents =
5555 let
5656- efiArch = pkgs.stdenv.hostPlatform.efiArch;
5656+ efiArch = config.nixpkgs.hostPlatform.efiArch;
5757 in
5858 {
5959 "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source =
···7070 # aarch64 kernel seems to generally be a little bigger than the
7171 # x86_64 kernel. To stay on the safe side, leave some more slack
7272 # for every platform other than x86_64.
7373- SizeMinBytes = if pkgs.stdenv.hostPlatform.isx86_64 then "64M" else "96M";
7373+ SizeMinBytes = if config.nixpkgs.hostPlatform.isx86_64 then "64M" else "96M";
7474 };
7575 };
7676 "swap" = {
···11-# run like this:
22-# nix-build pkgs/test/top-level/stage.nix
33-{
44- localSystem ? {
55- system = builtins.currentSystem;
66- },
77-}:
88-99-with import ../../top-level { inherit localSystem; };
1010-1111-let
1212- # To silence platform specific evaluation errors
1313- discardEvaluationErrors = e: (builtins.tryEval e).success -> e;
1414-1515- # Basic test for idempotency of the package set, i.e:
1616- # Applying the same package set twice should work and
1717- # not change anything.
1818- isIdempotent = set: discardEvaluationErrors (pkgs.${set}.stdenv == pkgs.${set}.${set}.stdenv);
1919-2020- # Some package sets should be noops in certain circumstances.
2121- # This is very similar to the idempotency test, but not going
2222- # via the super' overlay.
2323- isNoop =
2424- parent: child:
2525- discardEvaluationErrors (
2626- (lib.getAttrFromPath parent pkgs).stdenv == (lib.getAttrFromPath parent pkgs).${child}.stdenv
2727- );
2828-2929- allMuslExamples = builtins.attrNames (
3030- lib.filterAttrs (_: system: lib.hasSuffix "-musl" system.config) lib.systems.examples
3131- );
3232-3333- allLLVMExamples = builtins.attrNames (
3434- lib.filterAttrs (_: system: system.useLLVM or false) lib.systems.examples
3535- );
3636-3737- # A package set should only change specific configuration, but needs
3838- # to keep all other configuration from previous layers in place.
3939- # Each package set has one or more key characteristics for which we
4040- # test here. Those should be kept, even when applying the "set" package
4141- # set.
4242- isComposable =
4343- set:
4444- (
4545- # Can't compose two different libcs...
4646- builtins.elem set [ "pkgsLLVMLibc" ]
4747- || discardEvaluationErrors (
4848- pkgsCross.mingwW64.${set}.stdenv.hostPlatform.config == "x86_64-w64-mingw32"
4949- )
5050- )
5151- && (
5252- # Can't compose two different libcs...
5353- builtins.elem set [ "pkgsLLVMLibc" ]
5454- || discardEvaluationErrors (pkgsCross.mingwW64.${set}.stdenv.hostPlatform.libc == "msvcrt")
5555- )
5656- && discardEvaluationErrors (pkgsCross.ppc64-musl.${set}.stdenv.hostPlatform.gcc.abi == "elfv2")
5757- && discardEvaluationErrors (
5858- builtins.elem "trivialautovarinit" pkgs.pkgsExtraHardening.${set}.stdenv.cc.defaultHardeningFlags
5959- )
6060- && discardEvaluationErrors (pkgs.pkgsLLVM.${set}.stdenv.hostPlatform.useLLVM)
6161- && (
6262- # Can't compose two different libcs...
6363- builtins.elem set [
6464- "pkgsMusl"
6565- "pkgsStatic"
6666- ]
6767- || discardEvaluationErrors (pkgs.pkgsLLVMLibc.${set}.stdenv.hostPlatform.isLLVMLibc)
6868- )
6969- && discardEvaluationErrors (pkgs.pkgsArocc.${set}.stdenv.hostPlatform.useArocc)
7070- && discardEvaluationErrors (pkgs.pkgsZig.${set}.stdenv.hostPlatform.useZig)
7171- && discardEvaluationErrors (pkgs.pkgsLinux.${set}.stdenv.buildPlatform.isLinux)
7272- && (
7373- # Can't compose two different libcs...
7474- builtins.elem set [ "pkgsLLVMLibc" ]
7575- || discardEvaluationErrors (pkgs.pkgsMusl.${set}.stdenv.hostPlatform.isMusl)
7676- )
7777- && discardEvaluationErrors (pkgs.pkgsStatic.${set}.stdenv.hostPlatform.isStatic)
7878- && discardEvaluationErrors (pkgs.pkgsi686Linux.${set}.stdenv.hostPlatform.isx86_32)
7979- && discardEvaluationErrors (pkgs.pkgsx86_64Darwin.${set}.stdenv.hostPlatform.isx86_64);
8080-in
8181-8282-# Appends same defaultHardeningFlags again on each .pkgsExtraHardening - thus not idempotent.
8383-# assert isIdempotent "pkgsExtraHardening";
8484-# TODO: Remove the isDarwin condition, which currently results in infinite recursion.
8585-# Also see https://github.com/NixOS/nixpkgs/pull/330567#discussion_r1894653309
8686-assert (stdenv.hostPlatform.isDarwin || isIdempotent "pkgsLLVM");
8787-# TODO: This currently results in infinite recursion, even on Linux
8888-# assert isIdempotent "pkgsLLVMLibc";
8989-assert isIdempotent "pkgsArocc";
9090-assert isIdempotent "pkgsZig";
9191-assert isIdempotent "pkgsLinux";
9292-assert isIdempotent "pkgsMusl";
9393-assert isIdempotent "pkgsStatic";
9494-assert isIdempotent "pkgsi686Linux";
9595-assert isIdempotent "pkgsx86_64Darwin";
9696-9797-assert isNoop [ "pkgsStatic" ] "pkgsMusl";
9898-assert lib.all (sys: isNoop [ "pkgsCross" sys ] "pkgsMusl") allMuslExamples;
9999-assert lib.all (sys: isNoop [ "pkgsCross" sys ] "pkgsLLVM") allLLVMExamples;
100100-101101-assert isComposable "pkgsExtraHardening";
102102-assert isComposable "pkgsLLVM";
103103-# TODO: Results in infinite recursion
104104-# assert isComposable "pkgsLLVMLibc";
105105-assert isComposable "pkgsArocc";
106106-# TODO: unexpected argument 'bintools' - uncomment once https://github.com/NixOS/nixpkgs/pull/331011 is done
107107-# assert isComposable "pkgsZig";
108108-assert isComposable "pkgsMusl";
109109-assert isComposable "pkgsStatic";
110110-assert isComposable "pkgsi686Linux";
111111-112112-# Special cases regarding buildPlatform vs hostPlatform
113113-assert discardEvaluationErrors (pkgsCross.gnu64.pkgsMusl.stdenv.hostPlatform.isMusl);
114114-assert discardEvaluationErrors (pkgsCross.gnu64.pkgsi686Linux.stdenv.hostPlatform.isx86_32);
115115-assert discardEvaluationErrors (pkgsCross.mingwW64.pkgsLinux.stdenv.hostPlatform.isLinux);
116116-assert discardEvaluationErrors (
117117- pkgsCross.aarch64-darwin.pkgsx86_64Darwin.stdenv.hostPlatform.isx86_64
118118-);
119119-120120-# pkgsCross should keep upper cross settings
121121-assert discardEvaluationErrors (
122122- with pkgsStatic.pkgsCross.gnu64.stdenv.hostPlatform; isGnu && isStatic
123123-);
124124-assert discardEvaluationErrors (
125125- with pkgsLLVM.pkgsCross.musl64.stdenv.hostPlatform; isMusl && useLLVM
126126-);
127127-128128-emptyFile
+3
pkgs/top-level/aliases.nix
···14821482 viper4linux-gui = throw "'viper4linux-gui' was removed as it is broken and not maintained upstream"; # Added 2024-12-16
14831483 viper4linux = throw "'viper4linux' was removed as it is broken and not maintained upstream"; # Added 2024-12-16
14841484 virtscreen = throw "'virtscreen' has been removed, as it was broken and unmaintained"; # Added 2024-10-17
14851485+ vistafonts = vista-fonts; # Added 2025-02-03
14861486+ vistafonts-chs = vista-fonts-chs; # Added 2025-02-03
14871487+ vistafonts-cht = vista-fonts-cht; # Added 2025-02-03
14851488 vkBasalt = vkbasalt; # Added 2022-11-22
14861489 vkdt-wayland = vkdt; # Added 2024-04-19
14871490 void = throw "'void' has been removed due to lack of upstream maintenance"; # Added 2025-01-25
···4646 ...
4747} @ args:
48484949-# Passing fully elaborated systems to localSystem or crossSystem will break composability
5050-# of package sets.
5151-assert builtins.isAttrs localSystem -> !(localSystem ? parsed);
5252-assert builtins.isAttrs crossSystem -> !(crossSystem ? parsed);
5353-5449let # Rename the function arguments
5550 config0 = config;
5651 crossSystem0 = crossSystem;
···127122 config = lib.showWarnings configEval.config.warnings configEval.config;
128123129124 # A few packages make a new package set to draw their dependencies from.
130130- # Rather than give `all-packages.nix` all the arguments to this function,
131131- # even ones that don't concern it, we give it this function to "re-call"
132132- # nixpkgs, inheriting whatever arguments it doesn't explicitly provide. This
133133- # way, `all-packages.nix` doesn't know more than it needs to.
125125+ # (Currently to get a cross tool chain, or forced-i686 package.) Rather than
126126+ # give `all-packages.nix` all the arguments to this function, even ones that
127127+ # don't concern it, we give it this function to "re-call" nixpkgs, inheriting
128128+ # whatever arguments it doesn't explicitly provide. This way,
129129+ # `all-packages.nix` doesn't know more than it needs too.
134130 #
135131 # It's OK that `args` doesn't include default arguments from this file:
136132 # they'll be deterministically inferred. In fact we must *not* include them,
137133 # because it's important that if some parameter which affects the default is
138134 # substituted with a different argument, the default is re-inferred.
139135 #
140140- # To put this in concrete terms, we want the provided non-native `localSystem`
141141- # and `crossSystem` arguments to affect the stdenv chosen.
136136+ # To put this in concrete terms, this function is basically just used today to
137137+ # use package for a different platform for the current platform (namely cross
138138+ # compiling toolchains and 32-bit packages on x86_64). In both those cases we
139139+ # want the provided non-native `localSystem` argument to affect the stdenv
140140+ # chosen.
142141 #
143142 # NB!!! This thing gets its `config` argument from `args`, i.e. it's actually
144143 # `config0`. It is important to keep it to `config0` format (as opposed to the
···147146 # via `evalModules` is not idempotent. In other words, if you add `config` to
148147 # `newArgs`, expect strange very hard to debug errors! (Yes, I'm speaking from
149148 # experience here.)
150150- nixpkgsFun = f0: import ./. (args // f0 args);
149149+ nixpkgsFun = newArgs: import ./. (args // newArgs);
151150152151 # Partially apply some arguments for building bootstraping stage pkgs
153152 # sets. Only apply arguments which no stdenv would want to override.
+123-83
pkgs/top-level/stage.nix
···180180 ((config.packageOverrides or (super: {})) super);
181181182182 # Convenience attributes for instantitating package sets. Each of
183183- # these will instantiate a new version of allPackages.
184184- otherPackageSets = let
185185- mkPkgs = name: fn: nixpkgsFun (prevArgs: let nixpkgsArgs = fn prevArgs; in nixpkgsArgs // {
186186- overlays = [
187187- (self': super': {
188188- "${name}" = super';
189189- })
190190- ] ++ nixpkgsArgs.overlays or [] ++ prevArgs.overlays or [];
191191- });
192192- # This is always cross.
193193- mkCrossPkgs = name: crossAttrs: mkPkgs name (prevArgs: {
194194- crossSystem =
195195- (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // crossAttrs;
196196- });
197197- # This is only cross when we are already cross, otherwise local.
198198- # For the case of "native cross", i.e. pkgsCross.gnu64 on a x86_64-linux system, we need to adjust **both**
199199- # localSystem **and** crossSystem, otherwise they're out of sync.
200200- mkHybridPkgs = name: hybridAttrs: mkPkgs name (prevArgs: let
201201- newSystem = (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // hybridAttrs;
202202- in { crossSystem = newSystem; }
203203- // lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform) { localSystem = newSystem; }
204204- );
205205- in self: super: {
183183+ # these will instantiate a new version of allPackages. Currently the
184184+ # following package sets are provided:
185185+ #
186186+ # - pkgsCross.<system> where system is a member of lib.systems.examples
187187+ # - pkgsMusl
188188+ # - pkgsi686Linux
189189+ otherPackageSets = self: super: {
206190 # This maps each entry in lib.systems.examples to its own package
207191 # set. Each of these will contain all packages cross compiled for
208192 # that target system. For instance, pkgsCross.raspberryPi.hello,
209193 # will refer to the "hello" package built for the ARM6-based
210194 # Raspberry Pi.
211195 pkgsCross = lib.mapAttrs (n: crossSystem:
212212- nixpkgsFun (prevArgs: { crossSystem = (lib.systems.systemToAttrs (lib.defaultTo { } prevArgs.crossSystem or null)) // crossSystem; }))
196196+ nixpkgsFun { inherit crossSystem; })
213197 lib.systems.examples;
214198215215- # Bootstrap a cross stdenv using the LLVM toolchain.
216216- # This is currently not possible when compiling natively.
217217- pkgsLLVM = mkCrossPkgs "pkgsLLVM" {
218218- useLLVM = true;
219219- linker = "lld";
199199+ pkgsLLVM = nixpkgsFun {
200200+ overlays = [
201201+ (self': super': {
202202+ pkgsLLVM = super';
203203+ })
204204+ ] ++ overlays;
205205+ # Bootstrap a cross stdenv using the LLVM toolchain.
206206+ # This is currently not possible when compiling natively,
207207+ # so we don't need to check hostPlatform != buildPlatform.
208208+ crossSystem = stdenv.hostPlatform // {
209209+ useLLVM = true;
210210+ linker = "lld";
211211+ };
220212 };
221213222222- # Bootstrap a cross stdenv using LLVM libc.
223223- # This is currently not possible when compiling natively.
224224- pkgsLLVMLibc = mkCrossPkgs "pkgsLLVMLibc" {
225225- config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed);
226226- libc = "llvm";
214214+ pkgsLLVMLibc = nixpkgsFun {
215215+ overlays = [ (self': super': {
216216+ pkgsLLVMLibc = super';
217217+ })] ++ overlays;
218218+ # Bootstrap a cross stdenv using LLVM libc.
219219+ # This is currently not possible when compiling natively,
220220+ # so we don't need to check hostPlatform != buildPlatform.
221221+ crossSystem = stdenv.hostPlatform // {
222222+ config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed);
223223+ libc = "llvm";
224224+ };
227225 };
228226229229- # Bootstrap a cross stdenv using the Aro C compiler.
230230- # This is currently not possible when compiling natively.
231231- pkgsArocc = mkCrossPkgs "pkgsArocc" {
232232- useArocc = true;
233233- linker = "lld";
227227+ pkgsArocc = nixpkgsFun {
228228+ overlays = [
229229+ (self': super': {
230230+ pkgsArocc = super';
231231+ })
232232+ ] ++ overlays;
233233+ # Bootstrap a cross stdenv using the Aro C compiler.
234234+ # This is currently not possible when compiling natively,
235235+ # so we don't need to check hostPlatform != buildPlatform.
236236+ crossSystem = stdenv.hostPlatform // {
237237+ useArocc = true;
238238+ linker = "lld";
239239+ };
234240 };
235241236236- # Bootstrap a cross stdenv using the Zig toolchain.
237237- # This is currently not possible when compiling natively.
238238- pkgsZig = mkCrossPkgs "pkgsZig" {
239239- useZig = true;
240240- linker = "lld";
242242+ pkgsZig = nixpkgsFun {
243243+ overlays = [
244244+ (self': super': {
245245+ pkgsZig = super';
246246+ })
247247+ ] ++ overlays;
248248+ # Bootstrap a cross stdenv using the Zig toolchain.
249249+ # This is currently not possible when compiling natively,
250250+ # so we don't need to check hostPlatform != buildPlatform.
251251+ crossSystem = stdenv.hostPlatform // {
252252+ useZig = true;
253253+ linker = "lld";
254254+ };
241255 };
242256243257 # All packages built with the Musl libc. This will override the
244258 # default GNU libc on Linux systems. Non-Linux systems are not
245259 # supported. 32-bit is also not supported.
246246- pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then mkHybridPkgs "pkgsMusl" {
247247- config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed);
260260+ pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then nixpkgsFun {
261261+ overlays = [ (self': super': {
262262+ pkgsMusl = super';
263263+ })] ++ overlays;
264264+ ${if stdenv.hostPlatform == stdenv.buildPlatform
265265+ then "localSystem" else "crossSystem"} = {
266266+ config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed);
267267+ };
248268 } else throw "Musl libc only supports 64-bit Linux systems.";
249269250270 # All packages built for i686 Linux.
251271 # Used by wine, firefox with debugging version of Flash, ...
252252- pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then mkHybridPkgs "pkgsi686Linux" {
253253- config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
254254- cpu = lib.systems.parse.cpuTypes.i686;
255255- });
272272+ pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun {
273273+ overlays = [ (self': super': {
274274+ pkgsi686Linux = super';
275275+ })] ++ overlays;
276276+ ${if stdenv.hostPlatform == stdenv.buildPlatform
277277+ then "localSystem" else "crossSystem"} = {
278278+ config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
279279+ cpu = lib.systems.parse.cpuTypes.i686;
280280+ });
281281+ };
256282 } else throw "i686 Linux package set can only be used with the x86 family.";
257283258284 # x86_64-darwin packages for aarch64-darwin users to use with Rosetta for incompatible packages
259259- pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then mkHybridPkgs "pkgsx86_64Darwin" {
260260- config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
261261- cpu = lib.systems.parse.cpuTypes.x86_64;
262262- });
285285+ pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then nixpkgsFun {
286286+ overlays = [ (self': super': {
287287+ pkgsx86_64Darwin = super';
288288+ })] ++ overlays;
289289+ localSystem = {
290290+ config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
291291+ cpu = lib.systems.parse.cpuTypes.x86_64;
292292+ });
293293+ };
263294 } else throw "x86_64 Darwin package set can only be used on Darwin systems.";
264295265296 # If already linux: the same package set unaltered
266266- # Otherwise, return a linux package set for the current cpu architecture string.
297297+ # Otherwise, return a natively built linux package set for the current cpu architecture string.
267298 # (ABI and other details will be set to the default for the cpu/os pair)
268299 pkgsLinux =
269300 if stdenv.hostPlatform.isLinux
270301 then self
271271- else mkHybridPkgs "pkgsLinux" {
272272- config = lib.systems.parse.tripleFromSystem (lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux").parsed;
302302+ else nixpkgsFun {
303303+ localSystem = lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux";
273304 };
274305306306+ # Extend the package set with zero or more overlays. This preserves
307307+ # preexisting overlays. Prefer to initialize with the right overlays
308308+ # in one go when calling Nixpkgs, for performance and simplicity.
309309+ appendOverlays = extraOverlays:
310310+ if extraOverlays == []
311311+ then self
312312+ else nixpkgsFun { overlays = args.overlays ++ extraOverlays; };
313313+314314+ # NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB
315315+ # of allocations. DO NOT USE THIS IN NIXPKGS.
316316+ #
317317+ # Extend the package set with a single overlay. This preserves
318318+ # preexisting overlays. Prefer to initialize with the right overlays
319319+ # in one go when calling Nixpkgs, for performance and simplicity.
320320+ # Prefer appendOverlays if used repeatedly.
321321+ extend = f: self.appendOverlays [f];
322322+275323 # Fully static packages.
276324 # Currently uses Musl on Linux (couldn’t get static glibc to work).
277277- pkgsStatic = mkCrossPkgs "pkgsStatic" ({
278278- isStatic = true;
279279- } // lib.optionalAttrs stdenv.hostPlatform.isLinux {
280280- config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed);
281281- } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") {
282282- gcc = { abi = "elfv2"; } // stdenv.hostPlatform.gcc or {};
325325+ pkgsStatic = nixpkgsFun ({
326326+ overlays = [ (self': super': {
327327+ pkgsStatic = super';
328328+ })] ++ overlays;
329329+ crossSystem = {
330330+ isStatic = true;
331331+ config = lib.systems.parse.tripleFromSystem (
332332+ if stdenv.hostPlatform.isLinux
333333+ then makeMuslParsedPlatform stdenv.hostPlatform.parsed
334334+ else stdenv.hostPlatform.parsed
335335+ );
336336+ gcc = lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { abi = "elfv2"; } //
337337+ stdenv.hostPlatform.gcc or {};
338338+ };
283339 });
284340285285- pkgsExtraHardening = mkPkgs "pkgsExtraHardening" (_: {
341341+ pkgsExtraHardening = nixpkgsFun {
286342 overlays = [
287343 (self': super': {
344344+ pkgsExtraHardening = super';
288345 stdenv = super'.withDefaultHardeningFlags (
289346 super'.stdenv.cc.defaultHardeningFlags ++ [
290347 "shadowstack"
···303360 pcre-cpp = super'.pcre-cpp.override { enableJit = false; };
304361 pcre16 = super'.pcre16.override { enableJit = false; };
305362 })
306306- ];
307307- });
308308-309309- # Extend the package set with zero or more overlays. This preserves
310310- # preexisting overlays. Prefer to initialize with the right overlays
311311- # in one go when calling Nixpkgs, for performance and simplicity.
312312- appendOverlays = extraOverlays:
313313- if extraOverlays == []
314314- then self
315315- else nixpkgsFun (prevArgs: { overlays = prevArgs.overlays ++ extraOverlays; });
316316-317317- # NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB
318318- # of allocations. DO NOT USE THIS IN NIXPKGS.
319319- #
320320- # Extend the package set with a single overlay. This preserves
321321- # preexisting overlays. Prefer to initialize with the right overlays
322322- # in one go when calling Nixpkgs, for performance and simplicity.
323323- # Prefer appendOverlays if used repeatedly.
324324- extend = f: self.appendOverlays [f];
363363+ ] ++ overlays;
364364+ };
325365 };
326366327367 # The complete chain of package set builders, applied from top to bottom.