This commit is contained in:
mjallen18
2025-05-09 14:42:56 -05:00
parent df6701a609
commit 2ba6a6e0ba
5 changed files with 96 additions and 141 deletions

View File

@@ -386,8 +386,10 @@
# Pi5
"pi5" = nixos-raspberrypi.lib.nixosSystem {
specialArgs = inputs;
system = "aarch64-linux";
modules = [
Pi5-impermanence.nixosModules.impermanence
Pi5-sops-nix.nixosModules.sops
./hosts/pi5/configuration.nix
{
# Hardware specific configuration, see section below for a more complete
@@ -398,65 +400,21 @@
raspberry-pi-5.bluetooth
];
}
({ config, pkgs, lib, ... }:
let
kernelBundle = pkgs.linuxAndFirmware.v6_6_31;
in {
boot = {
loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw;
kernelPackages = kernelBundle.linuxPackages_rpi5;
};
nixpkgs.overlays = lib.mkAfter [
(self: super: {
# This is used in (modulesPath + "/hardware/all-firmware.nix") when at least
# enableRedistributableFirmware is enabled
# I know no easier way to override this package
inherit (kernelBundle) raspberrypiWirelessFirmware;
# Some derivations want to use it as an input,
# e.g. raspberrypi-dtbs, omxplayer, sd-image-* modules
inherit (kernelBundle) raspberrypifw;
})
];
networking.hostName = "pi5";
system.nixos.tags = let
cfg = config.boot.loader.raspberryPi;
in [
"raspberry-pi-${cfg.variant}"
cfg.bootloader
config.boot.kernelPackages.kernel.version
];
})
# ...
Pi5-home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.matt =
{ ... }:
{
imports = [
./hosts/pi5/home.nix
Pi5-sops-nix.homeManagerModules.sops
];
};
}
];
};
# "pi5" = Pi5-nixpkgs.lib.nixosSystem {
# system = "aarch64-linux";
# modules = [
# Pi5-nixos-hardware.nixosModules.raspberry-pi-4
# Pi5-impermanence.nixosModules.impermanence
# ./hosts/pi5/configuration.nix
# Pi5-sops-nix.nixosModules.sops
# Pi5-home-manager.nixosModules.home-manager
# {
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
# home-manager.users.matt =
# { ... }:
# {
# imports = [
# ./hosts/pi5/home.nix
# Pi5-sops-nix.homeManagerModules.sops
# ];
# };
# }
# ];
# };
"steamdeck" = steamdeck-nixpkgs.lib.nixosSystem {
system = "x86_64-linux";

View File

@@ -1,18 +1,52 @@
{ pkgs, lib, ... }:
let
kernelBundle = pkgs.linuxAndFirmware.v6_6_31;
in
{
boot = {
kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_rpi4;
initrd.availableKernelModules = [
"usbhid"
"usb_storage"
"vc4"
"pcie_brcmstb" # required for the pcie bus to work
"reset-raspberrypi" # required for vl805 firmware to load
];
loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw;
kernelPackages = kernelBundle.linuxPackages_rpi5;
};
hardware.raspberry-pi.config = {
all = { # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters
options = {
# https://www.raspberrypi.com/documentation/computers/config_txt.html#enable_uart
# in conjunction with `console=serial0,115200` in kernel command line (`cmdline.txt`)
# creates a serial console, accessible using GPIOs 14 and 15 (pins
# 8 and 10 on the 40-pin header)
enable_uart = {
enable = true;
value = true;
};
# https://www.raspberrypi.com/documentation/computers/config_txt.html#uart_2ndstage
# enable debug logging to the UART, also automatically enables
# UART logging in `start.elf`
uart_2ndstage = {
enable = true;
value = true;
};
};
# Base DTB parameters
# https://github.com/raspberrypi/linux/blob/a1d3defcca200077e1e382fe049ca613d16efd2b/arch/arm/boot/dts/overlays/README#L132
base-dt-params = {
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-pcie
pciex1 = {
enable = true;
value = "on";
};
# PCIe Gen 3.0
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0
pciex1_gen = {
enable = true;
value = "3";
};
};
loader = {
grub.enable = lib.mkDefault false;
generic-extlinux-compatible.enable = lib.mkForce true;
};
};
}

View File

@@ -1,45 +0,0 @@
{ config, pkgs, lib, ... }:
{
hardware.raspberry-pi.config = {
all = { # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters
options = {
# https://www.raspberrypi.com/documentation/computers/config_txt.html#enable_uart
# in conjunction with `console=serial0,115200` in kernel command line (`cmdline.txt`)
# creates a serial console, accessible using GPIOs 14 and 15 (pins
# 8 and 10 on the 40-pin header)
enable_uart = {
enable = true;
value = true;
};
# https://www.raspberrypi.com/documentation/computers/config_txt.html#uart_2ndstage
# enable debug logging to the UART, also automatically enables
# UART logging in `start.elf`
uart_2ndstage = {
enable = true;
value = true;
};
};
# Base DTB parameters
# https://github.com/raspberrypi/linux/blob/a1d3defcca200077e1e382fe049ca613d16efd2b/arch/arm/boot/dts/overlays/README#L132
base-dt-params = {
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-pcie
pciex1 = {
enable = true;
value = "on";
};
# PCIe Gen 3.0
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0
pciex1_gen = {
enable = true;
value = "3";
};
};
};
};
}

View File

@@ -15,16 +15,14 @@ let
in
{
imports = [
# ./boot.nix
./boot.nix
./hardware-configuration.nix
./impermanence.nix
./bootconfig.nix
# ./sops.nix
# ../default.nix
./networking.nix
./sops.nix
];
networking.networkmanager.enable = true;
programs.zsh.enable = true;
# raspberry-pi-nix.board = lib.mkForce "bcm2712";
# Enable nix flakes and nix-command tools
nix = {
@@ -52,9 +50,32 @@ in
];
};
};
# Configure nixpkgs
# Enable non free
nixpkgs.config.allowUnfree = lib.mkForce true;
nixpkgs = {
# Enable non free
config.allowUnfree = lib.mkForce true;
overlays = lib.mkAfter [
(self: super: {
# This is used in (modulesPath + "/hardware/all-firmware.nix") when at least
# enableRedistributableFirmware is enabled
# I know no easier way to override this package
inherit (kernelBundle) raspberrypiWirelessFirmware;
# Some derivations want to use it as an input,
# e.g. raspberrypi-dtbs, omxplayer, sd-image-* modules
inherit (kernelBundle) raspberrypifw;
})
];
};
system.nixos.tags = let
cfg = config.boot.loader.raspberryPi;
in [
"raspberry-pi-${cfg.variant}"
cfg.bootloader
config.boot.kernelPackages.kernel.version
];
# Hardware configs
hardware = {
@@ -75,30 +96,9 @@ in
};
};
# hardware = {
# raspberry-pi."4".fkms-3d.enable = false;
# raspberry-pi."4".apply-overlays-dtmerge.enable = false;
# raspberry-pi."4".audio.enable = false;
# raspberry-pi."4".bluetooth.enable = false;
# raspberry-pi."4".dwc2.enable = false;
# raspberry-pi."4".xhci.enable = false;
# };
# Set your time zone.
time.timeZone = timezone;
networking = {
hostName = hostname;
defaultGateway.address = "10.0.1.1";
nameservers = [ "10.0.1.1" ];
firewall = {
enable = true;
allowPing = true;
};
};
systemd.services.btattach = {
before = [ "bluetooth.service" ];
after = [ "dev-ttyAMA0.device" ];

View File

@@ -7,6 +7,14 @@ in
networking = {
hostName = hostname;
defaultGateway.address = "10.0.1.1";
nameservers = [ "10.0.1.1" ];
firewall = {
enable = true;
allowPing = true;
};
# Enable Network Manager
networkmanager = {
enable = lib.mkDefault true;