1 { pkgs, lib, config, modulesPath, ... }:
4 "${modulesPath}/installer/sd-card/sd-image-armv7l-multiplatform.nix"
6 #nixpkgs.config.allowUnfree = true;
7 nixpkgs.crossSystem = lib.systems.examples.armv7l-hf-multiplatform;
10 # https://linux-sunxi.org/Mali_Open_Source_Driver#Configuration_and_Build
11 mesa = super.mesa.override {
13 eglPlatforms = ["x11"];
14 enableGalliumNine = false;
15 galliumDrivers = ["lima" "panfrost" "kmsro" "swrast"];
20 linuxPackages_latest_Cubieboard2 = super.linuxPackages_latest.extend (kself: ksuper: {
21 kernel = ksuper.kernel.override {
22 defconfig = "sunxi_defconfig";
23 structuredExtraConfig = with lib.kernel; {
30 EXT4_USE_FOR_EXT2 = yes;
35 TCP_CONG_BBR = module;
37 IPV6_ROUTER_PREF = yes;
38 IPV6_ROUTE_INFO = yes;
39 IPV6_OPTIMISTIC_DAD = yes;
42 INET6_ESP_OFFLOAD = module;
44 INET6_IPCOMP = module;
47 INET6_XFRM_TUNNEL = module;
48 INET6_TUNNEL = module;
52 IPV6_NDISC_NODETYPE = yes;
54 IPV6_MULTIPLE_TABLES = yes;
57 IPV6_MROUTE_MULTIPLE_TABLES = yes;
59 IPV6_SEG6_LWTUNNEL = yes;
61 IPV6_RPL_LWTUNNEL = yes;
62 # CONFIG_MPTCP is not set
63 # CONFIG_NETWORK_SECMARK is not set
64 NET_PTP_CLASSIFY = yes;
65 # CONFIG_NETWORK_PHY_TIMESTAMPING is not set
67 NETFILTER_ADVANCED = yes;
70 # Core Netfilter Configuration
72 NETFILTER_INGRESS = yes;
73 NETFILTER_NETLINK = module;
74 NETFILTER_FAMILY_ARP = yes;
75 NETFILTER_NETLINK_HOOK = module;
76 NETFILTER_NETLINK_ACCT = module;
77 NETFILTER_NETLINK_QUEUE = module;
78 NETFILTER_NETLINK_LOG = module;
79 NETFILTER_NETLINK_OSF = module;
80 NF_CONNTRACK = module;
81 NF_LOG_SYSLOG = module;
82 NETFILTER_CONNCOUNT = module;
83 NF_CONNTRACK_MARK = yes;
84 NF_CONNTRACK_ZONES = yes;
85 NF_CONNTRACK_PROCFS = yes;
86 NF_CONNTRACK_EVENTS = yes;
87 NF_CONNTRACK_TIMEOUT = yes;
88 NF_CONNTRACK_TIMESTAMP = yes;
89 NF_CONNTRACK_LABELS = yes;
90 NF_CT_PROTO_DCCP = yes;
91 NF_CT_PROTO_SCTP = yes;
92 NF_CT_PROTO_UDPLITE = yes;
93 # CONFIG_NF_CONNTRACK_AMANDA is not set
94 # CONFIG_NF_CONNTRACK_FTP is not set
95 # CONFIG_NF_CONNTRACK_H323 is not set
96 # CONFIG_NF_CONNTRACK_IRC is not set
97 # CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
98 # CONFIG_NF_CONNTRACK_SNMP is not set
99 # CONFIG_NF_CONNTRACK_PPTP is not set
100 # CONFIG_NF_CONNTRACK_SANE is not set
101 # CONFIG_NF_CONNTRACK_SIP is not set
102 # CONFIG_NF_CONNTRACK_TFTP is not set
103 NF_CT_NETLINK = module;
104 NF_CT_NETLINK_TIMEOUT = module;
105 NF_CT_NETLINK_HELPER = module;
106 NETFILTER_NETLINK_GLUE_CT = yes;
108 NF_NAT_REDIRECT = yes;
109 NF_NAT_MASQUERADE = yes;
110 NETFILTER_SYNPROXY = module;
112 NF_TABLES_INET = yes;
113 NF_TABLES_NETDEV = yes;
116 NFT_COUNTER = module;
117 NFT_CONNLIMIT = module;
128 NFT_REJECT_INET = module;
132 NFT_FIB_INET = module;
137 NFT_SYNPROXY = module;
138 NF_DUP_NETDEV = module;
139 NFT_DUP_NETDEV = module;
140 NFT_FWD_NETDEV = module;
141 NFT_FIB_NETDEV = module;
142 NFT_REJECT_NETDEV = module;
143 # CONFIG_NF_FLOW_TABLE is not set
144 NETFILTER_XTABLES = module;
147 # Xtables combined modules
149 NETFILTER_XT_MARK = module;
150 NETFILTER_XT_CONNMARK = module;
151 NETFILTER_XT_SET = module;
156 NETFILTER_XT_TARGET_CHECKSUM = module;
157 NETFILTER_XT_TARGET_CLASSIFY = module;
158 NETFILTER_XT_TARGET_CONNMARK = module;
159 NETFILTER_XT_TARGET_CT = module;
160 NETFILTER_XT_TARGET_DSCP = module;
161 NETFILTER_XT_TARGET_HL = module;
162 NETFILTER_XT_TARGET_HMARK = module;
163 NETFILTER_XT_TARGET_IDLETIMER = module;
164 NETFILTER_XT_TARGET_LED = module;
165 NETFILTER_XT_TARGET_LOG = module;
166 NETFILTER_XT_TARGET_MARK = module;
167 NETFILTER_XT_NAT = module;
168 NETFILTER_XT_TARGET_NETMAP = module;
169 NETFILTER_XT_TARGET_NFLOG = module;
170 NETFILTER_XT_TARGET_NFQUEUE = module;
171 NETFILTER_XT_TARGET_NOTRACK = module;
172 NETFILTER_XT_TARGET_RATEEST = module;
173 NETFILTER_XT_TARGET_REDIRECT = module;
174 NETFILTER_XT_TARGET_MASQUERADE = module;
175 NETFILTER_XT_TARGET_TEE = module;
176 NETFILTER_XT_TARGET_TPROXY = module;
177 NETFILTER_XT_TARGET_TRACE = module;
178 NETFILTER_XT_TARGET_TCPMSS = module;
179 NETFILTER_XT_TARGET_TCPOPTSTRIP = module;
184 NETFILTER_XT_MATCH_ADDRTYPE = module;
185 NETFILTER_XT_MATCH_BPF = module;
186 NETFILTER_XT_MATCH_CGROUP = module;
187 NETFILTER_XT_MATCH_CLUSTER = module;
188 NETFILTER_XT_MATCH_COMMENT = module;
189 NETFILTER_XT_MATCH_CONNBYTES = module;
190 NETFILTER_XT_MATCH_CONNLABEL = module;
191 NETFILTER_XT_MATCH_CONNLIMIT = module;
192 NETFILTER_XT_MATCH_CONNMARK = module;
193 NETFILTER_XT_MATCH_CONNTRACK = module;
194 NETFILTER_XT_MATCH_CPU = module;
195 NETFILTER_XT_MATCH_DCCP = module;
196 NETFILTER_XT_MATCH_DEVGROUP = module;
197 NETFILTER_XT_MATCH_DSCP = module;
198 NETFILTER_XT_MATCH_ECN = module;
199 NETFILTER_XT_MATCH_ESP = module;
200 NETFILTER_XT_MATCH_HASHLIMIT = module;
201 NETFILTER_XT_MATCH_HELPER = module;
202 NETFILTER_XT_MATCH_HL = module;
203 NETFILTER_XT_MATCH_IPCOMP = module;
204 NETFILTER_XT_MATCH_IPRANGE = module;
205 NETFILTER_XT_MATCH_L2TP = module;
206 NETFILTER_XT_MATCH_LENGTH = module;
207 NETFILTER_XT_MATCH_LIMIT = module;
208 NETFILTER_XT_MATCH_MAC = module;
209 NETFILTER_XT_MATCH_MARK = module;
210 NETFILTER_XT_MATCH_MULTIPORT = module;
211 NETFILTER_XT_MATCH_NFACCT = module;
212 NETFILTER_XT_MATCH_OSF = module;
213 NETFILTER_XT_MATCH_OWNER = module;
214 # CONFIG_NETFILTER_XT_MATCH_POLICY is not set
215 NETFILTER_XT_MATCH_PKTTYPE = module;
216 NETFILTER_XT_MATCH_QUOTA = module;
217 NETFILTER_XT_MATCH_RATEEST = module;
218 NETFILTER_XT_MATCH_REALM = module;
219 NETFILTER_XT_MATCH_RECENT = module;
220 NETFILTER_XT_MATCH_SCTP = module;
221 NETFILTER_XT_MATCH_SOCKET = module;
222 NETFILTER_XT_MATCH_STATE = module;
223 NETFILTER_XT_MATCH_STATISTIC = module;
224 NETFILTER_XT_MATCH_STRING = module;
225 NETFILTER_XT_MATCH_TCPMSS = module;
226 NETFILTER_XT_MATCH_TIME = module;
227 NETFILTER_XT_MATCH_U32 = module;
228 # end of Core Netfilter Configuration
231 IP_SET_MAX.freeform = "256";
232 IP_SET_BITMAP_IP = module;
233 IP_SET_BITMAP_IPMAC = module;
234 IP_SET_BITMAP_PORT = module;
235 IP_SET_HASH_IP = module;
236 IP_SET_HASH_IPMARK = module;
237 IP_SET_HASH_IPPORT = module;
238 IP_SET_HASH_IPPORTIP = module;
239 IP_SET_HASH_IPPORTNET = module;
240 IP_SET_HASH_IPMAC = module;
241 IP_SET_HASH_MAC = module;
242 IP_SET_HASH_NETPORTNET = module;
243 IP_SET_HASH_NET = module;
244 IP_SET_HASH_NETNET = module;
245 IP_SET_HASH_NETPORT = module;
246 IP_SET_HASH_NETIFACE = module;
247 IP_SET_LIST_SET = module;
248 # CONFIG_IP_VS is not set
251 # IP: Netfilter Configuration
253 NF_DEFRAG_IPV4 = module;
254 NF_SOCKET_IPV4 = module;
255 NF_TPROXY_IPV4 = module;
256 NF_TABLES_IPV4 = yes;
257 NFT_REJECT_IPV4 = module;
258 NFT_DUP_IPV4 = module;
259 NFT_FIB_IPV4 = module;
260 # CONFIG_NF_TABLES_ARP is not set
261 NF_DUP_IPV4 = module;
262 # CONFIG_NF_LOG_ARP is not set
263 # CONFIG_NF_LOG_IPV4 is not set
264 NF_REJECT_IPV4 = module;
265 IP_NF_IPTABLES = module;
266 IP_NF_MATCH_AH = module;
267 IP_NF_MATCH_ECN = module;
268 IP_NF_MATCH_RPFILTER = module;
269 IP_NF_MATCH_TTL = module;
270 IP_NF_FILTER = module;
271 IP_NF_TARGET_REJECT = module;
272 IP_NF_TARGET_SYNPROXY = module;
274 IP_NF_TARGET_MASQUERADE = module;
275 IP_NF_TARGET_NETMAP = module;
276 IP_NF_TARGET_REDIRECT = module;
277 IP_NF_MANGLE = module;
278 IP_NF_TARGET_CLUSTERIP = module;
279 IP_NF_TARGET_ECN = module;
280 IP_NF_TARGET_TTL = module;
281 # CONFIG_IP_NF_RAW is not set
282 # CONFIG_IP_NF_ARPTABLES is not set
283 # end of IP: Netfilter Configuration
286 # IPv6: Netfilter Configuration
288 NF_SOCKET_IPV6 = module;
289 NF_TPROXY_IPV6 = module;
290 NF_TABLES_IPV6 = yes;
291 NFT_REJECT_IPV6 = module;
292 NFT_DUP_IPV6 = module;
293 NFT_FIB_IPV6 = module;
294 NF_DUP_IPV6 = module;
295 NF_REJECT_IPV6 = module;
296 NF_LOG_IPV6 = module;
297 IP6_NF_IPTABLES = module;
298 IP6_NF_MATCH_AH = module;
299 IP6_NF_MATCH_EUI64 = module;
300 IP6_NF_MATCH_FRAG = module;
301 IP6_NF_MATCH_OPTS = module;
302 IP6_NF_MATCH_HL = module;
303 IP6_NF_MATCH_IPV6HEADER = module;
304 IP6_NF_MATCH_MH = module;
305 IP6_NF_MATCH_RPFILTER = module;
306 IP6_NF_MATCH_RT = module;
307 IP6_NF_MATCH_SRH = module;
308 IP6_NF_TARGET_HL = module;
309 IP6_NF_FILTER = module;
310 IP6_NF_TARGET_REJECT = module;
311 IP6_NF_TARGET_SYNPROXY = module;
312 IP6_NF_MANGLE = module;
315 IP6_NF_TARGET_MASQUERADE = module;
316 IP6_NF_TARGET_NPT = module;
317 # end of IPv6: Netfilter Configuration
319 NF_DEFRAG_IPV6 = module;
338 F2FS_FS = lib.mkForce no;
361 MISC_FILESYSTEMS = no;
375 STAGING = lib.mkForce no;
384 DRM_STM = lib.mkForce no;
386 INPUT_TOUCHSCREEN = no;
387 MEDIA_ANALOG_TV_SUPPORT = lib.mkForce no;
388 MEDIA_DIGITAL_TV_SUPPORT = lib.mkForce no;
391 MPTCP = lib.mkForce no;
393 NF_TABLES_BRIDGE = lib.mkForce no;
396 PARAVIRT = lib.mkForce no;
398 USB_GSPCA = lib.mkForce no;
399 VIDEO_STK1160_COMMON = lib.mkForce no;
400 XEN = lib.mkForce no;
403 #ignoreConfigErrors = true;
408 boot.cleanTmpDir = true;
409 boot.tmpOnTmpfs = lib.mkForce false;
410 # TODO: is that needed?
411 hardware.enableRedistributableFirmware = true;
413 postBuildCommands = ''
414 dd if=${pkgs.ubootCubieboard2}/u-boot-sunxi-with-spl.bin of=$img bs=1024 seek=8 conv=notrunc
416 compressImage = true;
419 populateFirmwareCommands = lib.mkForce "";
421 boot.initrd.availableKernelModules = lib.mkForce [
427 # nix -L build .#nixosConfigurations.${hostName}.config.boot.kernelPackages.kernel.configfile
428 boot.kernelPackages = lib.mkForce pkgs.linuxPackages_latest_Cubieboard2;