-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtop-level.nix
More file actions
1992 lines (1804 loc) · 59.7 KB
/
top-level.nix
File metadata and controls
1992 lines (1804 loc) · 59.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This a top-level overlay which is applied after this "autoCalled" pkgs directory.
# This mainly serves as a way to define attrs at the top-level of pkgs which
# require more than just passing default arguments to nix expressions
final: prev:
let
# TODO(corepkgs): deprecate lowPrio
inherit (final.lib) lowPrio;
in
with final;
{
# TODO(corepkgs): support NixOS tests
nixosTests = { };
tests = { };
# TODO(corepkgs): Create ekapkg specific version
nix-update-script = { };
nix-update = null;
nixos = null;
# These deps aren't needed for building, but only for passthru.tests
# TODO(corepkgs): get rid of this asserts when packages become available
qt5 = null;
libsForQt5 = null;
qt6 = null;
openjdk = null;
openjdk11 = null;
haskellPackages = null;
ocamlPackages = null;
phpExtensions = null;
# keep-sorted start
aafigure = null;
actdiag = null;
aria2 = null;
arrow-cpp = null;
awsebcli = null;
azmq = null;
babel = null;
bear = null;
bind = null;
blockdiag = null;
breathe = null;
chameleon = null;
chrony = null;
coeurl = null;
cppzmq = null;
cunit = null;
curlpp = null;
czmq = null;
dblatex = null;
dblatexFull = null;
diffoscopeMinimal = null;
distutils = null;
dulwich = null;
dvgrab = null;
e2fsprogs = null;
emacs = null;
enlightenment = null;
epeg = null;
epoll-shim = null; # for non-linux compat
epubcheck = null;
ettercap = null;
exiv2 = null;
fcitx5 = null;
fd = null;
feh = null;
ffmpeg = null;
firefox = null;
fltk = null;
fluxbox = null;
fop = null;
gd = null;
gdal = null;
gitstatus = null;
graphicsmagick = null;
graphviz = null;
grpc = null;
gtkmm3 = null;
gts = null;
gunicorn = null;
harfbuzz = null;
highlight = null;
htop = null;
icewm = null;
imagemagick = null;
imlib2 = null;
jansson = null;
jhead = null;
jre = null;
knot-dns = null;
knot-resolver_5 = null;
libXpm = null;
libavif = null;
libcaca = null;
libgeotiff = null;
libgit2-glib = null;
libguestfs = null;
libjxl = null;
libnatspec = null;
libnghttp2 = null;
libotr = null;
libsoup_3 = null;
libspiro = null;
libsysprof-capture = null;
libverto = null;
libvirt = null;
libzip = null;
lilypond = null;
lingua = null;
lynx = null;
mashumaro = null;
mathplotlib = null;
mc = null;
mjpegtools = null;
mkdocs = null;
mosquitto = null;
mpd = null;
mscgen = null;
multipath-tools = null;
mysql80 = null;
neovim = null;
netpbm = null;
nmap = null;
nodejs = null;
ntp = null;
nwdiag = null;
objgraph = null;
objprint = null;
openbox = null;
openconnect = null;
opencv = null;
openimageio = null;
opensbi = null; # RISC-V
ostinato = null;
pango = null;
php = null;
pika = null;
pinentry = null;
po4a = null;
poppler = null;
postgresql = null;
protobufc = null;
psutils = null;
pydantic = null;
pygame-ce = null;
qemu = null;
quart = null;
rich = null;
ripgrep = null;
rocksdb = null;
rpm = null;
rsyslog = null;
sage = null;
samba = null;
sbclPackages = null;
scribus = null;
seqdiag = null;
setproctitle = null;
spamassassin = null;
squid = null;
subversionClient = null;
tcpreplay = null;
termcap = null;
texmacs = null;
thunderbird = null;
tigervnc = null;
tiledb = null;
tinysparql = null;
tor = null;
tornado = null;
tracee = null;
trustme = null;
ttfautohint = null;
unixODBC = null;
uwsgi = null;
vde2 = null;
vips = null;
vlc = null;
werkzeug = null;
wezterm = null;
wireshark = null;
wlroots_0_17 = null;
wlroots_0_18 = null;
xattr = null;
xwayland = null;
yallback = null;
yamllint = null;
yara = null;
zmqpp = null;
# keep-sorted end
# TODO(corepkgs): support darwin
darwin = {
autoSignDarwinBinariesHook = null;
bootstrap_cmds = null;
signingUtils = null;
configd = null;
binutilsDualAs-unwrapped = null;
};
bootstrap_cmds = null;
apple-sdk = null;
xcodebuild = null;
xcbuild = null;
cctools = null;
# TODO(corepkgs): support windows
windows = null;
libgnurx = null;
# Non-GNU/Linux OSes are currently "impure" platforms, with their libc
# outside of the store. Thus, GCC, GFortran, & co. must always look for files
# in standard system directories (/usr/include, etc.)
# TODO(corepkgs): move into stdenv/linux.nix
noSysDirs =
stdenv.buildPlatform.system != "x86_64-solaris"
&& stdenv.buildPlatform.system != "x86_64-kfreebsd-gnu";
mkManyVariants = callFromScope ./pkgs/mkManyVariants { };
# A stdenv capable of building 32-bit binaries.
# On x86_64-linux, it uses GCC compiled with multilib support; on i686-linux,
# it's just the plain stdenv.
stdenv_32bit = lowPrio (if stdenv.hostPlatform.is32bit then stdenv else multiStdenv);
mkStdenvNoLibs =
stdenv:
let
bintools = stdenv.cc.bintools.override {
libc = null;
noLibc = true;
};
in
stdenv.override {
cc = stdenv.cc.override {
libc = null;
noLibc = true;
extraPackages = [ ];
inherit bintools;
};
allowedRequisites = lib.mapNullable (rs: rs ++ [ bintools ]) (stdenv.allowedRequisites or null);
};
stdenvNoLibs =
if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform then
# We cannot touch binutils or cc themselves, because that will cause
# infinite recursion. So instead, we just choose a libc based on the
# current platform. That means we won't respect whatever compiler was
# passed in with the stdenv stage argument.
#
# TODO It would be much better to pass the `stdenvNoCC` and *unwrapped*
# cc, bintools, compiler-rt equivalent, etc. and create all final stdenvs
# as part of the stage. Then we would never be tempted to override a later
# thing to to create an earlier thing (leading to infinite recursion) and
# we also would still respect the stage arguments choices for these
# things.
(
if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false then
overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoCompilerRt
else
gccCrossLibcStdenv
)
else
mkStdenvNoLibs stdenv;
stdenvNoLibc =
if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform then
(
if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false then
overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoLibc
else
gccCrossLibcStdenv
)
else
mkStdenvNoLibs stdenv;
gccStdenvNoLibs = mkStdenvNoLibs gccStdenv;
clangStdenvNoLibs = mkStdenvNoLibs clangStdenv;
glibc = callPackage ./pkgs/glibc (
if stdenv.hostPlatform != stdenv.buildPlatform then
{
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
# TODO(corepkgs): this is duplication of pkgs/gcc/common/libgcc.nix
libgcc = callPackage ./pkgs/glibc/libgcc-for-glibc.nix {
gcc = gccCrossLibcStdenv.cc;
glibc = glibc.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
};
}
else
{
stdenv = gccStdenv; # doesn't compile without gcc
}
);
# Only supported on Linux and only on glibc
glibcLocales =
if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu then
callPackage ./pkgs/glibc/locales.nix {
stdenv = if (!stdenv.cc.isGNU) then gccStdenv else stdenv;
withLinuxHeaders = !stdenv.cc.isGNU;
}
else
null;
glibcLocalesUtf8 =
if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu then
callPackage ./pkgs/glibc/locales.nix {
stdenv = if (!stdenv.cc.isGNU) then gccStdenv else stdenv;
withLinuxHeaders = !stdenv.cc.isGNU;
allLocales = false;
}
else
null;
glibcInfo = callPackage ./pkgs/glibc/info.nix { };
glibc_multi = callPackage ./pkgs/glibc/multi.nix {
# The buildPackages is required for cross-compilation. The pkgsi686Linux set
# has target and host always set to the same value based on target platform
# of the current set. We need host to be same as build to correctly get i686
# variant of glibc.
glibc32 = pkgsi686Linux.buildPackages.glibc;
};
libc =
let
inherit (stdenv.hostPlatform) libc;
# libc is hackily often used from the previous stage. This `or`
# hack fixes the hack, *sigh*.
in
if libc == null then
null
else if libc == "glibc" then
glibc
else if libc == "bionic" then
bionic
else if libc == "uclibc" then
uclibc
else if libc == "avrlibc" then
avrlibc
else if libc == "newlib" && stdenv.hostPlatform.isMsp430 then
msp430Newlib
else if libc == "newlib" && stdenv.hostPlatform.isVc4 then
vc4-newlib
else if libc == "newlib" && stdenv.hostPlatform.isOr1k then
or1k-newlib
else if libc == "newlib" then
newlib
else if libc == "newlib-nano" then
newlib-nano
else if libc == "musl" then
musl
else if libc == "msvcrt" then
windows.mingw_w64
else if libc == "ucrt" then
windows.mingw_w64
else if libc == "libSystem" then
if stdenv.hostPlatform.useiOSPrebuilt then darwin.iosSdkPkgs.libraries else darwin.libSystem
else if libc == "fblibc" then
freebsd.libc
else if libc == "oblibc" then
openbsd.libc
else if libc == "nblibc" then
netbsd.libc
else if libc == "wasilibc" then
wasilibc
else if libc == "relibc" then
relibc
else if name == "llvm" then
llvmPackages_20.libc
else
throw "Unknown libc ${libc}";
lit = with python3Packages; toPythonApplication lit;
binutils-unwrapped = callPackage ./pkgs/binutils {
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
};
binutils-unwrapped-all-targets = callPackage ./pkgs/binutils {
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
withAllTargets = true;
};
binutils = wrapBintoolsWith {
bintools = binutils-unwrapped;
};
binutils_nogold = lowPrio (wrapBintoolsWith {
bintools = binutils-unwrapped.override {
enableGold = false;
};
});
binutilsNoLibc = wrapBintoolsWith {
bintools = binutils-unwrapped;
libc = targetPackages.preLibcHeaders or preLibcHeaders;
};
libbfd = callPackage ./pkgs/binutils/libbfd.nix { };
libopcodes = callPackage ./pkgs/binutils/libopcodes.nix { };
# Held back 2.38 release. Remove once all dependencies are ported to 2.39.
binutils-unwrapped_2_38 = callPackage ./pkgs/binutils/2.38 {
autoreconfHook = autoconf.v2_69.autoreconfHook;
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
};
libbfd_2_38 = callPackage ./pkgs/binutils/2.38/libbfd.nix {
autoreconfHook = buildPackages.autoconf.v2_69.autoreconfHook;
};
libopcodes_2_38 = callPackage ./pkgs/binutils/2.38/libopcodes.nix {
autoreconfHook = buildPackages.autoconf.v2_69.autoreconfHook;
};
# Here we select the default bintools implementations to be used. Note when
# cross compiling these are used not for this stage but the *next* stage.
# That is why we choose using this stage's target platform / next stage's
# host platform.
#
# Because this is the *next* stages choice, it's a bit non-modular to put
# here. In theory, bootstrapping is supposed to not be a chain but at tree,
# where each stage supports many "successor" stages, like multiple possible
# futures. We don't have a better alternative, but with this downside in
# mind, please be judicious when using this attribute. E.g. for building
# things in *this* stage you should use probably `stdenv.cc.bintools` (from a
# default or alternate `stdenv`), at build time, and try not to "force" a
# specific bintools at runtime at all.
#
# In other words, try to only use this in wrappers, and only use those
# wrappers from the next stage.
bintools-unwrapped =
let
inherit (stdenv.targetPlatform) linker;
in
if linker == "lld" then
llvmPackages.bintools-unwrapped
else if linker == "cctools" then
darwin.binutils-unwrapped
else if linker == "bfd" then
binutils-unwrapped
else if linker == "gold" then
binutils-unwrapped.override { enableGoldDefault = true; }
else
null;
bintoolsNoLibc = wrapBintoolsWith {
bintools = bintools-unwrapped;
libc = targetPackages.preLibcHeaders or preLibcHeaders;
};
bintools = wrapBintoolsWith {
bintools = bintools-unwrapped;
};
bintoolsDualAs = wrapBintoolsWith {
bintools = darwin.binutilsDualAs-unwrapped;
wrapGas = true;
};
xorg =
let
# Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage`
# so as not to have the newly bound xorg items already in scope, which would
# have created a cycle.
overrides = lib.callPackageWith __splicedPackages ./pkgs/xorg/overrides.nix {
# TODO(corepkgs): support dawrin
# inherit (buildPackages.darwin) bootstrap_cmds;
udev = if stdenv.hostPlatform.isLinux then udev else null;
libdrm = if stdenv.hostPlatform.isLinux then libdrm else null;
};
# TODO(corepkgs): Move xorg's generated to a generated.nix, and move the package set
# logic into a default.nix
generatedPackages = lib.callPackageWith __splicedPackages ./pkgs/xorg { };
xorgPackages = makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "xorg";
f = lib.extends overrides generatedPackages;
};
in
lib.recurseIntoAttrs xorgPackages;
dbus = callPackage ./pkgs/dbus { };
makeDBusConf = callPackage ./pkgs/dbus/make-dbus-conf.nix { };
# TODO(corepkgs): move these fetchers into pkgs
fetchpatch =
callPackage ./pkgs/fetchpatch {
# 0.3.4 would change hashes: https://github.com/NixOS/nixpkgs/issues/25154
patchutils = __splicedPackages.patchutils_0_3_3;
}
// {
tests = pkgs.tests.fetchpatch;
version = 1;
};
fetchpatch2 =
callPackage ./pkgs/fetchpatch {
patchutils = __splicedPackages.patchutils_0_4_2;
}
// {
tests = pkgs.tests.fetchpatch2;
version = 2;
};
# TODO(corepkgs): uppercase them?
fetchurl =
if stdenv.buildPlatform != stdenv.hostPlatform then
buildPackages.fetchurl # No need to do special overrides twice,
else
lib.makeOverridable (import ./pkgs/fetchurl) {
inherit
lib
stdenvNoCC
buildPackages
cacert
config
;
curl = buildPackages.curlMinimal.override (old: rec {
# break dependency cycles
fetchurl = stdenv.fetchurlBoot;
zlib = buildPackages.zlib.override { fetchurl = stdenv.fetchurlBoot; };
pkg-config = buildPackages.pkg-config.override (old: {
pkg-config = old.pkg-config.override {
fetchurl = stdenv.fetchurlBoot;
};
});
perl = buildPackages.perl.override {
inherit zlib;
fetchurl = stdenv.fetchurlBoot;
};
openssl = buildPackages.openssl.override {
fetchurl = stdenv.fetchurlBoot;
buildPackages = {
coreutils = buildPackages.coreutils.override {
fetchurl = stdenv.fetchurlBoot;
inherit perl;
xz = buildPackages.xz.override { fetchurl = stdenv.fetchurlBoot; };
gmpSupport = false;
aclSupport = false;
attrSupport = false;
};
inherit perl;
};
inherit perl;
};
libssh2 = buildPackages.libssh2.override {
fetchurl = stdenv.fetchurlBoot;
inherit zlib openssl;
};
libkrb5 = buildPackages.krb5.override {
fetchurl = stdenv.fetchurlBoot;
inherit pkg-config perl openssl;
withLibedit = false;
byacc = buildPackages.byacc.override { fetchurl = stdenv.fetchurlBoot; };
keyutils = buildPackages.keyutils.override { fetchurl = stdenv.fetchurlBoot; };
};
nghttp2 = buildPackages.nghttp2.override {
fetchurl = stdenv.fetchurlBoot;
inherit pkg-config;
enableApp = false; # curl just needs libnghttp2
enableTests = false; # avoids bringing `cunit` and `tzdata` into scope
};
});
};
# TODO: proper freebsd port
freebsd = { };
fts = if stdenv.hostPlatform.isMusl then musl-fts else null;
inherit (callPackages ./build-support/setup-hooks/patch-rc-path-hooks { })
patchRcPathBash
patchRcPathCsh
patchRcPathFish
patchRcPathPosix
;
shortenPerlShebang = makeSetupHook {
name = "shorten-perl-shebang-hook";
propagatedBuildInputs = [ dieHook ];
} ./build-support/setup-hooks/shorten-perl-shebang.sh;
copyPkgconfigItems = makeSetupHook {
name = "copy-pkg-config-items-hook";
} ./build-support/setup-hooks/copy-pkgconfig-items.sh;
fixDarwinDylibNames = callPackage (
{
lib,
targetPackages,
makeSetupHook,
}:
makeSetupHook {
name = "fix-darwin-dylib-names-hook";
substitutions = { inherit (targetPackages.stdenv.cc) targetPrefix; };
meta.platforms = lib.platforms.darwin;
} ./build-support/setup-hooks/fix-darwin-dylib-names.sh
) { };
json-schema-for-humans = with python3Packages; toPythonApplication json-schema-for-humans;
makePkgconfigItem = callPackage ./build-support/make-pkgconfigitem { };
# TODO(corepkgs): alias?
mpi = openmpi; # this attribute should used to build MPI applications
# Default libGL implementation.
#
# Android NDK provides an OpenGL implementation, we can just use that.
#
# On macOS, the SDK provides the OpenGL framework in `stdenv`.
# Packages that still need GLX specifically can pull in `libGLX`
# instead. If you have a package that should work without X11 but it
# can’t find the library, it may help to add the path to
# `$NIX_CFLAGS_COMPILE`:
#
# preConfigure = ''
# export NIX_CFLAGS_COMPILE+=" -L$SDKROOT/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
# '';
#
libGL =
if stdenv.hostPlatform.useAndroidPrebuilt then
stdenv
else if stdenv.hostPlatform.isDarwin then
null
else
libglvnd;
# On macOS, the SDK provides the OpenGL framework in `stdenv`.
# Packages that use `libGLX` on macOS may need to depend on
# `mesa_glu` directly if this doesn’t work.
libGLU = if stdenv.hostPlatform.isDarwin then null else mesa_glu;
# `libglvnd` does not work (yet?) on macOS.
libGLX = if stdenv.hostPlatform.isDarwin then mesa else libglvnd;
# On macOS, the SDK provides the GLUT framework in `stdenv`. Packages
# that use `libGLX` on macOS may need to depend on `freeglut`
# directly if this doesn’t work.
libglut = if stdenv.hostPlatform.isDarwin then null else freeglut;
mesa =
if stdenv.hostPlatform.isDarwin then
callPackage ./pkgs/mesa/darwin.nix { }
else
callPackage ./pkgs/mesa { };
mesa_i686 = pkgsi686Linux.mesa; # make it build on Hydra
libgbm = callPackage ./pkgs/mesa/gbm.nix { };
mesa-gl-headers = callPackage ./pkgs/mesa/headers.nix { };
libunwind =
# Use the system unwinder in the SDK but provide a compatibility package to:
# 1. avoid evaluation errors with setting `unwind` to `null`; and
# 2. provide a `.pc` for compatibility with packages that expect to find libunwind that way.
if stdenv.hostPlatform.isDarwin then
darwin.libunwind
else if stdenv.hostPlatform.system == "riscv32-linux" then
llvmPackages.libunwind
else
callPackage ./pkgs/libunwind { };
# TODO(corepkgs): remove legacy
libxcrypt-legacy = libxcrypt.override { enableHashes = "all"; };
libxcrypt = callPackage ./pkgs/libxcrypt {
fetchurl = stdenv.fetchurlBoot;
perl = buildPackages.perl.override {
enableCrypt = false;
fetchurl = stdenv.fetchurlBoot;
};
};
# TODO: Remove alias
libjpeg = libjpeg_turbo;
# Less secure variant of lowdown for use inside Nix builds.
lowdown-unsandboxed = lowdown.override {
enableDarwinSandbox = false;
};
patchelf = callPackage ./pkgs/patchelf { };
patchelfUnstable = lowPrio (callPackage ./pkgs/patchelf/unstable.nix { });
# These are used when building compiler-rt / libgcc, prior to building libc.
preLibcHeaders =
let
inherit (stdenv.hostPlatform) libc;
in
if stdenv.hostPlatform.isMinGW then
windows.mingw_w64_headers or fallback
else if libc == "nblibc" then
netbsd.headers
else if libc == "cygwin" then
cygwin.newlib-cygwin-headers
else
null;
# TODO(corepkgs): This should be moved into unixtools
procps = if stdenv.hostPlatform.isLinux then procps-ng else unixtools.procps;
pruneLibtoolFiles = makeSetupHook {
name = "prune-libtool-files";
} ./build-support/setup-hooks/prune-libtool-files.sh;
default-gcc-version = 14;
gcc = pkgs.${"gcc${toString default-gcc-version}"};
gccFun = callPackage ./pkgs/gcc;
gcc-unwrapped = gcc.cc;
libgcc = stdenv.cc.cc.libgcc or null;
# This is for e.g. LLVM libraries on linux.
gccForLibs =
if
stdenv.targetPlatform == stdenv.hostPlatform && targetPackages.stdenv.cc.isGNU
# Can only do this is in the native case, otherwise we might get infinite
# recursion if `targetPackages.stdenv.cc.cc` itself uses `gccForLibs`.
then
targetPackages.stdenv.cc.cc
else
gcc.cc;
inherit
(rec {
# NOTE: keep this with the "NG" label until we're ready to drop the monolithic GCC
gccNGPackagesSet = lib.recurseIntoAttrs (callPackages ./pkgs/gcc/ng { });
gccNGPackages_15 = gccNGPackagesSet."15";
mkGCCNGPackages = gccNGPackagesSet.mkPackage;
})
gccNGPackages_15
mkGCCNGPackages
;
wrapNonDeterministicGcc =
stdenv: ccWrapper:
if ccWrapper.isGNU then
ccWrapper.overrideAttrs (old: {
env = old.env // {
cc = old.env.cc.override {
reproducibleBuild = false;
profiledCompiler = with stdenv; (!isDarwin && hostPlatform.isx86);
};
};
})
else
ccWrapper;
gfortran = wrapCC (
gcc.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
}
);
gobject-introspection-unwrapped = callPackage ./pkgs/gobject-introspection/unwrapped.nix { };
buildGoModule = buildGo125Module;
buildGo125Module = callPackage ./build-support/go/module.nix {
go = buildPackages.go_1_25;
};
buildGo124Module = callPackage ./build-support/go/module.nix {
go = buildPackages.go_1_24;
};
# TODO(corepkgs): proper attrset of utilities
gnome = { };
gnuStdenv =
if stdenv.cc.isGNU then
stdenv
else
gccStdenv.override {
cc = gccStdenv.cc.override {
bintools = buildPackages.binutils;
};
};
gccStdenv =
if stdenv.cc.isGNU then
stdenv
else
stdenv.override {
cc = buildPackages.gcc;
allowedRequisites = null;
# Remove libcxx/libcxxabi, and add clang for AS if on darwin (it uses
# clang's internal assembler).
extraBuildInputs = lib.optional stdenv.hostPlatform.isDarwin clang.cc;
};
gcc13Stdenv = overrideCC gccStdenv buildPackages.gcc13;
gcc14Stdenv = overrideCC gccStdenv buildPackages.gcc14;
gcc15Stdenv = overrideCC gccStdenv buildPackages.gcc15;
# This is not intended for use in nixpkgs but for providing a faster-running
# compiler to nixpkgs users by building gcc with reproducibility-breaking
# profile-guided optimizations
fastStdenv = overrideCC gccStdenv (wrapNonDeterministicGcc gccStdenv buildPackages.gcc_latest);
wrapCCMulti =
cc:
let
# Binutils with glibc multi
bintools = cc.bintools.override {
libc = glibc_multi;
};
in
lowPrio (wrapCCWith {
cc = cc.cc.override {
stdenv = overrideCC stdenv (wrapCCWith {
cc = cc.cc;
inherit bintools;
libc = glibc_multi;
});
profiledCompiler = false;
enableMultilib = true;
};
libc = glibc_multi;
inherit bintools;
extraBuildCommands = ''
echo "dontMoveLib64=1" >> $out/nix-support/setup-hook
'';
});
wrapClangMulti =
clang:
callPackage ./development/compilers/llvm/multi.nix {
inherit clang;
gcc32 = pkgsi686Linux.gcc;
gcc64 = pkgs.gcc;
};
gcc_multi = wrapCCMulti gcc;
clang_multi = wrapClangMulti clang;
gccMultiStdenv = overrideCC stdenv buildPackages.gcc_multi;
clangMultiStdenv = overrideCC stdenv buildPackages.clang_multi;
multiStdenv = if stdenv.cc.isClang then clangMultiStdenv else gccMultiStdenv;
gcc_debug = lowPrio (
wrapCC (
gcc.cc.overrideAttrs {
dontStrip = true;
}
)
);
gccCrossLibcStdenv = overrideCC stdenvNoCC buildPackages.gccWithoutTargetLibc;
# The GCC used to build libc for the target platform. Normal gccs will be
# built with, and use, that cross-compiled libc.
gccWithoutTargetLibc =
let
libc1 = binutilsNoLibc.libc;
in
(wrapCCWith {
cc = gccFun {
# copy-pasted
inherit noSysDirs;
majorMinorVersion = toString default-gcc-version;
reproducibleBuild = true;
profiledCompiler = false;
isl = if !stdenv.hostPlatform.isDarwin then isl else null;
withoutTargetLibc = true;
langCC = stdenv.targetPlatform.isCygwin; # can't compile libcygwin1.a without C++
libcCross = libc1;
targetPackages.stdenv.cc.bintools = binutilsNoLibc;
enableShared =
stdenv.targetPlatform.hasSharedLibraries
# temporarily disabled due to breakage;
# see https://github.com/NixOS/nixpkgs/pull/243249
&& !stdenv.targetPlatform.isWindows
&& !stdenv.targetPlatform.isCygwin
&& !(stdenv.targetPlatform.useLLVM or false);
};
bintools = binutilsNoLibc;
libc = libc1;
extraPackages = [ ];
}).overrideAttrs
(prevAttrs: {
meta = prevAttrs.meta // {
badPlatforms =
(prevAttrs.meta.badPlatforms or [ ])
++ lib.optionals (stdenv.targetPlatform == stdenv.hostPlatform) [ stdenv.hostPlatform.system ];
};
});
# TODO(corepkgs): use mkManyVariants
inherit (callPackage ./pkgs/gcc/all.nix { inherit noSysDirs; })
gcc13
gcc14
gcc15
;
gcc_latest = gcc15;
libgccjit = gcc.cc.override {
name = "libgccjit";
langFortran = false;
langCC = false;
langC = false;
profiledCompiler = false;
langJit = true;
enableLTO = false;
};
# Utility to extract just the source from a derivation
srcOnly =
args:
(callPackage (
{
runCommand,
lib,
stdenvNoCC,
}:
drv:
runCommand "${drv.name}-src"
{
outputs = [ "out" ];
preferLocalBuild = true;
}
''
mkdir -p $out
${lib.concatMapStringsSep "\n" (output: ''
if [ -d "${drv.${output}}" ]; then
cp -r "${drv.${output}}"/* $out/
fi
'') (drv.outputs or [ "out" ])}
''
) { } args);
wrapCCWith =
{
cc,
# This should be the only bintools runtime dep with this sort of logic. The
# Others should instead delegate to the next stage's choice with
# `targetPackages.stdenv.cc.bintools`. This one is different just to
# provide the default choice, avoiding infinite recursion.
# See the bintools attribute for the logic and reasoning. We need to provide
# a default here, since eval will hit this function when bootstrapping
# stdenv where the bintools attribute doesn't exist, but will never actually
# be evaluated -- callPackage ends up being too eager.
bintools ? pkgs.bintools,
libc ? bintools.libc,
# libc++ from the default LLVM version is bound at the top level, but we
# want the C++ library to be explicitly chosen by the caller, and null by
# default.
libcxx ? null,
extraPackages ? lib.optional (
cc.isGNU or false && stdenv.targetPlatform.isMinGW
) targetPackages.threads.package,
nixSupport ? { },
...
}@extraArgs:
callPackage ./build-support/cc-wrapper (
let
self = {
nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false;
nativeLibc = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeLibc or false;
nativePrefix = stdenv.cc.nativePrefix or "";
noLibc = !self.nativeLibc && (self.libc == null);
isGNU = cc.isGNU or false;
isClang = cc.isClang or false;
isArocc = cc.isArocc or false;
isZig = cc.isZig or false;
inherit
lib
cc
bintools
libc
libcxx
extraPackages
nixSupport
;
}
// extraArgs;
in
self
);
wrapCC =
cc:
wrapCCWith {
inherit cc;
};
wrapBintoolsWith =
{
bintools,
libc ? targetPackages.libc or pkgs.libc,
...
}@extraArgs:
callPackage ./build-support/bintools-wrapper (
let
self = {