···
((config.packageOverrides or (super: {})) super);
# Convenience attributes for instantitating package sets. Each of
183
-
# these will instantiate a new version of allPackages.
184
-
otherPackageSets = let
185
-
mkPkgs = name: fn: nixpkgsFun (prevArgs: let nixpkgsArgs = fn prevArgs; in nixpkgsArgs // {
188
-
"${name}" = super';
190
-
] ++ nixpkgsArgs.overlays or [] ++ prevArgs.overlays or [];
192
-
# This is always cross.
193
-
mkCrossPkgs = name: crossAttrs: mkPkgs name (prevArgs: {
195
-
(lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // crossAttrs;
197
-
# This is only cross when we are already cross, otherwise local.
198
-
# For the case of "native cross", i.e. pkgsCross.gnu64 on a x86_64-linux system, we need to adjust **both**
199
-
# localSystem **and** crossSystem, otherwise they're out of sync.
200
-
mkHybridPkgs = name: hybridAttrs: mkPkgs name (prevArgs: let
201
-
newSystem = (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // hybridAttrs;
202
-
in { crossSystem = newSystem; }
203
-
// lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform) { localSystem = newSystem; }
183
+
# these will instantiate a new version of allPackages. Currently the
184
+
# following package sets are provided:
186
+
# - pkgsCross.<system> where system is a member of lib.systems.examples
189
+
otherPackageSets = self: super: {
# This maps each entry in lib.systems.examples to its own package
# set. Each of these will contain all packages cross compiled for
# that target system. For instance, pkgsCross.raspberryPi.hello,
# will refer to the "hello" package built for the ARM6-based
pkgsCross = lib.mapAttrs (n: crossSystem:
212
-
nixpkgsFun (prevArgs: { crossSystem = (lib.systems.systemToAttrs (lib.defaultTo { } prevArgs.crossSystem or null)) // crossSystem; }))
196
+
nixpkgsFun { inherit crossSystem; })
215
-
# Bootstrap a cross stdenv using the LLVM toolchain.
216
-
# This is currently not possible when compiling natively.
217
-
pkgsLLVM = mkCrossPkgs "pkgsLLVM" {
199
+
pkgsLLVM = nixpkgsFun {
205
+
# Bootstrap a cross stdenv using the LLVM toolchain.
206
+
# This is currently not possible when compiling natively,
207
+
# so we don't need to check hostPlatform != buildPlatform.
208
+
crossSystem = stdenv.hostPlatform // {
222
-
# Bootstrap a cross stdenv using LLVM libc.
223
-
# This is currently not possible when compiling natively.
224
-
pkgsLLVMLibc = mkCrossPkgs "pkgsLLVMLibc" {
225
-
config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed);
214
+
pkgsLLVMLibc = nixpkgsFun {
215
+
overlays = [ (self': super': {
216
+
pkgsLLVMLibc = super';
218
+
# Bootstrap a cross stdenv using LLVM libc.
219
+
# This is currently not possible when compiling natively,
220
+
# so we don't need to check hostPlatform != buildPlatform.
221
+
crossSystem = stdenv.hostPlatform // {
222
+
config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed);
229
-
# Bootstrap a cross stdenv using the Aro C compiler.
230
-
# This is currently not possible when compiling natively.
231
-
pkgsArocc = mkCrossPkgs "pkgsArocc" {
227
+
pkgsArocc = nixpkgsFun {
230
+
pkgsArocc = super';
233
+
# Bootstrap a cross stdenv using the Aro C compiler.
234
+
# This is currently not possible when compiling natively,
235
+
# so we don't need to check hostPlatform != buildPlatform.
236
+
crossSystem = stdenv.hostPlatform // {
236
-
# Bootstrap a cross stdenv using the Zig toolchain.
237
-
# This is currently not possible when compiling natively.
238
-
pkgsZig = mkCrossPkgs "pkgsZig" {
242
+
pkgsZig = nixpkgsFun {
248
+
# Bootstrap a cross stdenv using the Zig toolchain.
249
+
# This is currently not possible when compiling natively,
250
+
# so we don't need to check hostPlatform != buildPlatform.
251
+
crossSystem = stdenv.hostPlatform // {
# All packages built with the Musl libc. This will override the
# default GNU libc on Linux systems. Non-Linux systems are not
# supported. 32-bit is also not supported.
246
-
pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then mkHybridPkgs "pkgsMusl" {
247
-
config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed);
260
+
pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then nixpkgsFun {
261
+
overlays = [ (self': super': {
264
+
${if stdenv.hostPlatform == stdenv.buildPlatform
265
+
then "localSystem" else "crossSystem"} = {
266
+
config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed);
} else throw "Musl libc only supports 64-bit Linux systems.";
# All packages built for i686 Linux.
# Used by wine, firefox with debugging version of Flash, ...
252
-
pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then mkHybridPkgs "pkgsi686Linux" {
253
-
config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
254
-
cpu = lib.systems.parse.cpuTypes.i686;
272
+
pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun {
273
+
overlays = [ (self': super': {
274
+
pkgsi686Linux = super';
276
+
${if stdenv.hostPlatform == stdenv.buildPlatform
277
+
then "localSystem" else "crossSystem"} = {
278
+
config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
279
+
cpu = lib.systems.parse.cpuTypes.i686;
} else throw "i686 Linux package set can only be used with the x86 family.";
# x86_64-darwin packages for aarch64-darwin users to use with Rosetta for incompatible packages
259
-
pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then mkHybridPkgs "pkgsx86_64Darwin" {
260
-
config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
261
-
cpu = lib.systems.parse.cpuTypes.x86_64;
285
+
pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then nixpkgsFun {
286
+
overlays = [ (self': super': {
287
+
pkgsx86_64Darwin = super';
290
+
config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // {
291
+
cpu = lib.systems.parse.cpuTypes.x86_64;
} else throw "x86_64 Darwin package set can only be used on Darwin systems.";
# If already linux: the same package set unaltered
266
-
# Otherwise, return a linux package set for the current cpu architecture string.
297
+
# Otherwise, return a natively built linux package set for the current cpu architecture string.
# (ABI and other details will be set to the default for the cpu/os pair)
if stdenv.hostPlatform.isLinux
271
-
else mkHybridPkgs "pkgsLinux" {
272
-
config = lib.systems.parse.tripleFromSystem (lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux").parsed;
303
+
localSystem = lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux";
306
+
# Extend the package set with zero or more overlays. This preserves
307
+
# preexisting overlays. Prefer to initialize with the right overlays
308
+
# in one go when calling Nixpkgs, for performance and simplicity.
309
+
appendOverlays = extraOverlays:
310
+
if extraOverlays == []
312
+
else nixpkgsFun { overlays = args.overlays ++ extraOverlays; };
314
+
# NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB
315
+
# of allocations. DO NOT USE THIS IN NIXPKGS.
317
+
# Extend the package set with a single overlay. This preserves
318
+
# preexisting overlays. Prefer to initialize with the right overlays
319
+
# in one go when calling Nixpkgs, for performance and simplicity.
320
+
# Prefer appendOverlays if used repeatedly.
321
+
extend = f: self.appendOverlays [f];
# Currently uses Musl on Linux (couldn’t get static glibc to work).
277
-
pkgsStatic = mkCrossPkgs "pkgsStatic" ({
279
-
} // lib.optionalAttrs stdenv.hostPlatform.isLinux {
280
-
config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed);
281
-
} // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") {
282
-
gcc = { abi = "elfv2"; } // stdenv.hostPlatform.gcc or {};
325
+
pkgsStatic = nixpkgsFun ({
326
+
overlays = [ (self': super': {
327
+
pkgsStatic = super';
331
+
config = lib.systems.parse.tripleFromSystem (
332
+
if stdenv.hostPlatform.isLinux
333
+
then makeMuslParsedPlatform stdenv.hostPlatform.parsed
334
+
else stdenv.hostPlatform.parsed
336
+
gcc = lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { abi = "elfv2"; } //
337
+
stdenv.hostPlatform.gcc or {};
285
-
pkgsExtraHardening = mkPkgs "pkgsExtraHardening" (_: {
341
+
pkgsExtraHardening = nixpkgsFun {
344
+
pkgsExtraHardening = super';
stdenv = super'.withDefaultHardeningFlags (
super'.stdenv.cc.defaultHardeningFlags ++ [
···
pcre-cpp = super'.pcre-cpp.override { enableJit = false; };
pcre16 = super'.pcre16.override { enableJit = false; };
309
-
# Extend the package set with zero or more overlays. This preserves
310
-
# preexisting overlays. Prefer to initialize with the right overlays
311
-
# in one go when calling Nixpkgs, for performance and simplicity.
312
-
appendOverlays = extraOverlays:
313
-
if extraOverlays == []
315
-
else nixpkgsFun (prevArgs: { overlays = prevArgs.overlays ++ extraOverlays; });
317
-
# NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB
318
-
# of allocations. DO NOT USE THIS IN NIXPKGS.
320
-
# Extend the package set with a single overlay. This preserves
321
-
# preexisting overlays. Prefer to initialize with the right overlays
322
-
# in one go when calling Nixpkgs, for performance and simplicity.
323
-
# Prefer appendOverlays if used repeatedly.
324
-
extend = f: self.appendOverlays [f];
# The complete chain of package set builders, applied from top to bottom.