From ecfe74e82c979950ef2d61c97d16cfefc663b0be Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Sat, 5 Oct 2024 17:44:12 -0700 Subject: [PATCH] Have rhubarb do the same thing as radish for now --- nixos-configurations/pea/base.nix | 5 +- nixos-configurations/rhubarb/default.nix | 97 ++++++++++++++++-------- 2 files changed, 65 insertions(+), 37 deletions(-) diff --git a/nixos-configurations/pea/base.nix b/nixos-configurations/pea/base.nix index 904b16b1..89af6d76 100644 --- a/nixos-configurations/pea/base.nix +++ b/nixos-configurations/pea/base.nix @@ -33,6 +33,7 @@ in "${modulesPath}/profiles/all-hardware.nix" ]; + custom.server.enable = true; custom.image = { installer.targetDisk = "/dev/mmcblk0"; postImageCommands = '' @@ -69,10 +70,6 @@ in }; }; - # {{{ TODO(jared): delete this - users.users.root.initialPassword = lib.warn "EMPTY ROOT PASSWORD, DO NOT USE IN 'PRODUCTION'" ""; - # }}} - hardware.deviceTree.enable = true; hardware.deviceTree.filter = "sun8i-h2-plus-bananapi-m2-zero.dtb"; diff --git a/nixos-configurations/rhubarb/default.nix b/nixos-configurations/rhubarb/default.nix index 5a9e691b..d4f157ee 100644 --- a/nixos-configurations/rhubarb/default.nix +++ b/nixos-configurations/rhubarb/default.nix @@ -1,10 +1,20 @@ -{ lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: + let uboot = pkgs.uboot-rpi_4.override { extraStructuredConfig = with lib.kernel; { - # Not enabled by default for RPI 4 + DISTRO_DEFAULTS = unset; + BOOTSTD_DEFAULTS = yes; FIT = yes; + # Allow for larger than the default 8MiB kernel size + SYS_BOOTM_LEN = freeform "0x${lib.toHexString (64 * 1024 * 1024)}"; # 64MiB + # Allow for using u-boot scripts. BOOTSTD_FULL = yes; @@ -12,6 +22,7 @@ let BOOTCOUNT_ENV = yes; }; }; + configTxt = pkgs.writeText "config.txt" '' [all] arm_64bit=1 @@ -24,40 +35,60 @@ let ''; in { - nixpkgs.hostPlatform = "aarch64-linux"; - - custom.server.enable = true; - custom.basicNetwork.enable = true; - custom.image = { - installer.targetDisk = "/dev/mmcblk0"; - bootFileCommands = '' - echo ${uboot}/u-boot.bin:/kernel8.img >> $bootfiles - echo ${configTxt}:/config.txt >> $bootfiles - echo ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin:/armstub8-gic.bin >> $bootfiles - echo ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-4-b.dtb:/bcm2711-rpi-4-b.dtb >> $bootfiles - find ${pkgs.raspberrypifw}/share/raspberrypi/boot -name "fixup*" \ - -exec sh -c 'echo {}:/$(basename {})' \; >> $bootfiles - find ${pkgs.raspberrypifw}/share/raspberrypi/boot -name "start*" \ - -exec sh -c 'echo {}:/$(basename {})' \; >> $bootfiles - ''; - boot.uboot = { - enable = true; - bootMedium.type = "mmc"; - kernelLoadAddress = "0x3000000"; - }; - }; + config = lib.mkMerge [ + { + nixpkgs.hostPlatform = "aarch64-linux"; + + custom.image.bootFileCommands = '' + echo ${config.system.build.firmware}/u-boot.bin:/kernel8.img >> $bootfiles + echo ${configTxt}:/config.txt >> $bootfiles + echo ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin:/armstub8-gic.bin >> $bootfiles + echo ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-4-b.dtb:/bcm2711-rpi-4-b.dtb >> $bootfiles + find ${pkgs.raspberrypifw}/share/raspberrypi/boot -name "fixup*" \ + -exec sh -c 'echo {}:/$(basename {})' \; >> $bootfiles + find ${pkgs.raspberrypifw}/share/raspberrypi/boot -name "start*" \ + -exec sh -c 'echo {}:/$(basename {})' \; >> $bootfiles + ''; + + # https://forums.raspberrypi.com/viewtopic.php?t=319435 + systemd.repart.partitions."10-boot".Type = lib.mkForce "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"; - # https://forums.raspberrypi.com/viewtopic.php?t=319435 - systemd.repart.partitions."10-boot".Type = lib.mkForce "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"; + system.build.firmware = uboot; - system.build.firmware = uboot; + hardware.deviceTree.enable = true; + hardware.deviceTree.name = "broadcom/bcm2711-rpi-4-b.dtb"; - hardware.deviceTree.enable = true; - hardware.deviceTree.name = "broadcom/bcm2711-rpi-4-b.dtb"; + boot.kernelParams = [ "console=ttyS0,115200" ]; - boot.kernelParams = [ "console=ttyS0,115200" ]; + environment.etc."fw_env.config".text = '' + ${config.boot.loader.efi.efiSysMountPoint}/uboot.env 0x0000 0x10000 + ''; - # {{{ TODO(jared): delete this - users.users.root.initialPassword = lib.warn "EMPTY ROOT PASSWORD, DO NOT USE IN 'PRODUCTION'" ""; - # }}} + environment.systemPackages = [ pkgs.uboot-env-tools ]; + } + { + custom.server.enable = true; + custom.basicNetwork.enable = true; + custom.nativeBuild = true; + custom.image = { + installer.targetDisk = "/dev/mmcblk0"; + boot.uboot = { + enable = true; + bootMedium.type = "mmc"; + kernelLoadAddress = "0x3000000"; + }; + }; + } + { + services.xserver.desktopManager.kodi = { + enable = true; + package = pkgs.kodi.override { + sambaSupport = false; # deps don't cross-compile + x11Support = false; + waylandSupport = true; + pipewireSupport = true; + }; + }; + } + ]; }