git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #107214 from Ericson2314/linux-config-cleanup

lib: Clean up how linux and gcc config is specified

commitd95aebbe0e723cb3d275d68b8529f0891a23df96 authorJohn Ericson <git@JohnEricson.me> dateFri 22 Jan 2021, 15:15 (6 years ago) parent412a9e78929989
37 files changed+454−448
lib/systems/default.nix+10−3 lib/systems/examples.nix+10−38 lib/systems/platforms.nix+341−329 nixos/doc/manual/release-notes/rl-2103.xml+16 nixos/modules/hardware/device-tree.nix+4−4 nixos/modules/installer/netboot/netboot.nix+1−1 nixos/modules/services/misc/nix-daemon.nix+4−4 nixos/modules/system/activation/top-level.nix+1−1 nixos/modules/system/boot/loader/generations-dir/generations-dir.nix+1−1 nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix+1−1 nixos/release.nix+2−2 pkgs/applications/audio/virtual-ans/default.nix+1−1 pkgs/applications/virtualization/crosvm/default.nix+1−1 pkgs/applications/virtualization/vpcs/default.nix+1−1 pkgs/build-support/bintools-wrapper/default.nix+1−1 pkgs/build-support/cc-wrapper/default.nix+8−8 pkgs/build-support/kernel/make-initrd.nix+2−2 pkgs/build-support/vm/default.nix+1−1 pkgs/development/compilers/gcc/common/platform-flags.nix+1−1 pkgs/development/compilers/julia/1.0.nix+1−1 pkgs/development/compilers/julia/1.3.nix+1−1 pkgs/development/compilers/julia/1.5.nix+1−1 pkgs/development/libraries/glibc/common.nix+1−1 pkgs/development/libraries/qt-5/modules/qtwebengine.nix+1−1 pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix+3−3 pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix+1−1 pkgs/development/web/nodejs/nodejs.nix+5−6 pkgs/os-specific/linux/exfat/default.nix+1−1 pkgs/os-specific/linux/kernel-headers/default.nix+1−1 pkgs/os-specific/linux/kernel/generic.nix+9−9 pkgs/os-specific/linux/kernel/manual-config.nix+15−15 pkgs/os-specific/linux/klibc/default.nix+2−2 pkgs/os-specific/linux/rtl8723bs/default.nix+1−1 pkgs/os-specific/linux/rtl8812au/default.nix+1−1 pkgs/os-specific/linux/uclibc/default.nix+1−1 pkgs/stdenv/generic/make-derivation.nix+1−1 pkgs/top-level/all-packages.nix+1−1
lib/systems/default.nix+10−3
@@ -24,8 +24,6 @@ rec {
2424 # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds.
2525 system = parse.doubleFromSystem final.parsed;
2626 config = parse.tripleFromSystem final.parsed;
27− # Just a guess, based on `system`
28− platform = platforms.select final;
2927 # Determine whether we are compatible with the provided CPU
3028 isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
3129 # Derived meta-data
@@ -79,7 +77,16 @@ rec {
7977 };
8078 isStatic = final.isWasm || final.isRedox;
8179
82− kernelArch =
80+ # Just a guess, based on `system`
81+ inherit
82+ ({
83+ linux-kernel = args.linux-kernel or {};
84+ gcc = args.gcc or {};
85+ rustc = args.rust or {};
86+ } // platforms.select final)
87+ linux-kernel gcc rustc;
88+
89+ linuxArch =
8390 if final.isAarch32 then "arm"
8491 else if final.isAarch64 then "arm64"
8592 else if final.isx86_32 then "x86"
lib/systems/examples.nix+10−38
@@ -7,7 +7,6 @@ let
77
88 riscv = bits: {
99 config = "riscv${bits}-unknown-linux-gnu";
10− platform = platforms.riscv-multiplatform;
1110 };
1211in
1312
@@ -17,84 +16,68 @@ rec {
1716 #
1817 powernv = {
1918 config = "powerpc64le-unknown-linux-gnu";
20− platform = platforms.powernv;
2119 };
2220 musl-power = {
2321 config = "powerpc64le-unknown-linux-musl";
24− platform = platforms.powernv;
2522 };
2623
2724 sheevaplug = {
2825 config = "armv5tel-unknown-linux-gnueabi";
29− platform = platforms.sheevaplug;
30− };
26+ } // platforms.sheevaplug;
3127
3228 raspberryPi = {
3329 config = "armv6l-unknown-linux-gnueabihf";
34− platform = platforms.raspberrypi;
35− };
30+ } // platforms.raspberrypi;
3631
3732 remarkable1 = {
3833 config = "armv7l-unknown-linux-gnueabihf";
39− platform = platforms.zero-gravitas;
40− };
34+ } // platforms.zero-gravitas;
4135
4236 remarkable2 = {
4337 config = "armv7l-unknown-linux-gnueabihf";
44− platform = platforms.zero-sugar;
45− };
38+ } // platforms.zero-sugar;
4639
4740 armv7l-hf-multiplatform = {
4841 config = "armv7l-unknown-linux-gnueabihf";
49− platform = platforms.armv7l-hf-multiplatform;
5042 };
5143
5244 aarch64-multiplatform = {
5345 config = "aarch64-unknown-linux-gnu";
54− platform = platforms.aarch64-multiplatform;
5546 };
5647
5748 armv7a-android-prebuilt = {
5849 config = "armv7a-unknown-linux-androideabi";
5950 sdkVer = "29";
6051 ndkVer = "21";
61− platform = platforms.armv7a-android;
6252 useAndroidPrebuilt = true;
63− };
53+ } // platforms.armv7a-android;
6454
6555 aarch64-android-prebuilt = {
6656 config = "aarch64-unknown-linux-android";
6757 sdkVer = "29";
6858 ndkVer = "21";
69− platform = platforms.aarch64-multiplatform;
7059 useAndroidPrebuilt = true;
7160 };
7261
73− scaleway-c1 = armv7l-hf-multiplatform // rec {
74− platform = platforms.scaleway-c1;
75− inherit (platform.gcc) fpu;
76− };
62+ scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1;
7763
7864 pogoplug4 = {
7965 config = "armv5tel-unknown-linux-gnueabi";
80− platform = platforms.pogoplug4;
81− };
66+ } // platforms.pogoplug4;
8267
8368 ben-nanonote = {
8469 config = "mipsel-unknown-linux-uclibc";
85− platform = platforms.ben_nanonote;
86− };
70+ } // platforms.ben_nanonote;
8771
8872 fuloongminipc = {
8973 config = "mipsel-unknown-linux-gnu";
90− platform = platforms.fuloong2f_n32;
91− };
74+ } // platforms.fuloong2f_n32;
9275
9376 muslpi = raspberryPi // {
9477 config = "armv6l-unknown-linux-musleabihf";
9578 };
9679
97− aarch64-multiplatform-musl = aarch64-multiplatform // {
80+ aarch64-multiplatform-musl = {
9881 config = "aarch64-unknown-linux-musl";
9982 };
10083
@@ -110,13 +93,11 @@ rec {
11093 riscv64-embedded = {
11194 config = "riscv64-none-elf";
11295 libc = "newlib";
113− platform = platforms.riscv-multiplatform;
11496 };
11597
11698 riscv32-embedded = {
11799 config = "riscv32-none-elf";
118100 libc = "newlib";
119− platform = platforms.riscv-multiplatform;
120101 };
121102
122103 mmix = {
@@ -136,13 +117,11 @@ rec {
136117 vc4 = {
137118 config = "vc4-elf";
138119 libc = "newlib";
139− platform = {};
140120 };
141121
142122 or1k = {
143123 config = "or1k-elf";
144124 libc = "newlib";
145− platform = {};
146125 };
147126
148127 arm-embedded = {
@@ -204,7 +183,6 @@ rec {
204183 xcodeVer = "11.3.1";
205184 xcodePlatform = "iPhoneOS";
206185 useiOSPrebuilt = true;
207− platform = {};
208186 };
209187
210188 iphone32 = {
@@ -214,7 +192,6 @@ rec {
214192 xcodeVer = "11.3.1";
215193 xcodePlatform = "iPhoneOS";
216194 useiOSPrebuilt = true;
217− platform = {};
218195 };
219196
220197 iphone64-simulator = {
@@ -224,7 +201,6 @@ rec {
224201 xcodeVer = "11.3.1";
225202 xcodePlatform = "iPhoneSimulator";
226203 useiOSPrebuilt = true;
227− platform = {};
228204 };
229205
230206 iphone32-simulator = {
@@ -234,7 +210,6 @@ rec {
234210 xcodeVer = "11.3.1";
235211 xcodePlatform = "iPhoneSimulator";
236212 useiOSPrebuilt = true;
237− platform = {};
238213 };
239214
240215 #
@@ -245,7 +220,6 @@ rec {
245220 mingw32 = {
246221 config = "i686-w64-mingw32";
247222 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
248− platform = {};
249223 };
250224
251225 # 64 bit mingw-w64
@@ -253,7 +227,6 @@ rec {
253227 # That's the triplet they use in the mingw-w64 docs.
254228 config = "x86_64-w64-mingw32";
255229 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
256− platform = {};
257230 };
258231
259232 # BSDs
@@ -275,6 +248,5 @@ rec {
275248 # Ghcjs
276249 ghcjs = {
277250 config = "js-unknown-ghcjs";
278− platform = {};
279251 };
280252}
lib/systems/platforms.nix+341−329
@@ -1,39 +1,36 @@
11{ lib }:
22rec {
3− pcBase = {
4− name = "pc";
5− kernelBaseConfig = "defconfig";
6− # Build whatever possible as a module, if not stated in the extra config.
7− kernelAutoModules = true;
8− kernelTarget = "bzImage";
9− };
10−
11− pc64 = pcBase // { kernelArch = "x86_64"; };
12−
13− pc32 = pcBase // { kernelArch = "i386"; };
14−
15− pc32_simplekernel = pc32 // {
16− kernelAutoModules = false;
3+ pc = {
4+ linux-kernel = {
5+ name = "pc";
6+
7+ baseConfig = "defconfig";
8+ # Build whatever possible as a module, if not stated in the extra config.
9+ autoModules = true;
10+ target = "bzImage";
11+ };
1712 };
1813
19− pc64_simplekernel = pc64 // {
20− kernelAutoModules = false;
14+ pc_simplekernel = lib.recursiveUpdate pc {
15+ linux-kernel.autoModules = false;
2116 };
2217
2318 powernv = {
24− name = "PowerNV";
25− kernelArch = "powerpc";
26− kernelBaseConfig = "powernv_defconfig";
27− kernelTarget = "zImage";
28− kernelInstallTarget = "install";
29− kernelFile = "vmlinux";
30− kernelAutoModules = true;
31− # avoid driver/FS trouble arising from unusual page size
32− kernelExtraConfig = ''
33− PPC_64K_PAGES n
34− PPC_4K_PAGES y
35− IPV6 y
36− '';
19+ linux-kernel = {
20+ name = "PowerNV";
21+
22+ baseConfig = "powernv_defconfig";
23+ target = "zImage";
24+ installTarget = "install";
25+ file = "vmlinux";
26+ autoModules = true;
27+ # avoid driver/FS trouble arising from unusual page size
28+ extraConfig = ''
29+ PPC_64K_PAGES n
30+ PPC_4K_PAGES y
31+ IPV6 y
32+ '';
33+ };
3734 };
3835
3936 ##
@@ -41,17 +38,121 @@ rec {
4138 ##
4239
4340 pogoplug4 = {
44− name = "pogoplug4";
41+ linux-kernel = {
42+ name = "pogoplug4";
4543
44+ baseConfig = "multi_v5_defconfig";
45+ autoModules = false;
46+ extraConfig = ''
47+ # Ubi for the mtd
48+ MTD_UBI y
49+ UBIFS_FS y
50+ UBIFS_FS_XATTR y
51+ UBIFS_FS_ADVANCED_COMPR y
52+ UBIFS_FS_LZO y
53+ UBIFS_FS_ZLIB y
54+ UBIFS_FS_DEBUG n
55+ '';
56+ makeFlags = [ "LOADADDR=0x8000" ];
57+ target = "uImage";
58+ # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working
59+ #DTB = true;
60+ };
4661 gcc = {
4762 arch = "armv5te";
4863 };
64+ };
65+
66+ sheevaplug = {
67+ linux-kernel = {
68+ name = "sheevaplug";
69+
70+ baseConfig = "multi_v5_defconfig";
71+ autoModules = false;
72+ extraConfig = ''
73+ BLK_DEV_RAM y
74+ BLK_DEV_INITRD y
75+ BLK_DEV_CRYPTOLOOP m
76+ BLK_DEV_DM m
77+ DM_CRYPT m
78+ MD y
79+ REISERFS_FS m
80+ BTRFS_FS m
81+ XFS_FS m
82+ JFS_FS m
83+ EXT4_FS m
84+ USB_STORAGE_CYPRESS_ATACB m
85+
86+ # mv cesa requires this sw fallback, for mv-sha1
87+ CRYPTO_SHA1 y
88+ # Fast crypto
89+ CRYPTO_TWOFISH y
90+ CRYPTO_TWOFISH_COMMON y
91+ CRYPTO_BLOWFISH y
92+ CRYPTO_BLOWFISH_COMMON y
93+
94+ IP_PNP y
95+ IP_PNP_DHCP y
96+ NFS_FS y
97+ ROOT_NFS y
98+ TUN m
99+ NFS_V4 y
100+ NFS_V4_1 y
101+ NFS_FSCACHE y
102+ NFSD m
103+ NFSD_V2_ACL y
104+ NFSD_V3 y
105+ NFSD_V3_ACL y
106+ NFSD_V4 y
107+ NETFILTER y
108+ IP_NF_IPTABLES y
109+ IP_NF_FILTER y
110+ IP_NF_MATCH_ADDRTYPE y
111+ IP_NF_TARGET_LOG y
112+ IP_NF_MANGLE y
113+ IPV6 m
114+ VLAN_8021Q m
115+
116+ CIFS y
117+ CIFS_XATTR y
118+ CIFS_POSIX y
119+ CIFS_FSCACHE y
120+ CIFS_ACL y
121+
122+ WATCHDOG y
123+ WATCHDOG_CORE y
124+ ORION_WATCHDOG m
125+
126+ ZRAM m
127+ NETCONSOLE m
128+
129+ # Disable OABI to have seccomp_filter (required for systemd)
130+ # https://github.com/raspberrypi/firmware/issues/651
131+ OABI_COMPAT n
132+
133+ # Fail to build
134+ DRM n
135+ SCSI_ADVANSYS n
136+ USB_ISP1362_HCD n
137+ SND_SOC n
138+ SND_ALI5451 n
139+ FB_SAVAGE n
140+ SCSI_NSP32 n
141+ ATA_SFF n
142+ SUNGEM n
143+ IRDA n
144+ ATM_HE n
145+ SCSI_ACARD n
146+ BLK_DEV_CMD640_ENHANCED n
147+
148+ FUSE_FS m
149+
150+ # systemd uses cgroups
151+ CGROUPS y
152+
153+ # Latencytop
154+ LATENCYTOP y
49155
50− kernelBaseConfig = "multi_v5_defconfig";
51− kernelArch = "arm";
52− kernelAutoModules = false;
53− kernelExtraConfig =
54− ''
55156 # Ubi for the mtd
56157 MTD_UBI y
57158 UBIFS_FS y
@@ -60,137 +161,36 @@ rec {
60161 UBIFS_FS_LZO y
61162 UBIFS_FS_ZLIB y
62163 UBIFS_FS_DEBUG n
63− '';
64− kernelMakeFlags = [ "LOADADDR=0x8000" ];
65− kernelTarget = "uImage";
66− # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working
67− #kernelDTB = true;
68− };
69164
70− sheevaplug = {
71− name = "sheevaplug";
72− kernelBaseConfig = "multi_v5_defconfig";
73− kernelArch = "arm";
74− kernelAutoModules = false;
75− kernelExtraConfig = ''
76− BLK_DEV_RAM y
77− BLK_DEV_INITRD y
78− BLK_DEV_CRYPTOLOOP m
79− BLK_DEV_DM m
80− DM_CRYPT m
81− MD y
82− REISERFS_FS m
83− BTRFS_FS m
84− XFS_FS m
85− JFS_FS m
86− EXT4_FS m
87− USB_STORAGE_CYPRESS_ATACB m
88−
89− # mv cesa requires this sw fallback, for mv-sha1
90− CRYPTO_SHA1 y
91− # Fast crypto
92− CRYPTO_TWOFISH y
93− CRYPTO_TWOFISH_COMMON y
94− CRYPTO_BLOWFISH y
95− CRYPTO_BLOWFISH_COMMON y
96−
97− IP_PNP y
98− IP_PNP_DHCP y
99− NFS_FS y
100− ROOT_NFS y
101− TUN m
102− NFS_V4 y
103− NFS_V4_1 y
104− NFS_FSCACHE y
105− NFSD m
106− NFSD_V2_ACL y
107− NFSD_V3 y
108− NFSD_V3_ACL y
109− NFSD_V4 y
110− NETFILTER y
111− IP_NF_IPTABLES y
112− IP_NF_FILTER y
113− IP_NF_MATCH_ADDRTYPE y
114− IP_NF_TARGET_LOG y
115− IP_NF_MANGLE y
116− IPV6 m
117− VLAN_8021Q m
118−
119− CIFS y
120− CIFS_XATTR y
121− CIFS_POSIX y
122− CIFS_FSCACHE y
123− CIFS_ACL y
124−
125− WATCHDOG y
126− WATCHDOG_CORE y
127− ORION_WATCHDOG m
128−
129− ZRAM m
130− NETCONSOLE m
131−
132− # Disable OABI to have seccomp_filter (required for systemd)
133− # https://github.com/raspberrypi/firmware/issues/651
134− OABI_COMPAT n
135−
136− # Fail to build
137− DRM n
138− SCSI_ADVANSYS n
139− USB_ISP1362_HCD n
140− SND_SOC n
141− SND_ALI5451 n
142− FB_SAVAGE n
143− SCSI_NSP32 n
144− ATA_SFF n
145− SUNGEM n
146− IRDA n
147− ATM_HE n
148− SCSI_ACARD n
149− BLK_DEV_CMD640_ENHANCED n
150−
151− FUSE_FS m
152−
153− # systemd uses cgroups
154− CGROUPS y
155−
156− # Latencytop
157− LATENCYTOP y
158−
159− # Ubi for the mtd
160− MTD_UBI y
161− UBIFS_FS y
162− UBIFS_FS_XATTR y
163− UBIFS_FS_ADVANCED_COMPR y
164− UBIFS_FS_LZO y
165− UBIFS_FS_ZLIB y
166− UBIFS_FS_DEBUG n
167−
168− # Kdb, for kernel troubles
169− KGDB y
170− KGDB_SERIAL_CONSOLE y
171− KGDB_KDB y
172− '';
173− kernelMakeFlags = [ "LOADADDR=0x0200000" ];
174− kernelTarget = "uImage";
175− kernelDTB = true; # Beyond 3.10
165+ # Kdb, for kernel troubles
166+ KGDB y
167+ KGDB_SERIAL_CONSOLE y
168+ KGDB_KDB y
169+ '';
170+ makeFlags = [ "LOADADDR=0x0200000" ];
171+ target = "uImage";
172+ DTB = true; # Beyond 3.10
173+ };
176174 gcc = {
177175 arch = "armv5te";
178176 };
179177 };
180178
181179 raspberrypi = {
182− name = "raspberrypi";
183− kernelBaseConfig = "bcm2835_defconfig";
184− kernelDTB = true;
185− kernelArch = "arm";
186− kernelAutoModules = true;
187− kernelPreferBuiltin = true;
188− kernelExtraConfig = ''
189− # Disable OABI to have seccomp_filter (required for systemd)
190− # https://github.com/raspberrypi/firmware/issues/651
191− OABI_COMPAT n
192− '';
193− kernelTarget = "zImage";
180+ linux-kernel = {
181+ name = "raspberrypi";
182+
183+ baseConfig = "bcm2835_defconfig";
184+ DTB = true;
185+ autoModules = true;
186+ preferBuiltin = true;
187+ extraConfig = ''
188+ # Disable OABI to have seccomp_filter (required for systemd)
189+ # https://github.com/raspberrypi/firmware/issues/651
190+ OABI_COMPAT n
191+ '';
192+ target = "zImage";
193+ };
194194 gcc = {
195195 arch = "armv6";
196196 fpu = "vfp";
@@ -201,13 +201,15 @@ rec {
201201 raspberrypi2 = armv7l-hf-multiplatform;
202202
203203 zero-gravitas = {
204− name = "zero-gravitas";
205− kernelBaseConfig = "zero-gravitas_defconfig";
206− kernelArch = "arm";
207− # kernelTarget verified by checking /boot on reMarkable 1 device
208− kernelTarget = "zImage";
209− kernelAutoModules = false;
210− kernelDTB = true;
204+ linux-kernel = {
205+ name = "zero-gravitas";
206+
207+ baseConfig = "zero-gravitas_defconfig";
208+ # Target verified by checking /boot on reMarkable 1 device
209+ target = "zImage";
210+ autoModules = false;
211+ DTB = true;
212+ };
211213 gcc = {
212214 fpu = "neon";
213215 cpu = "cortex-a9";
@@ -215,13 +217,15 @@ rec {
215217 };
216218
217219 zero-sugar = {
218− name = "zero-sugar";
219− kernelBaseConfig = "zero-sugar_defconfig";
220− kernelArch = "arm";
221− kernelDTB = true;
222− kernelAutoModules = false;
223− kernelPreferBuiltin = true;
224− kernelTarget = "zImage";
220+ linux-kernel = {
221+ name = "zero-sugar";
222+
223+ baseConfig = "zero-sugar_defconfig";
224+ DTB = true;
225+ autoModules = false;
226+ preferBuiltin = true;
227+ target = "zImage";
228+ };
225229 gcc = {
226230 cpu = "cortex-a7";
227231 fpu = "neon-vfpv4";
@@ -229,7 +233,7 @@ rec {
229233 };
230234 };
231235
232− scaleway-c1 = armv7l-hf-multiplatform // {
236+ scaleway-c1 = lib.recursiveUpdate armv7l-hf-multiplatform {
233237 gcc = {
234238 cpu = "cortex-a9";
235239 fpu = "vfpv3";
@@ -237,12 +241,11 @@ rec {
237241 };
238242
239243 utilite = {
240− name = "utilite";
241− kernelBaseConfig = "multi_v7_defconfig";
242− kernelArch = "arm";
243− kernelAutoModules = false;
244− kernelExtraConfig =
245− ''
244+ linux-kernel = {
245+ name = "utilite";
246+ maseConfig = "multi_v7_defconfig";
247+ autoModules = false;
248+ extraConfig = ''
246249 # Ubi for the mtd
247250 MTD_UBI y
248251 UBIFS_FS y
@@ -252,35 +255,37 @@ rec {
252255 UBIFS_FS_ZLIB y
253256 UBIFS_FS_DEBUG n
254257 '';
255− kernelMakeFlags = [ "LOADADDR=0x10800000" ];
256− kernelTarget = "uImage";
257− kernelDTB = true;
258+ makeFlags = [ "LOADADDR=0x10800000" ];
259+ target = "uImage";
260+ DTB = true;
261+ };
258262 gcc = {
259263 cpu = "cortex-a9";
260264 fpu = "neon";
261265 };
262266 };
263267
264− guruplug = sheevaplug // {
268+ guruplug = lib.recursiveUpdate sheevaplug {
265269 # Define `CONFIG_MACH_GURUPLUG' (see
266270 # <http://kerneltrap.org/mailarchive/git-commits-head/2010/5/19/33618>)
267271 # and other GuruPlug-specific things. Requires the `guruplug-defconfig'
268272 # patch.
269−
270− kernelBaseConfig = "guruplug_defconfig";
273+ linux-kernel.baseConfig = "guruplug_defconfig";
271274 };
272275
273− beaglebone = armv7l-hf-multiplatform // {
274− name = "beaglebone";
275− kernelBaseConfig = "bb.org_defconfig";
276− kernelAutoModules = false;
277− kernelExtraConfig = ""; # TBD kernel config
278− kernelTarget = "zImage";
276+ beaglebone = lib.recursiveUpdate armv7l-hf-multiplatform {
277+ linux-kernel = {
278+ name = "beaglebone";
279+ baseConfig = "bb.org_defconfig";
280+ autoModules = false;
281+ extraConfig = ""; # TBD kernel config
282+ target = "zImage";
283+ };
279284 };
280285
281286 # https://developer.android.com/ndk/guides/abis#v7a
282− armv7a-android = {
283− name = "armeabi-v7a";
287+ armv7a-android = {
288+ linux-kernel.name = "armeabi-v7a";
284289 gcc = {
285290 arch = "armv7-a";
286291 float-abi = "softfp";
@@ -289,29 +294,31 @@ rec {
289294 };
290295
291296 armv7l-hf-multiplatform = {
292− name = "armv7l-hf-multiplatform";
293− kernelBaseConfig = "multi_v7_defconfig";
294− kernelArch = "arm";
295− kernelDTB = true;
296− kernelAutoModules = true;
297− kernelPreferBuiltin = true;
298− kernelTarget = "zImage";
299− kernelExtraConfig = ''
300− # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig.
301− SERIAL_8250_BCM2835AUX y
302− SERIAL_8250_EXTENDED y
303− SERIAL_8250_SHARE_IRQ y
304−
305− # Fix broken sunxi-sid nvmem driver.
306− TI_CPTS y
307−
308− # Hangs ODROID-XU4
309− ARM_BIG_LITTLE_CPUIDLE n
310−
311− # Disable OABI to have seccomp_filter (required for systemd)
312− # https://github.com/raspberrypi/firmware/issues/651
313− OABI_COMPAT n
314− '';
297+ linux-kernel = {
298+ name = "armv7l-hf-multiplatform";
299+ Major = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
300+ baseConfig = "multi_v7_defconfig";
301+ DTB = true;
302+ autoModules = true;
303+ PreferBuiltin = true;
304+ target = "zImage";
305+ extraConfig = ''
306+ # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig.
307+ SERIAL_8250_BCM2835AUX y
308+ SERIAL_8250_EXTENDED y
309+ SERIAL_8250_SHARE_IRQ y
310+
311+ # Fix broken sunxi-sid nvmem driver.
312+ TI_CPTS y
313+
314+ # Hangs ODROID-XU4
315+ ARM_BIG_LITTLE_CPUIDLE n
316+
317+ # Disable OABI to have seccomp_filter (required for systemd)
318+ # https://github.com/raspberrypi/firmware/issues/651
319+ OABI_COMPAT n
320+ '';
321+ };
315322 gcc = {
316323 # Some table about fpu flags:
317324 # http://community.arm.com/servlet/JiveServlet/showImage/38-1981-3827/blogentry-103749-004812900+1365712953_thumb.png
@@ -336,34 +343,35 @@ rec {
336343 };
337344
338345 aarch64-multiplatform = {
339− name = "aarch64-multiplatform";
340− kernelBaseConfig = "defconfig";
341− kernelArch = "arm64";
342− kernelDTB = true;
343− kernelAutoModules = true;
344− kernelPreferBuiltin = true;
345− kernelExtraConfig = ''
346− # Raspberry Pi 3 stuff. Not needed for kernels >= 4.10.
347− ARCH_BCM2835 y
348− BCM2835_MBOX y
349− BCM2835_WDT y
350− RASPBERRYPI_FIRMWARE y
351− RASPBERRYPI_POWER y
352− SERIAL_8250_BCM2835AUX y
353− SERIAL_8250_EXTENDED y
354− SERIAL_8250_SHARE_IRQ y
355−
356− # Cavium ThunderX stuff.
357− PCI_HOST_THUNDER_ECAM y
358−
359− # Nvidia Tegra stuff.
360− PCI_TEGRA y
361−
362− # The default (=y) forces us to have the XHCI firmware available in initrd,
363− # which our initrd builder can't currently do easily.
364− USB_XHCI_TEGRA m
365− '';
366− kernelTarget = "Image";
346+ linux-kernel = {
347+ name = "aarch64-multiplatform";
348+ baseConfig = "defconfig";
349+ DTB = true;
350+ autoModules = true;
351+ preferBuiltin = true;
352+ extraConfig = ''
353+ # Raspberry Pi 3 stuff. Not needed for s >= 4.10.
354+ ARCH_BCM2835 y
355+ BCM2835_MBOX y
356+ BCM2835_WDT y
357+ RASPBERRYPI_FIRMWARE y
358+ RASPBERRYPI_POWER y
359+ SERIAL_8250_BCM2835AUX y
360+ SERIAL_8250_EXTENDED y
361+ SERIAL_8250_SHARE_IRQ y
362+
363+ # Cavium ThunderX stuff.
364+ PCI_HOST_THUNDER_ECAM y
365+
366+ # Nvidia Tegra stuff.
367+ PCI_TEGRA y
368+
369+ # The default (=y) forces us to have the XHCI firmware available in initrd,
370+ # which our initrd builder can't currently do easily.
371+ USB_XHCI_TEGRA m
372+ '';
373+ target = "Image";
374+ };
367375 gcc = {
368376 arch = "armv8-a";
369377 };
@@ -374,8 +382,9 @@ rec {
374382 ##
375383
376384 ben_nanonote = {
377− name = "ben_nanonote";
378− kernelArch = "mips";
385+ linux-kernel = {
386+ name = "ben_nanonote";
387+ };
379388 gcc = {
380389 arch = "mips32";
381390 float = "soft";
@@ -383,75 +392,76 @@ rec {
383392 };
384393
385394 fuloong2f_n32 = {
386− name = "fuloong2f_n32";
387− kernelBaseConfig = "lemote2f_defconfig";
388− kernelArch = "mips";
389− kernelAutoModules = false;
390− kernelExtraConfig = ''
391− MIGRATION n
392− COMPACTION n
393−
394− # nixos mounts some cgroup
395− CGROUPS y
396−
397− BLK_DEV_RAM y
398− BLK_DEV_INITRD y
399− BLK_DEV_CRYPTOLOOP m
400− BLK_DEV_DM m
401− DM_CRYPT m
402− MD y
403− REISERFS_FS m
404− EXT4_FS m
405− USB_STORAGE_CYPRESS_ATACB m
406−
407− IP_PNP y
408− IP_PNP_DHCP y
409− IP_PNP_BOOTP y
410− NFS_FS y
411− ROOT_NFS y
412− TUN m
413− NFS_V4 y
414− NFS_V4_1 y
415− NFS_FSCACHE y
416− NFSD m
417− NFSD_V2_ACL y
418− NFSD_V3 y
419− NFSD_V3_ACL y
420− NFSD_V4 y
421−
422− # Fail to build
423− DRM n
424− SCSI_ADVANSYS n
425− USB_ISP1362_HCD n
426− SND_SOC n
427− SND_ALI5451 n
428− FB_SAVAGE n
429− SCSI_NSP32 n
430− ATA_SFF n
431− SUNGEM n
432− IRDA n
433− ATM_HE n
434− SCSI_ACARD n
435− BLK_DEV_CMD640_ENHANCED n
436−
437− FUSE_FS m
438−
439− # Needed for udev >= 150
440− SYSFS_DEPRECATED_V2 n
441−
442− VGA_CONSOLE n
443− VT_HW_CONSOLE_BINDING y
444− SERIAL_8250_CONSOLE y
445− FRAMEBUFFER_CONSOLE y
446− EXT2_FS y
447− EXT3_FS y
448− REISERFS_FS y
449− MAGIC_SYSRQ y
450−
451− # The kernel doesn't boot at all, with FTRACE
452− FTRACE n
453− '';
454− kernelTarget = "vmlinux";
395+ linux-kernel = {
396+ name = "fuloong2f_n32";
397+ baseConfig = "lemote2f_defconfig";
398+ autoModules = false;
399+ extraConfig = ''
400+ MIGRATION n
401+ COMPACTION n
402+
403+ # nixos mounts some cgroup
404+ CGROUPS y
405+
406+ BLK_DEV_RAM y
407+ BLK_DEV_INITRD y
408+ BLK_DEV_CRYPTOLOOP m
409+ BLK_DEV_DM m
410+ DM_CRYPT m
411+ MD y
412+ REISERFS_FS m
413+ EXT4_FS m
414+ USB_STORAGE_CYPRESS_ATACB m
415+
416+ IP_PNP y
417+ IP_PNP_DHCP y
418+ IP_PNP_BOOTP y
419+ NFS_FS y
420+ ROOT_NFS y
421+ TUN m
422+ NFS_V4 y
423+ NFS_V4_1 y
424+ NFS_FSCACHE y
425+ NFSD m
426+ NFSD_V2_ACL y
427+ NFSD_V3 y
428+ NFSD_V3_ACL y
429+ NFSD_V4 y
430+
431+ # Fail to build
432+ DRM n
433+ SCSI_ADVANSYS n
434+ USB_ISP1362_HCD n
435+ SND_SOC n
436+ SND_ALI5451 n
437+ FB_SAVAGE n
438+ SCSI_NSP32 n
439+ ATA_SFF n
440+ SUNGEM n
441+ IRDA n
442+ ATM_HE n
443+ SCSI_ACARD n
444+ BLK_DEV_CMD640_ENHANCED n
445+
446+ FUSE_FS m
447+
448+ # Needed for udev >= 150
449+ SYSFS_DEPRECATED_V2 n
450+
451+ VGA_CONSOLE n
452+ VT_HW_CONSOLE_BINDING y
453+ SERIAL_8250_CONSOLE y
454+ FRAMEBUFFER_CONSOLE y
455+ EXT2_FS y
456+ EXT3_FS y
457+ REISERFS_FS y
458+ MAGIC_SYSRQ y
459+
460+ # The kernel doesn't boot at all, with FTRACE
461+ FTRACE n
462+ '';
463+ target = "vmlinux";
464+ };
455465 gcc = {
456466 arch = "loongson2f";
457467 float = "hard";
@@ -464,34 +474,36 @@ rec {
464474 ##
465475
466476 riscv-multiplatform = {
467− name = "riscv-multiplatform";
468− kernelArch = "riscv";
469− kernelTarget = "vmlinux";
470− kernelAutoModules = true;
471− kernelBaseConfig = "defconfig";
472− kernelExtraConfig = ''
473− FTRACE n
474− SERIAL_OF_PLATFORM y
475− '';
477+ linux-kernel = {
478+ name = "riscv-multiplatform";
479+ target = "vmlinux";
480+ autoModules = true;
481+ baseConfig = "defconfig";
482+ extraConfig = ''
483+ FTRACE n
484+ SERIAL_OF_PLATFORM y
485+ '';
486+ };
476487 };
477488
478489 select = platform:
479490 # x86
480− /**/ if platform.isx86_32 then pc32
481− else if platform.isx86_64 then pc64
491+ /**/ if platform.isx86 then pc
482492
483493 # ARM
484494 else if platform.isAarch32 then let
485495 version = platform.parsed.cpu.version or null;
486− in if version == null then pcBase
496+ in if version == null then pc
487497 else if lib.versionOlder version "6" then sheevaplug
488498 else if lib.versionOlder version "7" then raspberrypi
489499 else armv7l-hf-multiplatform
490500 else if platform.isAarch64 then aarch64-multiplatform
491501
502+ else if platform.isRiscV then riscv-multiplatform
503+
492504 else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32
493505
494506 else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv
495507
496− else pcBase;
508+ else pc;
497509}
nixos/doc/manual/release-notes/rl-2103.xml+16
@@ -603,6 +603,22 @@ http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/e
603603 <literal>/etc/netgroup</literal> defines network-wide groups and may affect to setups using NIS.
604604 </para>
605605 </listitem>
606+ <listitem>
607+ <para>
608+ Platforms, like <varname>stdenv.hostPlatform</varname>, no longer have a <varname>platform</varname> attribute.
609+ It has been (mostly) flattoned away:
610+ </para>
611+ <itemizedlist>
612+ <listitem><para><varname>platform.gcc</varname> is now <varname>gcc</varname></para></listitem>
613+ <listitem><para><literal>platform.kernel*</literal> is now <literal>linux-kernel.*</literal></para></listitem>
614+ </itemizedlist>
615+ <para>
616+ Additionally, <varname>platform.kernelArch</varname> moved to the top level as <varname>linuxArch</varname> to match the other <literal>*Arch</literal> variables.
617+ </para>
618+ <para>
619+ The <varname>platform</varname> grouping of these things never meant anything, and was just a historial/implementation artifact that was overdue removal.
620+ </para>
621+ </listitem>
606622 </itemizedlist>
607623 </section>
608624</section>
nixos/modules/hardware/device-tree.nix+4−4
@@ -68,11 +68,11 @@ let
6868 patchShebangs scripts/*
6969 substituteInPlace scripts/Makefile.lib \
7070 --replace 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget))' 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) -@'
71− make ${pkgs.stdenv.hostPlatform.platform.kernelBaseConfig} ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}"
72− make dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}"
71+ make ${pkgs.stdenv.hostPlatform.linux-kernel.baseConfig} ARCH="${pkgs.stdenv.hostPlatform.linuxArch}"
72+ make dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}"
7373 '';
7474 installPhase = ''
75− make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}"
75+ make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}"
7676 '';
7777 };
7878
@@ -115,7 +115,7 @@ in
115115 options = {
116116 hardware.deviceTree = {
117117 enable = mkOption {
118− default = pkgs.stdenv.hostPlatform.platform.kernelDTB or false;
118+ default = pkgs.stdenv.hostPlatform.linux-kernel.DTB or false;
119119 type = types.bool;
120120 description = ''
121121 Build device tree files. These are used to describe the
nixos/modules/installer/netboot/netboot.nix+1−1
@@ -88,7 +88,7 @@ with lib;
8888
8989 system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" ''
9090 #!ipxe
91− kernel ${pkgs.stdenv.hostPlatform.platform.kernelTarget} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams}
91+ kernel ${pkgs.stdenv.hostPlatform.linux-kernel.target} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams}
9292 initrd initrd
9393 boot
9494 '';
nixos/modules/services/misc/nix-daemon.nix+4−4
@@ -587,10 +587,10 @@ in
587587
588588 nix.systemFeatures = mkDefault (
589589 [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++
590− optionals (pkgs.hostPlatform.platform ? gcc.arch) (
591− # a builder can run code for `platform.gcc.arch` and inferior architectures
592− [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++
593− map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch}
590+ optionals (pkgs.hostPlatform ? gcc.arch) (
591+ # a builder can run code for `gcc.arch` and inferior architectures
592+ [ "gccarch-${pkgs.hostPlatform.gcc.arch}" ] ++
593+ map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.gcc.arch}
594594 )
595595 );
596596
nixos/modules/system/activation/top-level.nix+1−1
@@ -190,7 +190,7 @@ in
190190
191191 system.boot.loader.kernelFile = mkOption {
192192 internal = true;
193− default = pkgs.stdenv.hostPlatform.platform.kernelTarget;
193+ default = pkgs.stdenv.hostPlatform.linux-kernel.target;
194194 type = types.str;
195195 description = ''
196196 Name of the kernel file to be passed to the bootloader.
nixos/modules/system/boot/loader/generations-dir/generations-dir.nix+1−1
@@ -59,7 +59,7 @@ in
5959
6060 system.build.installBootLoader = generationsDirBuilder;
6161 system.boot.loader.id = "generationsDir";
62− system.boot.loader.kernelFile = platform.kernelTarget;
62+ system.boot.loader.kernelFile = linux-kernel.target;
6363
6464 };
6565}
nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix+1−1
@@ -103,6 +103,6 @@ in
103103
104104 system.build.installBootLoader = builder;
105105 system.boot.loader.id = "raspberrypi";
106− system.boot.loader.kernelFile = platform.kernelTarget;
106+ system.boot.loader.kernelFile = linux-kernel.target;
107107 };
108108}
nixos/release.nix+2−2
@@ -79,7 +79,7 @@ let
7979 in
8080 tarball //
8181 { meta = {
82− description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.platform.name}";
82+ description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.linux-kernel.name}";
8383 maintainers = map (x: lib.maintainers.${x}) maintainers;
8484 };
8585 inherit config;
@@ -105,7 +105,7 @@ let
105105 modules = makeModules module {};
106106 };
107107 build = configEvaled.config.system.build;
108− kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.platform.kernelTarget;
108+ kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target;
109109 in
110110 pkgs.symlinkJoin {
111111 name = "netboot";
pkgs/applications/audio/virtual-ans/default.nix+1−1
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
4646 startScript = if stdenv.isx86_32 then "START_LINUX_X86"
4747 else if stdenv.isx86_64 then "START_LINUX_X86_64"
4848 #else if stdenv.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin
49− else abort "Unsupported platform: ${stdenv.platform.kernelArch}.";
49+ else abort "Unsupported platform: ${stdenv.hostPlatform.linuxArch}.";
5050
5151 linuxExecutable = if stdenv.isx86_32 then "pixilang_linux_x86"
5252 else if stdenv.isx86_64 then "pixilang_linux_x86_64"
pkgs/applications/virtualization/crosvm/default.nix+1−1
@@ -75,7 +75,7 @@ in
7575
7676 CROSVM_CARGO_TEST_KERNEL_BINARY =
7777 lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform)
78− "${linux}/${stdenv.hostPlatform.platform.kernelTarget}";
78+ "${linux}/${stdenv.hostPlatform.linux-kernel.target}";
7979
8080 passthru = {
8181 inherit adhdSrc;
pkgs/applications/virtualization/vpcs/default.nix+1−1
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
1313
1414 buildPhase = ''(
1515 cd src
16− ./mk.sh ${stdenv.buildPlatform.platform.kernelArch}
16+ ./mk.sh ${stdenv.buildPlatform.linuxArch}
1717 )'';
1818
1919 installPhase = ''
pkgs/build-support/bintools-wrapper/default.nix+1−1
@@ -190,7 +190,7 @@ stdenv.mkDerivation {
190190 else if targetPlatform.isRiscV then "lriscv"
191191 else throw "unknown emulation for platform: ${targetPlatform.config}";
192192 in if targetPlatform.useLLVM or false then ""
193− else targetPlatform.platform.bfdEmulation or (fmt + sep + arch);
193+ else targetPlatform.bfdEmulation or (fmt + sep + arch);
194194
195195 strictDeps = true;
196196 depsTargetTargetPropagated = extraPackages;
pkgs/build-support/cc-wrapper/default.nix+8−8
@@ -403,31 +403,31 @@ stdenv.mkDerivation {
403403 # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in
404404 # that case.
405405 + optionalString ((targetPlatform ? platform.gcc.arch) &&
406− isGccArchSupported targetPlatform.platform.gcc.arch) ''
407− echo "-march=${targetPlatform.platform.gcc.arch}" >> $out/nix-support/cc-cflags-before
406+ isGccArchSupported targetPlatform.gcc.arch) ''
407+ echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before
408408 ''
409409
410410 # -mcpu is not very useful. You should use mtune and march
411411 # instead. It’s provided here for backwards compatibility.
412412 + optionalString (targetPlatform ? platform.gcc.cpu) ''
413− echo "-mcpu=${targetPlatform.platform.gcc.cpu}" >> $out/nix-support/cc-cflags-before
413+ echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before
414414 ''
415415
416416 # -mfloat-abi only matters on arm32 but we set it here
417417 # unconditionally just in case. If the abi specifically sets hard
418418 # vs. soft floats we use it here.
419419 + optionalString (targetPlatform ? platform.gcc.float-abi) ''
420− echo "-mfloat-abi=${targetPlatform.platform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before
420+ echo "-mfloat-abi=${targetPlatform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before
421421 ''
422422 + optionalString (targetPlatform ? platform.gcc.fpu) ''
423− echo "-mfpu=${targetPlatform.platform.gcc.fpu}" >> $out/nix-support/cc-cflags-before
423+ echo "-mfpu=${targetPlatform.gcc.fpu}" >> $out/nix-support/cc-cflags-before
424424 ''
425425 + optionalString (targetPlatform ? platform.gcc.mode) ''
426− echo "-mmode=${targetPlatform.platform.gcc.mode}" >> $out/nix-support/cc-cflags-before
426+ echo "-mmode=${targetPlatform.gcc.mode}" >> $out/nix-support/cc-cflags-before
427427 ''
428428 + optionalString (targetPlatform ? platform.gcc.tune &&
429− isGccArchSupported targetPlatform.platform.gcc.tune) ''
430− echo "-mtune=${targetPlatform.platform.gcc.tune}" >> $out/nix-support/cc-cflags-before
429+ isGccArchSupported targetPlatform.gcc.tune) ''
430+ echo "-mtune=${targetPlatform.gcc.tune}" >> $out/nix-support/cc-cflags-before
431431 ''
432432
433433 # TODO: categorize these and figure out a better place for them
pkgs/build-support/kernel/make-initrd.nix+2−2
@@ -56,13 +56,13 @@ in
5656, prepend ? []
5757
5858# Whether to wrap the initramfs in a u-boot image.
59−, makeUInitrd ? stdenvNoCC.hostPlatform.platform.kernelTarget == "uImage"
59+, makeUInitrd ? stdenvNoCC.hostPlatform.linux-kernel.target == "uImage"
6060
6161# If generating a u-boot image, the architecture to use. The default
6262# guess may not align with u-boot's nomenclature correctly, so it can
6363# be overridden.
6464# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list.
65−, uInitrdArch ? stdenvNoCC.hostPlatform.kernelArch
65+, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch
6666
6767# The name of the compression, as recognised by u-boot.
6868# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list.
pkgs/build-support/vm/default.nix+1−1
@@ -1,6 +1,6 @@
11{ pkgs
22, kernel ? pkgs.linux
3−, img ? pkgs.stdenv.hostPlatform.platform.kernelTarget
3+, img ? pkgs.stdenv.hostPlatform.linux-kernel.target
44, storeDir ? builtins.storeDir
55, rootModules ?
66 [ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "crc32c_generic" ]
pkgs/development/compilers/gcc/common/platform-flags.nix+1−1
@@ -1,7 +1,7 @@
11{ lib, targetPlatform }:
22
33let
4− p = targetPlatform.platform.gcc or {}
4+ p = targetPlatform.gcc or {}
55 // targetPlatform.parsed.abi;
66in lib.concatLists [
77 (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
pkgs/development/compilers/julia/1.0.nix+1−1
@@ -123,7 +123,7 @@ stdenv.mkDerivation rec {
123123 let
124124 arch = stdenv.lib.head (stdenv.lib.splitString "-" stdenv.system);
125125 march = {
126− x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64";
126+ x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64";
127127 i686 = "pentium4";
128128 aarch64 = "armv8-a";
129129 }.${arch}
pkgs/development/compilers/julia/1.3.nix+1−1
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
7373 let
7474 arch = head (splitString "-" stdenv.system);
7575 march = {
76− x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64";
76+ x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64";
7777 i686 = "pentium4";
7878 aarch64 = "armv8-a";
7979 }.${arch}
pkgs/development/compilers/julia/1.5.nix+1−1
@@ -71,7 +71,7 @@ stdenv.mkDerivation rec {
7171 let
7272 arch = head (splitString "-" stdenv.system);
7373 march = {
74− x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64";
74+ x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64";
7575 i686 = "pentium4";
7676 aarch64 = "armv8-a";
7777 }.${arch}
pkgs/development/libraries/glibc/common.nix+1−1
@@ -158,7 +158,7 @@ stdenv.mkDerivation ({
158158 "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
159159 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
160160 (lib.flip lib.withFeature "fp"
161− (stdenv.hostPlatform.platform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"))
161+ (stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"))
162162 "--with-__thread"
163163 ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform && stdenv.hostPlatform.isAarch32) [
164164 "--host=arm-linux-gnueabi"
pkgs/development/libraries/qt-5/modules/qtwebengine.nix+1−1
@@ -88,7 +88,7 @@ qtModule {
8888 NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
8989 # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit
9090 "-Wno-class-memaccess"
91− ] ++ lib.optionals (stdenv.hostPlatform.platform.gcc.arch or "" == "sandybridge") [
91+ ] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [
9292 # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940
9393 # TODO: investigate and fix properly
9494 "-march=westmere"
pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix+3−3
@@ -73,9 +73,9 @@ let
7373 if isLinux
7474 then
7575 (
76− x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
77− || x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
78− || x.platform == "manylinux2014_${stdenv.platform.kernelArch}"
76+ x: x.platform == "manylinux1_${stdenv.hostPlatform.linuxArch}"
77+ || x.platform == "manylinux2010_${stdenv.hostPlatform.linuxArch}"
78+ || x.platform == "manylinux2014_${stdenv.hostPlatform.linuxArch}"
7979 || x.platform == "any"
8080 )
8181 else (x: hasInfix "macosx" x.platform || x.platform == "any");
pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix+1−1
@@ -95,7 +95,7 @@ let
9595 else if stdenv.isDarwin then "darwin"
9696 else throw "Unsupported platform"
9797 );
98− platform_machine = stdenv.platform.kernelArch;
98+ platform_machine = stdenv.hostPlatform.linuxArch;
9999 platform_python_implementation =
100100 let
101101 impl = python.passthru.implementation;
pkgs/development/web/nodejs/nodejs.nix+5−6
@@ -60,18 +60,17 @@ in
6060
6161 configureFlags = let
6262 isCross = stdenv.hostPlatform != stdenv.buildPlatform;
63− host = stdenv.hostPlatform.platform;
64− isAarch32 = stdenv.hostPlatform.isAarch32;
63+ inherit (stdenv.hostPlatform) gcc isArch32;
6564 in sharedConfigureFlags ++ [
6665 "--without-dtrace"
6766 ] ++ (optionals isCross [
6867 "--cross-compiling"
6968 "--without-intl"
7069 "--without-snapshot"
71− ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" host.gcc) [
72− "--with-arm-fpu=${host.gcc.fpu}"
73− ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" host.gcc) [
74− "--with-arm-float-abi=${host.gcc.float-abi}"
70+ ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" gcc) [
71+ "--with-arm-fpu=${gcc.fpu}"
72+ ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" gcc) [
73+ "--with-arm-float-abi=${gcc.float-abi}"
7574 ]) ++ (optionals (isCross && isAarch32) [
7675 "--dest-cpu=arm"
7776 ]) ++ extraConfigFlags;
pkgs/os-specific/linux/exfat/default.nix+1−1
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
2626
2727 makeFlags = [
2828 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
29− "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
29+ "ARCH=${stdenv.hostPlatform.linuxArch}"
3030 ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
3131 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
3232 ];
pkgs/os-specific/linux/kernel-headers/default.nix+1−1
@@ -7,7 +7,7 @@ let
77 pname = "linux-headers";
88 inherit version;
99
10− ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch;
10+ ARCH = stdenvNoCC.hostPlatform.linuxArch;
1111
1212 # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
1313 # We do this so we have a build->build, not build->host, C compiler.
pkgs/os-specific/linux/kernel/generic.nix+9−9
@@ -42,7 +42,7 @@
4242 # symbolic name and `patch' is the actual patch. The patch may
4343 # optionally be compressed with gzip or bzip2.
4444 kernelPatches ? []
45−, ignoreConfigErrors ? stdenv.hostPlatform.platform.name != "pc" ||
45+, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name != "pc" ||
4646 stdenv.hostPlatform != stdenv.buildPlatform
4747, extraMeta ? {}
4848
@@ -51,10 +51,10 @@
5151, isLibre ? false
5252, isHardened ? false
5353
54−# easy overrides to stdenv.hostPlatform.platform members
55−, autoModules ? stdenv.hostPlatform.platform.kernelAutoModules
56−, preferBuiltin ? stdenv.hostPlatform.platform.kernelPreferBuiltin or false
57−, kernelArch ? stdenv.hostPlatform.platform.kernelArch
54+# easy overrides to stdenv.hostPlatform.linux-kernel members
55+, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules
56+, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false
57+, kernelArch ? stdenv.hostPlatform.linuxArch
5858
5959, ...
6060}:
@@ -87,7 +87,7 @@ let
8787 intermediateNixConfig = configfile.moduleStructuredConfig.intermediateNixConfig
8888 # extra config in legacy string format
8989 + extraConfig
90− + lib.optionalString (stdenv.hostPlatform.platform ? kernelExtraConfig) stdenv.hostPlatform.platform.kernelExtraConfig;
90+ + stdenv.hostPlatform.linux-kernel.extraConfig or "";
9191
9292 structuredConfigFromPatches =
9393 map ({extraStructuredConfig ? {}, ...}: {settings=extraStructuredConfig;}) kernelPatches;
@@ -113,11 +113,11 @@ let
113113 nativeBuildInputs = [ perl gmp libmpc mpfr ]
114114 ++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ];
115115
116− platformName = stdenv.hostPlatform.platform.name;
116+ platformName = stdenv.hostPlatform.linux-kernel.name;
117117 # e.g. "defconfig"
118− kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.platform.kernelBaseConfig;
118+ kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig;
119119 # e.g. "bzImage"
120− kernelTarget = stdenv.hostPlatform.platform.kernelTarget;
120+ kernelTarget = stdenv.hostPlatform.linux-kernel.target;
121121
122122 prePatch = kernel.prePatch + ''
123123 # Patch kconfig to print "###" after every question so that
pkgs/os-specific/linux/kernel/manual-config.nix+15−15
@@ -64,10 +64,10 @@ let
6464
6565 commonMakeFlags = [
6666 "O=$(buildRoot)"
67− ] ++ lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags)
68− stdenv.hostPlatform.platform.kernelMakeFlags;
67+ ] ++ lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags)
68+ stdenv.hostPlatform.linux-kernel.makeFlags;
6969
70− drvAttrs = config_: platform: kernelPatches: configfile:
70+ drvAttrs = config_: kernelConf: kernelPatches: configfile:
7171 let
7272 config = let attrName = attr: "CONFIG_" + attr; in {
7373 isSet = attr: hasAttr (attrName attr) config;
@@ -171,7 +171,7 @@ let
171171
172172 buildFlags = [
173173 "KBUILD_BUILD_VERSION=1-NixOS"
174− platform.kernelTarget
174+ kernelConf.target
175175 "vmlinux" # for "perf" and things like that
176176 ] ++ optional isModular "modules";
177177
@@ -186,16 +186,16 @@ let
186186 '';
187187
188188 # Some image types need special install targets (e.g. uImage is installed with make uinstall)
189− installTargets = [ (
190− if platform ? kernelInstallTarget then platform.kernelInstallTarget
191− else if platform.kernelTarget == "uImage" then "uinstall"
192− else if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall"
193− else "install"
194− ) ];
189+ installTargets = [
190+ (kernelConf.installTarget or (
191+ /**/ if kernelConf.target == "uImage" then "uinstall"
192+ else if kernelConf.target == "zImage" || kernelConf.target == "Image.gz" then "zinstall"
193+ else "install"))
194+ ];
195195
196196 postInstall = (optionalString installsFirmware ''
197197 mkdir -p $out/lib/firmware
198− '') + (if (platform ? kernelDTB && platform.kernelDTB) then ''
198+ '') + (if (kernelConf.DTB or false) then ''
199199 make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs
200200 '' else "") + (if isModular then ''
201201 mkdir -p $dev
@@ -300,7 +300,7 @@ in
300300assert (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") -> libelf != null;
301301assert lib.versionAtLeast version "5.8" -> elfutils != null;
302302
303−stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // {
303+stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // {
304304 pname = "linux";
305305 inherit version;
306306
@@ -308,7 +308,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches
308308
309309 depsBuildBuild = [ buildPackages.stdenv.cc ];
310310 nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr gawk zstd ]
311− ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools
311+ ++ optional (stdenv.hostPlatform.linux-kernel.target == "uImage") buildPackages.ubootTools
312312 ++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf
313313 # Removed util-linuxMinimal since it should not be a dependency.
314314 ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ]
@@ -322,10 +322,10 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches
322322 makeFlags = commonMakeFlags ++ [
323323 "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
324324 "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
325− "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
325+ "ARCH=${stdenv.hostPlatform.linuxArch}"
326326 ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
327327 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
328328 ];
329329
330− karch = stdenv.hostPlatform.platform.kernelArch;
330+ karch = stdenv.hostPlatform.linuxArch;
331331})
pkgs/os-specific/linux/klibc/default.nix+2−2
@@ -25,11 +25,11 @@ stdenv.mkDerivation rec {
2525 hardeningDisable = [ "format" "stackprotector" ];
2626
2727 makeFlags = commonMakeFlags ++ [
28− "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}"
28+ "KLIBCARCH=${stdenv.hostPlatform.linuxArch}"
2929 "KLIBCKERNELSRC=${linuxHeaders}"
3030 ] # TODO(@Ericson2314): We now can get the ABI from
3131 # `stdenv.hostPlatform.parsed.abi`, is this still a good idea?
32− ++ lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
32+ ++ lib.optional (stdenv.hostPlatform.linuxArch == "arm") "CONFIG_AEABI=y"
3333 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
3434
3535 # Install static binaries as well.
pkgs/os-specific/linux/rtl8723bs/default.nix+1−1
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
1616 buildInputs = [ nukeReferences ];
1717
1818 makeFlags = [
19− "ARCH=${stdenv.hostPlatform.platform.kernelArch}" # Normally not needed, but the Makefile sets ARCH in a broken way.
19+ "ARCH=${stdenv.hostPlatform.linuxArch}" # Normally not needed, but the Makefile sets ARCH in a broken way.
2020 "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" # Makefile uses $(uname -r); breaks us.
2121 ];
2222
pkgs/os-specific/linux/rtl8812au/default.nix+1−1
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
2424 '';
2525
2626 makeFlags = [
27− "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
27+ "ARCH=${stdenv.hostPlatform.linuxArch}"
2828 "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
2929 ("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n"))
3030 ("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
pkgs/os-specific/linux/uclibc/default.nix+1−1
@@ -68,7 +68,7 @@ stdenv.mkDerivation {
6868 cat << EOF | parseconfig
6969 ${nixConfig}
7070 ${extraConfig}
71− ${stdenv.hostPlatform.platform.uclibc.extraConfig or ""}
71+ ${stdenv.hostPlatform.uclibc.extraConfig or ""}
7272 EOF
7373 ( set +o pipefail; yes "" | make oldconfig )
7474 '';
pkgs/stdenv/generic/make-derivation.nix+1−1
@@ -279,7 +279,7 @@ in rec {
279279 } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) {
280280 NIX_HARDENING_ENABLE = enabledHardeningOptions;
281281 } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? platform.gcc.arch) {
282− requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.platform.gcc.arch}" ];
282+ requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ];
283283 } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
284284 inherit __darwinAllowLocalNetworking;
285285 # TODO: remove lib.unique once nix has a list canonicalization primitive
pkgs/top-level/all-packages.nix+1−1
@@ -19291,7 +19291,7 @@ in
1929119291 buildPhase = ''
1929219292 set -x
1929319293 make \
19294− ARCH=${stdenv.hostPlatform.kernelArch} \
19294+ ARCH=${stdenv.hostPlatform.linuxArch} \
1929519295 HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \
1929619296 ${makeTarget}
1929719297 '';