pulsebert: back to pi

This commit is contained in:
Sandro - 2022-09-04 13:13:59 +02:00
parent 4296b8d979
commit 96284491ff
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
3 changed files with 115 additions and 30 deletions

View File

@ -508,9 +508,13 @@
pulsebert = nixosSystem' {
modules = [
./hosts/pulsebert
# build: outputs.nixosConfigurations.pulsebert.config.system.build.sdImage
# run: unzstd -cd result/sd-image/nixos-sd-image-*-aarch64-linux.img.zst | pv -br | sudo dd bs=4M of=/dev/sdX
"${inputs.nixos-unstable}/nixos/modules/installer/sd-card/sd-image-aarch64-new-kernel.nix"
];
nixpkgs = inputs.nixos-unstable;
system = "x86_64-linux";
# system = "x86_64-linux";
system = "aarch64-linux";
};
radiobert = nixosSystem' {

View File

@ -8,24 +8,42 @@
c3d2 = {
isInHq = true;
mergeHostsFile = true;
hq.interface = "enp1s0";
# hq.interface = "enp1s0";
hq.interface = "eth0";
hq.statistics.enable = true;
k-ot.enable = true;
audioServer.enable = true;
};
boot = {
loader.systemd-boot = {
enable = true;
configurationLimit = 2;
growPartition = true;
# kernelPatches = [{
# # name = "crashdump-config";
# patch = null;
# extraConfig = ''
# SND_SOC_RT5670 m
# '';
# }];
# kernelPackages = pkgs.linuxKernel.packages.linux_5_15;
kernelParams = [ "console=tty0" ];
loader = {
grub.enable = false;
# systemd-boot = {
# enable = true;
# configurationLimit = 2;
# };
};
loader.efi.canTouchEfiVariables = true;
kernelPackages = pkgs.linuxPackages_latest;
supportedFilesystems = lib.mkForce [ "vfat" "ext4" ];
tmpOnTmpfs = true;
};
hardware = {
bluetooth.enable = false; # has no wireless hardware
deviceTree = {
enable = true;
kernelPackage = config.boot.kernelPackages.kernel;
};
enableRedistributableFirmware = true;
};
@ -34,6 +52,12 @@
maxJobs = 1;
};
nixpkgs.config.packageOverrides = pkgs: {
makeModulesClosure = x:
# prevent kernel install fail due to missing modules
pkgs.makeModulesClosure (x // { allowMissing = true; });
};
networking = {
firewall = {
allowedTCPPorts = [
@ -50,7 +74,8 @@
hostName = "pulsebert";
useDHCP = false;
interfaces = {
enp1s0.useDHCP = true;
# enp1s0.useDHCP = true;
eth0.useDHCP = true;
};
};
@ -64,6 +89,60 @@
programs.tmux.enable = true;
# https://github.com/dump-dvb/nix-config/blob/310ceedca5ab2d5c22070bd73c603926b6100a74/hardware/configuration-rpi-3b.nix#L16
sdImage = lib.mkForce {
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
[pi3]
kernel=u-boot-rpi3.bin
hdmi_force_hotplug=1
[pi02]
kernel=u-boot-rpi3.bin
[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin
# Otherwise the resolution will be weird in most cases, compared to
# what the pi3 firmware does by default.
disable_overscan=1
# Supported in newer board revisions
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
# Boot in 64-bit mode.
arm_64bit=1
# U-Boot needs this to work, regardless of whether UART is actually used or not.
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
# a requirement in the future.
enable_uart=1
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'';
in ''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
# Add the config
cp ${configTxt} firmware/config.txt
# Add pi3 specific files
cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
# Add pi4 specific files
cp ${pkgs.ubootRaspberryPi4_64bit}/u-boot.bin firmware/u-boot-rpi4.bin
cp ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin firmware/armstub8-gic.bin
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-4-b.dtb firmware/
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-400.dtb firmware/
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4.dtb firmware/
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4s.dtb firmware/
'';
populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
};
security = {
rtkit.enable = true;
sudo = {
@ -77,8 +156,7 @@
# Allow access to printer serial port and GPIO
"${config.services.octoprint.user}".extraGroups = [ "dialout" ];
})
{
}
{ }
];
services = {

View File

@ -4,34 +4,37 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
#imports =
# [ (modulesPath + "/installer/scan/not-detected.nix")
# ];
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" "sdhci_acpi" ];
boot.initrd.availableKernelModules = [ "usbhid" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
# mkForce to get rid of "console=ttyAMA0" from sd-image-aarch64.nix
boot.kernelParams = lib.mkForce [
"snd_bcm2835.enable_headphones=1"
];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/dfa5920b-debc-4e60-a33b-ef6a1ef1ed48";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D35A-D516";
fsType = "vfat";
};
fileSystems."/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
hardware.enableRedistributableFirmware = true;
#networking.wireless.enable = true;
boot.loader.raspberryPi.firmwareConfig = ''
gpu_mem=192
dtparam=audio=on
'';
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
}