-{ pkgs, lib, config, host, modulesPath, ... }:
+{ pkgs, lib, config, modulesPath, ... }:
{
-imports = [
- "${modulesPath}/installer/sd-card/sd-image.nix"
-];
+ imports = [
+ "${modulesPath}/installer/sd-card/sd-image.nix"
+ ];
-# Too CPU hungry for this hardware, for too little Mio saved
-nix.autoOptimiseStore = false;
+ _module.args.CPUs = 2;
-powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
+ # Too CPU hungry for this hardware, for too little MiB saved
+ nix.settings.auto-optimise-store = false;
-boot.supportedFilesystems = [
- #"btrfs"
- #"reiserfs"
- "vfat"
- #"f2fs"
- #"xfs"
- #"zfs" # ZFS tools coredump with SIGSEGV
- #"ntfs"
- #"cifs"
-];
+ powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
-# The serial ports listed here are:
-# - ttyS0: for Tegra (Jetson TK1)
-# - ttymxc0: for i.MX6 (Wandboard)
-# - ttyAMA0: for Allwinner (pcDuino3 Nano) and QEMU's -machine virt
-# - ttyO0: for OMAP (BeagleBone Black)
-# - ttySAC2: for Exynos (ODROID-XU3)
-boot.consoleLogLevel = lib.mkDefault 7;
-boot.kernelParams = [
- "console=ttyS0,115200n8"
- "console=ttymxc0,115200n8"
- "console=ttyAMA0,115200n8"
- "console=ttyO0,115200n8"
- "console=ttySAC2,115200n8"
- "console=tty0"
-];
+ boot.supportedFilesystems = [
+ #"btrfs"
+ #"reiserfs"
+ "vfat"
+ #"f2fs"
+ #"xfs"
+ #"zfs" # ZFS tools coredump with SIGSEGV
+ #"ntfs"
+ #"cifs"
+ ];
-#nixpkgs.config.allowUnfree = true;
-nixpkgs.crossSystem = lib.systems.examples.armv7l-hf-multiplatform;
-nixpkgs.overlays = [
- (final: super: {
- # https://linux-sunxi.org/Mali_Open_Source_Driver#Configuration_and_Build
- mesa = super.mesa.override {
- driDrivers = [];
- eglPlatforms = ["x11"];
- enableGalliumNine = false;
- galliumDrivers = ["lima" "panfrost" "kmsro" "swrast"];
- vulkanDrivers = [];
- };
- })
- (final: super: {
- linuxPackages_latest_Cubieboard2 = super.linuxPackages_latest.extend (kfinal: ksuper: {
- kernel = ksuper.kernel.override {
+ # The serial ports listed here are:
+ # - ttyS0: for Tegra (Jetson TK1)
+ # - ttymxc0: for i.MX6 (Wandboard)
+ # - ttyAMA0: for Allwinner (pcDuino3 Nano) and QEMU's -machine virt
+ # - ttyO0: for OMAP (BeagleBone Black)
+ # - ttySAC2: for Exynos (ODROID-XU3)
+ boot.consoleLogLevel = lib.mkDefault 7;
+ boot.kernelParams = [
+ "console=ttyS0,115200n8"
+ "console=ttymxc0,115200n8"
+ "console=ttyAMA0,115200n8"
+ "console=ttyO0,115200n8"
+ "console=ttySAC2,115200n8"
+ "console=tty0"
+ ];
+ boot.kernelPatches = [
+ /*
+ {
+ name = "0001-core_pattern-fix-too-small-CORENAME_MAX_SIZE";
+ patch = ../../../nixpkgs/patches/linux/0001-core_pattern-fix-too-small-CORENAME_MAX_SIZE.patch;
+ extraConfig = ''
+ '';
+ }
+ */
+ ];
+
+ nixpkgs.overlays = [
+ (finalPkgs: previousPkgs: {
+ # https://linux-sunxi.org/Mali_Open_Source_Driver#Configuration_and_Build
+ mesa = (previousPkgs.mesa.override {
+ eglPlatforms = [ "x11" ];
+ galliumDrivers = [
+ "lima"
+ #"panfrost"
+ "kmsro"
+ "swrast"
+ ];
+ enableGalliumNine = false;
+ vulkanDrivers = [
+ "swrast"
+ #"panfrost"
+ ];
+ #vulkanLayers = [ ];
+ }).overrideAttrs (previousAttrs: {
+ mesonFlags = previousAttrs.mesonFlags ++ [
+ # VDPAU state tracker requires at least the following gallium drivers:
+ # r600, radeonsi, nouveau or d3d12
+ "-Dgallium-vdpau=disabled"
+ "-Dgallium-va=disabled"
+ # XA state tracker requires at least one of the following gallium drivers:
+ # nouveau, freedreno, i915, svga.
+ "-Dgallium-xa=disabled"
+ ];
+ });
+ })
+ ];
+ boot.tmp.cleanOnBoot = true;
+ boot.tmp.useTmpfs = lib.mkForce false;
+ # TODO: is that needed?
+ hardware.enableRedistributableFirmware = true;
+ sdImage = {
+ postBuildCommands = ''
+ dd if=${pkgs.ubootCubieboard2}/u-boot-sunxi-with-spl.bin of=$img bs=1024 seek=8 conv=notrunc
+ '';
+ compressImage = true;
+ expandOnBoot = true;
+ firmwareSize = 1;
+ populateFirmwareCommands = "";
+ populateRootCommands = ''
+ mkdir -p ./files/boot
+ ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
+ '';
+ };
+ boot.loader.grub.enable = false;
+ boot.loader.generic-extlinux-compatible.enable = true;
+ # nix -L build .#nixosConfigurations.${hostName}.config.boot.kernelPackages.kernel.configfile
+ boot.kernelPackages = lib.mkForce (
+ # FIXME: config.boot.zfs.package.latestCompatibleLinuxPackages
+ pkgs.linuxPackages_latest.extend (finalKernel: previousKernel: {
+ kernel = previousKernel.kernel.override {
defconfig = "sunxi_defconfig";
structuredExtraConfig = with lib.kernel; {
# Workaround https://github.com/NixOS/nixpkgs/pull/141942#issuecomment-954301443
USB_SERIAL_PL2303 = module;
REGULATOR = lib.mkForce no;
MFD_CORE = no;
+ PCI = yes;
+ # FIXME: Enable wdctl to work when /dev/watchdog is used by systemd
+ #WATCHDOG_SYSFS = yes;
#
# File systems
# misc
DAX = module;
DRM_DISPLAY_CONNECTOR = module;
- FB_SIMPLE = lib.mkForce module;
NET_SCH_CODEL = module;
NET_SCH_FQ_CODEL = module;
UIO = module;
+ # WiFi
+ # Not built in the Cubieboard2, require an USB dongle
+ WIRELESS = yes;
+ CFG80211 = module;
+ LIB80211 = module;
+ LIB80211_CRYPT_CCMP = module;
+ MAC80211 = module;
+ MAC80211_HWSIM = module;
+ NETDEVICES = yes;
+ WLAN = yes;
+ WLAN_VENDOR_REALTEK = yes;
+ NET_VENDOR_REALTEK = yes;
+ REALTEK_PHY = yes;
+ RTL_CARDS = module;
+ RTL8188EE = module; # For 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
+ RTLWIFI = module;
+ RTLWIFI_PCI = module;
+ RTLWIFI_DEBUG = yes;
+
# Sound options
SND_SOC_ADI = no;
SND_SOC_ADI_AXI_I2S = no;
MPI = no;
RAID6 = no;
STAGING = lib.mkForce no;
+ ATH11K_PCI = no;
+ ATH12K = no;
"6LOWPAN" = no;
ARCNET = no;
CAN = no;
COMEDI = no;
DRM_STM = lib.mkForce no;
- DRM_PANEL = lib.mkForce no;
- DRM_BRIDGE = no;
- DRM_PANEL_BRIDGE = no;
DRM_CDNS_DSI = no;
DRM_CHIPONE_ICN6211 = no;
DRM_CHRONTEL_CH7033 = no;
TINYDRM_REPAPER = no;
TINYDRM_ST7586 = no;
TINYDRM_ST7735R = no;
- DRM_PL111 = no;
- DRM_TVE200 = no;
- DRM_LIMA = no;
- DRM_PANFROST = no;
- DRM_MCDE = no;
- DRM_TIDSS = no;
- DRM_GUD = no;
+ DRM = module;
+ DRM_BRIDGE = yes;
DRM_EXPORT_FOR_TESTS = no;
- DRM_PANEL_ORIENTATION_QUIRKS = no;
+ DRM_FBDEV_EMULATION = yes;
+ DRM_GUD = no;
+ DRM_KMS_FB_HELPER = yes;
+ DRM_KMS_HELPER = module;
DRM_LIB_RANDOM = no;
+ DRM_LIMA = module; # TODO: enable for the Mali 400 of the Cubieboard 2
+ DRM_LVDS_ENCODER = module;
+ DRM_NOUVEAU = no;
+ DRM_MCDE = no;
+ DRM_PANEL = yes;
+ DRM_PANEL_BRIDGE = yes;
+ DRM_PANEL_LVDS = module;
+ DRM_PANEL_ORIENTATION_QUIRKS = no;
+ DRM_PANFROST = no; # Not for the hardware of the Cubieboard 2not supported b
+ DRM_PL111 = no;
+ DRM_SCHED = module;
+ DRM_TIDSS = no;
+ DRM_TVE200 = no;
+ VIDEOMODE_HELPERS = yes;
+ FB = yes;
+ FB_CMDLINE = yes;
+ FB_NOTIFY = yes;
+ FB_CFB_FILLRECT = yes;
+ FB_CFB_COPYAREA = yes;
+ FB_CFB_IMAGEBLIT = yes;
+ FB_MODE_HELPERS = yes;
+ FB_TILEBLITTING = yes;
+ FB_SIMPLE = yes;
+
+ DUMMY_CONSOLE = yes;
+ FRAMEBUFFER_CONSOLE = yes;
+ FRAMEBUFFER_CONSOLE_DETECT_PRIMARY = yes;
+ FRAMEBUFFER_CONSOLE_ROTATION = yes;
+ FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = yes;
+
+ BACKLIGHT_LCD_SUPPORT = yes;
+ LCD_CLASS_DEVICE = module;
+ LCD_PLATFORM = module;
+ BACKLIGHT_CLASS_DEVICE = module;
+ BACKLIGHT_GENERIC = module;
+ BACKLIGHT_PWM = module;
+ BACKLIGHT_GPIO = module;
- INFINIBAND = no;
+ INFINIBAND = lib.mkForce no;
INPUT_TOUCHSCREEN = no;
MEDIA_ANALOG_TV_SUPPORT = lib.mkForce no;
MEDIA_DIGITAL_TV_SUPPORT = lib.mkForce no;
features.debug = false;
#ignoreConfigErrors = true;
};
- });
- })
-];
-boot.cleanTmpDir = true;
-boot.tmpOnTmpfs = lib.mkForce false;
-# TODO: is that needed?
-hardware.enableRedistributableFirmware = true;
-sdImage = {
- postBuildCommands = ''
- dd if=${pkgs.ubootCubieboard2}/u-boot-sunxi-with-spl.bin of=$img bs=1024 seek=8 conv=notrunc
- '';
- compressImage = true;
- expandOnBoot = true;
- firmwareSize = 1;
- populateFirmwareCommands = "";
- populateRootCommands = ''
- mkdir -p ./files/boot
- ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
- '';
-};
-boot.loader.grub.enable = false;
-boot.loader.generic-extlinux-compatible.enable = true;
-# nix -L build .#nixosConfigurations.${hostName}.config.boot.kernelPackages.kernel.configfile
-boot.kernelPackages = lib.mkForce pkgs.linuxPackages_latest_Cubieboard2;
-boot.initrd.availableKernelModules = lib.mkForce [
- "mmc_block"
- "usbhid"
- "hid_generic"
- "hid_microsoft"
-];
+ }));
+ boot.initrd.availableKernelModules = lib.mkForce [
+ "mmc_block"
+ "usbhid"
+ "hid_generic"
+ "hid_microsoft"
+ ];
}