]> Git — Sourcephile - sourcephile-nix.git/blob - nixos/profiles/hardware/cubieboard2.nix
nix: update to latest nixpkgs
[sourcephile-nix.git] / nixos / profiles / hardware / cubieboard2.nix
1 { pkgs, lib, config, modulesPath, ... }:
2 {
3 imports = [
4 "${modulesPath}/installer/sd-card/sd-image.nix"
5 ];
6
7 boot.supportedFilesystems = [
8 #"btrfs"
9 #"reiserfs"
10 "vfat"
11 #"f2fs"
12 #"xfs"
13 #"zfs"
14 #"ntfs"
15 #"cifs"
16 ];
17
18 # The serial ports listed here are:
19 # - ttyS0: for Tegra (Jetson TK1)
20 # - ttymxc0: for i.MX6 (Wandboard)
21 # - ttyAMA0: for Allwinner (pcDuino3 Nano) and QEMU's -machine virt
22 # - ttyO0: for OMAP (BeagleBone Black)
23 # - ttySAC2: for Exynos (ODROID-XU3)
24 boot.consoleLogLevel = lib.mkDefault 7;
25 boot.kernelParams = [
26 "console=ttyS0,115200n8"
27 "console=ttymxc0,115200n8"
28 "console=ttyAMA0,115200n8"
29 "console=ttyO0,115200n8"
30 "console=ttySAC2,115200n8"
31 "console=tty0"
32 ];
33
34 #nixpkgs.config.allowUnfree = true;
35 nixpkgs.crossSystem = lib.systems.examples.armv7l-hf-multiplatform;
36 nixpkgs.overlays = [
37 (final: super: {
38 # https://linux-sunxi.org/Mali_Open_Source_Driver#Configuration_and_Build
39 mesa = super.mesa.override {
40 driDrivers = [];
41 eglPlatforms = ["x11"];
42 enableGalliumNine = false;
43 galliumDrivers = ["lima" "panfrost" "kmsro" "swrast"];
44 vulkanDrivers = [];
45 };
46 })
47 (final: super: {
48 linuxPackages_latest_Cubieboard2 = super.linuxPackages_latest.extend (kself: ksuper: {
49 kernel = ksuper.kernel.override {
50 defconfig = "sunxi_defconfig";
51 structuredExtraConfig = with lib.kernel; {
52 #
53 # File systems
54 #
55 PSTORE = yes;
56 VFAT_FS = yes;
57 EXT4_FS = yes;
58 EXT4_USE_FOR_EXT2 = yes;
59
60 #
61 # Networking options
62 #
63 TCP_CONG_BBR = module;
64 IPV6 = yes;
65 IPV6_ROUTER_PREF = yes;
66 IPV6_ROUTE_INFO = yes;
67 IPV6_OPTIMISTIC_DAD = yes;
68 INET6_AH = module;
69 INET6_ESP = module;
70 INET6_ESP_OFFLOAD = module;
71 INET6_ESPINTCP = yes;
72 INET6_IPCOMP = module;
73 IPV6_MIP6 = module;
74 IPV6_ILA = module;
75 INET6_XFRM_TUNNEL = module;
76 INET6_TUNNEL = module;
77 IPV6_VTI = module;
78 IPV6_SIT = module;
79 IPV6_SIT_6RD = yes;
80 IPV6_NDISC_NODETYPE = yes;
81 IPV6_TUNNEL = module;
82 IPV6_MULTIPLE_TABLES = yes;
83 IPV6_SUBTREES = yes;
84 IPV6_MROUTE = yes;
85 IPV6_MROUTE_MULTIPLE_TABLES = yes;
86 IPV6_PIMSM_V2 = yes;
87 IPV6_SEG6_LWTUNNEL = yes;
88 IPV6_SEG6_HMAC = yes;
89 IPV6_RPL_LWTUNNEL = yes;
90 # CONFIG_MPTCP is not set
91 # CONFIG_NETWORK_SECMARK is not set
92 NET_PTP_CLASSIFY = yes;
93 # CONFIG_NETWORK_PHY_TIMESTAMPING is not set
94 NETFILTER = yes;
95 NETFILTER_ADVANCED = yes;
96
97 #
98 # Core Netfilter Configuration
99 #
100 NETFILTER_INGRESS = yes;
101 NETFILTER_NETLINK = module;
102 NETFILTER_FAMILY_ARP = yes;
103 NETFILTER_NETLINK_HOOK = module;
104 NETFILTER_NETLINK_ACCT = module;
105 NETFILTER_NETLINK_QUEUE = module;
106 NETFILTER_NETLINK_LOG = module;
107 NETFILTER_NETLINK_OSF = module;
108 NF_CONNTRACK = module;
109 NF_LOG_SYSLOG = module;
110 NETFILTER_CONNCOUNT = module;
111 NF_CONNTRACK_MARK = yes;
112 NF_CONNTRACK_ZONES = yes;
113 NF_CONNTRACK_PROCFS = yes;
114 NF_CONNTRACK_EVENTS = yes;
115 NF_CONNTRACK_TIMEOUT = yes;
116 NF_CONNTRACK_TIMESTAMP = yes;
117 NF_CONNTRACK_LABELS = yes;
118 NF_CT_PROTO_DCCP = yes;
119 NF_CT_PROTO_SCTP = yes;
120 NF_CT_PROTO_UDPLITE = yes;
121 # CONFIG_NF_CONNTRACK_AMANDA is not set
122 # CONFIG_NF_CONNTRACK_FTP is not set
123 # CONFIG_NF_CONNTRACK_H323 is not set
124 # CONFIG_NF_CONNTRACK_IRC is not set
125 # CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
126 # CONFIG_NF_CONNTRACK_SNMP is not set
127 # CONFIG_NF_CONNTRACK_PPTP is not set
128 # CONFIG_NF_CONNTRACK_SANE is not set
129 # CONFIG_NF_CONNTRACK_SIP is not set
130 # CONFIG_NF_CONNTRACK_TFTP is not set
131 NF_CT_NETLINK = module;
132 NF_CT_NETLINK_TIMEOUT = module;
133 NF_CT_NETLINK_HELPER = module;
134 NETFILTER_NETLINK_GLUE_CT = yes;
135 NF_NAT = module;
136 NF_NAT_REDIRECT = yes;
137 NF_NAT_MASQUERADE = yes;
138 NETFILTER_SYNPROXY = module;
139 NF_TABLES = module;
140 NF_TABLES_INET = yes;
141 NF_TABLES_NETDEV = yes;
142 NFT_NUMGEN = module;
143 NFT_CT = module;
144 NFT_COUNTER = module;
145 NFT_CONNLIMIT = module;
146 NFT_LOG = module;
147 NFT_LIMIT = module;
148 NFT_MASQ = module;
149 NFT_REDIR = module;
150 NFT_NAT = module;
151 NFT_TUNNEL = module;
152 NFT_OBJREF = module;
153 NFT_QUEUE = module;
154 NFT_QUOTA = module;
155 NFT_REJECT = module;
156 NFT_REJECT_INET = module;
157 NFT_COMPAT = module;
158 NFT_HASH = module;
159 NFT_FIB = module;
160 NFT_FIB_INET = module;
161 NFT_XFRM = module;
162 NFT_SOCKET = module;
163 NFT_OSF = module;
164 NFT_TPROXY = module;
165 NFT_SYNPROXY = module;
166 NF_DUP_NETDEV = module;
167 NFT_DUP_NETDEV = module;
168 NFT_FWD_NETDEV = module;
169 NFT_FIB_NETDEV = module;
170 NFT_REJECT_NETDEV = module;
171 # CONFIG_NF_FLOW_TABLE is not set
172 NETFILTER_XTABLES = module;
173
174 #
175 # Xtables combined modules
176 #
177 NETFILTER_XT_MARK = module;
178 NETFILTER_XT_CONNMARK = module;
179 NETFILTER_XT_SET = module;
180
181 #
182 # Xtables targets
183 #
184 NETFILTER_XT_TARGET_CHECKSUM = module;
185 NETFILTER_XT_TARGET_CLASSIFY = module;
186 NETFILTER_XT_TARGET_CONNMARK = module;
187 NETFILTER_XT_TARGET_CT = module;
188 NETFILTER_XT_TARGET_DSCP = module;
189 NETFILTER_XT_TARGET_HL = module;
190 NETFILTER_XT_TARGET_HMARK = module;
191 NETFILTER_XT_TARGET_IDLETIMER = module;
192 NETFILTER_XT_TARGET_LED = module;
193 NETFILTER_XT_TARGET_LOG = module;
194 NETFILTER_XT_TARGET_MARK = module;
195 NETFILTER_XT_NAT = module;
196 NETFILTER_XT_TARGET_NETMAP = module;
197 NETFILTER_XT_TARGET_NFLOG = module;
198 NETFILTER_XT_TARGET_NFQUEUE = module;
199 NETFILTER_XT_TARGET_NOTRACK = module;
200 NETFILTER_XT_TARGET_RATEEST = module;
201 NETFILTER_XT_TARGET_REDIRECT = module;
202 NETFILTER_XT_TARGET_MASQUERADE = module;
203 NETFILTER_XT_TARGET_TEE = module;
204 NETFILTER_XT_TARGET_TPROXY = module;
205 NETFILTER_XT_TARGET_TRACE = module;
206 NETFILTER_XT_TARGET_TCPMSS = module;
207 NETFILTER_XT_TARGET_TCPOPTSTRIP = module;
208
209 #
210 # Xtables matches
211 #
212 NETFILTER_XT_MATCH_ADDRTYPE = module;
213 NETFILTER_XT_MATCH_BPF = module;
214 NETFILTER_XT_MATCH_CGROUP = module;
215 NETFILTER_XT_MATCH_CLUSTER = module;
216 NETFILTER_XT_MATCH_COMMENT = module;
217 NETFILTER_XT_MATCH_CONNBYTES = module;
218 NETFILTER_XT_MATCH_CONNLABEL = module;
219 NETFILTER_XT_MATCH_CONNLIMIT = module;
220 NETFILTER_XT_MATCH_CONNMARK = module;
221 NETFILTER_XT_MATCH_CONNTRACK = module;
222 NETFILTER_XT_MATCH_CPU = module;
223 NETFILTER_XT_MATCH_DCCP = module;
224 NETFILTER_XT_MATCH_DEVGROUP = module;
225 NETFILTER_XT_MATCH_DSCP = module;
226 NETFILTER_XT_MATCH_ECN = module;
227 NETFILTER_XT_MATCH_ESP = module;
228 NETFILTER_XT_MATCH_HASHLIMIT = module;
229 NETFILTER_XT_MATCH_HELPER = module;
230 NETFILTER_XT_MATCH_HL = module;
231 NETFILTER_XT_MATCH_IPCOMP = module;
232 NETFILTER_XT_MATCH_IPRANGE = module;
233 NETFILTER_XT_MATCH_L2TP = module;
234 NETFILTER_XT_MATCH_LENGTH = module;
235 NETFILTER_XT_MATCH_LIMIT = module;
236 NETFILTER_XT_MATCH_MAC = module;
237 NETFILTER_XT_MATCH_MARK = module;
238 NETFILTER_XT_MATCH_MULTIPORT = module;
239 NETFILTER_XT_MATCH_NFACCT = module;
240 NETFILTER_XT_MATCH_OSF = module;
241 NETFILTER_XT_MATCH_OWNER = module;
242 # CONFIG_NETFILTER_XT_MATCH_POLICY is not set
243 NETFILTER_XT_MATCH_PKTTYPE = module;
244 NETFILTER_XT_MATCH_QUOTA = module;
245 NETFILTER_XT_MATCH_RATEEST = module;
246 NETFILTER_XT_MATCH_REALM = module;
247 NETFILTER_XT_MATCH_RECENT = module;
248 NETFILTER_XT_MATCH_SCTP = module;
249 NETFILTER_XT_MATCH_SOCKET = module;
250 NETFILTER_XT_MATCH_STATE = module;
251 NETFILTER_XT_MATCH_STATISTIC = module;
252 NETFILTER_XT_MATCH_STRING = module;
253 NETFILTER_XT_MATCH_TCPMSS = module;
254 NETFILTER_XT_MATCH_TIME = module;
255 NETFILTER_XT_MATCH_U32 = module;
256 # end of Core Netfilter Configuration
257
258 IP_SET = module;
259 IP_SET_MAX.freeform = "256";
260 IP_SET_BITMAP_IP = module;
261 IP_SET_BITMAP_IPMAC = module;
262 IP_SET_BITMAP_PORT = module;
263 IP_SET_HASH_IP = module;
264 IP_SET_HASH_IPMARK = module;
265 IP_SET_HASH_IPPORT = module;
266 IP_SET_HASH_IPPORTIP = module;
267 IP_SET_HASH_IPPORTNET = module;
268 IP_SET_HASH_IPMAC = module;
269 IP_SET_HASH_MAC = module;
270 IP_SET_HASH_NETPORTNET = module;
271 IP_SET_HASH_NET = module;
272 IP_SET_HASH_NETNET = module;
273 IP_SET_HASH_NETPORT = module;
274 IP_SET_HASH_NETIFACE = module;
275 IP_SET_LIST_SET = module;
276 # CONFIG_IP_VS is not set
277
278 #
279 # IP: Netfilter Configuration
280 #
281 NF_DEFRAG_IPV4 = module;
282 NF_SOCKET_IPV4 = module;
283 NF_TPROXY_IPV4 = module;
284 NF_TABLES_IPV4 = yes;
285 NFT_REJECT_IPV4 = module;
286 NFT_DUP_IPV4 = module;
287 NFT_FIB_IPV4 = module;
288 # CONFIG_NF_TABLES_ARP is not set
289 NF_DUP_IPV4 = module;
290 # CONFIG_NF_LOG_ARP is not set
291 # CONFIG_NF_LOG_IPV4 is not set
292 NF_REJECT_IPV4 = module;
293 IP_NF_IPTABLES = module;
294 IP_NF_MATCH_AH = module;
295 IP_NF_MATCH_ECN = module;
296 IP_NF_MATCH_RPFILTER = module;
297 IP_NF_MATCH_TTL = module;
298 IP_NF_FILTER = module;
299 IP_NF_TARGET_REJECT = module;
300 IP_NF_TARGET_SYNPROXY = module;
301 IP_NF_NAT = module;
302 IP_NF_TARGET_MASQUERADE = module;
303 IP_NF_TARGET_NETMAP = module;
304 IP_NF_TARGET_REDIRECT = module;
305 IP_NF_MANGLE = module;
306 IP_NF_TARGET_CLUSTERIP = module;
307 IP_NF_TARGET_ECN = module;
308 IP_NF_TARGET_TTL = module;
309 # CONFIG_IP_NF_RAW is not set
310 # CONFIG_IP_NF_ARPTABLES is not set
311 # end of IP: Netfilter Configuration
312
313 #
314 # IPv6: Netfilter Configuration
315 #
316 NF_SOCKET_IPV6 = module;
317 NF_TPROXY_IPV6 = module;
318 NF_TABLES_IPV6 = yes;
319 NFT_REJECT_IPV6 = module;
320 NFT_DUP_IPV6 = module;
321 NFT_FIB_IPV6 = module;
322 NF_DUP_IPV6 = module;
323 NF_REJECT_IPV6 = module;
324 NF_LOG_IPV6 = module;
325 IP6_NF_IPTABLES = module;
326 IP6_NF_MATCH_AH = module;
327 IP6_NF_MATCH_EUI64 = module;
328 IP6_NF_MATCH_FRAG = module;
329 IP6_NF_MATCH_OPTS = module;
330 IP6_NF_MATCH_HL = module;
331 IP6_NF_MATCH_IPV6HEADER = module;
332 IP6_NF_MATCH_MH = module;
333 IP6_NF_MATCH_RPFILTER = module;
334 IP6_NF_MATCH_RT = module;
335 IP6_NF_MATCH_SRH = module;
336 IP6_NF_TARGET_HL = module;
337 IP6_NF_FILTER = module;
338 IP6_NF_TARGET_REJECT = module;
339 IP6_NF_TARGET_SYNPROXY = module;
340 IP6_NF_MANGLE = module;
341 IP6_NF_RAW = module;
342 IP6_NF_NAT = module;
343 IP6_NF_TARGET_MASQUERADE = module;
344 IP6_NF_TARGET_NPT = module;
345 # end of IPv6: Netfilter Configuration
346
347 NF_DEFRAG_IPV6 = module;
348
349 #
350 # Disabling
351 #
352 ADFS_FS = no;
353 AFFS_FS = no;
354 BEFS_FS = no;
355 BFS_FS = no;
356 BTRFS = no;
357 BTRFS_FS = no;
358 CEPH_FS = no;
359 CIFS = no;
360 CRAMFS = no;
361 ECRYPT_FS = no;
362 EFS_FS = no;
363 EROFS_FS = no;
364 EXT2_FS = no;
365 EXT3_FS = no;
366 F2FS_FS = lib.mkForce no;
367 GFS2_FS = no;
368 HFSPLUS_FS = no;
369 HFS_FS = no;
370 HPFS_FS = no;
371 JFS_FS = no;
372 MINIX_FS = no;
373 NET_9P = no;
374 NFSD = no;
375 NFS_FS = no;
376 NILFS2_FS = no;
377 OMFS_FS = no;
378 ORANGEFS_FS = no;
379 QNX4FS_FS = no;
380 QNX6FS_FS = no;
381 REISERFS_FS = no;
382 ROMFS_FS = no;
383 SQUASHFS = no;
384 SYSV_FS = no;
385 UFS_FS = no;
386 VXFS_FS = no;
387 XFS_FS = no;
388
389 MISC_FILESYSTEMS = no;
390
391 DECNET = no;
392 SCTP = no;
393 RDS = no;
394 DCCP = no;
395 TIPC = no;
396 CAIF = no;
397 CEPH = no;
398 VMW_SOCK = no;
399 HSR = no;
400 QRTR = no;
401 MPI = no;
402 RAID6 = no;
403 STAGING = lib.mkForce no;
404
405 "6LOWPAN" = no;
406 ARCNET = no;
407 B53 = no;
408 BATMAN_ADV = no;
409 BT = no;
410 CAN = no;
411 COMEDI = no;
412 DRM_STM = lib.mkForce no;
413 INFINIBAND = no;
414 INPUT_TOUCHSCREEN = no;
415 MEDIA_ANALOG_TV_SUPPORT = lib.mkForce no;
416 MEDIA_DIGITAL_TV_SUPPORT = lib.mkForce no;
417 MEDIA_TUNER = no;
418 MPLS = no;
419 MPTCP = lib.mkForce no;
420 NFC = no;
421 NF_TABLES_BRIDGE = lib.mkForce no;
422 NVME = no;
423 OPENVSWITCH = no;
424 PARAVIRT = lib.mkForce no;
425 POWER_SUPPLY = no;
426 USB_GSPCA = lib.mkForce no;
427 VIDEO_STK1160_COMMON = lib.mkForce no;
428 XEN = lib.mkForce no;
429 #NVME_CORE = no;
430 };
431 #ignoreConfigErrors = true;
432 };
433 });
434 })
435 ];
436 boot.cleanTmpDir = true;
437 boot.tmpOnTmpfs = lib.mkForce false;
438 # TODO: is that needed?
439 hardware.enableRedistributableFirmware = true;
440 sdImage = {
441 postBuildCommands = ''
442 dd if=${pkgs.ubootCubieboard2}/u-boot-sunxi-with-spl.bin of=$img bs=1024 seek=8 conv=notrunc
443 '';
444 compressImage = true;
445 expandOnBoot = true;
446 firmwareSize = 1;
447 populateFirmwareCommands = "";
448 populateRootCommands = ''
449 mkdir -p ./files/boot
450 ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
451 '';
452 };
453 boot.loader.grub.enable = false;
454 boot.loader.generic-extlinux-compatible.enable = true;
455 # nix -L build .#nixosConfigurations.${hostName}.config.boot.kernelPackages.kernel.configfile
456 boot.kernelPackages = lib.mkForce pkgs.linuxPackages_latest_Cubieboard2;
457 boot.initrd.availableKernelModules = lib.mkForce [
458 "mmc_block"
459 "usbhid"
460 "hid_generic"
461 "hid_microsoft"
462 ];
463 }