From 35547ca183f91a58e1d453564d0f70471d8f198b Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Tue, 10 Jun 2025 14:25:07 -0500 Subject: [PATCH] temp pi4 --- flake.nix | 34 ++++++++------ hosts/nas/nix-serve.nix | 4 +- hosts/pi4/argononed.nix | 92 ++++++++++++++++++------------------- hosts/pi4/boot.nix | 70 ++++++++++++++++++++++------ hosts/pi4/configuration.nix | 27 ++++++++++- 5 files changed, 148 insertions(+), 79 deletions(-) diff --git a/flake.nix b/flake.nix index d0688fe..ba91a25 100755 --- a/flake.nix +++ b/flake.nix @@ -121,6 +121,8 @@ nas-nixai.url = "github:olafkfreund/nix-ai-help"; + nas-nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; + ##################################################### # pi5 # ##################################################### @@ -152,9 +154,7 @@ inputs.nixpkgs.follows = "pi5-nixpkgs"; }; - nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi"; - - nas-nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; + pi5-nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi"; pi5-disko = { # the fork is needed for partition attributes support @@ -196,8 +196,6 @@ pi4-nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi"; - pi4-argon40-nix.url = "github:guusvanmeerveld/argon40-nix"; - pi4-disko = { # the fork is needed for partition attributes support url = "github:nvmd/disko/gpt-attrs"; @@ -327,7 +325,7 @@ pi5-impermanence, pi5-nixos-hardware, pi5-sops-nix, - nixos-raspberrypi, + pi5-nixos-raspberrypi, pi5-disko, # pi4 @@ -338,7 +336,6 @@ pi4-nixos-hardware, pi4-nixos-raspberrypi, pi4-disko, - pi4-argon40-nix, # Steamdeck steamdeck-nixpkgs, @@ -509,7 +506,7 @@ }; # pi5 - "pi5" = nixos-raspberrypi.lib.nixosSystem { + "pi5" = pi5-nixos-raspberrypi.lib.nixosSystem { specialArgs = inputs // { inherit outputs; @@ -527,7 +524,7 @@ { # Hardware specific configuration, see section below for a more complete # list of modules - imports = with nixos-raspberrypi.nixosModules; [ + imports = with pi5-nixos-raspberrypi.nixosModules; [ raspberry-pi-5.base raspberry-pi-5.display-vc4 raspberry-pi-5.bluetooth @@ -559,10 +556,10 @@ }; # pi4 - "pi4" = pi4-nixpkgs.lib.nixosSystem { - # specialArgs = inputs; - specialArgs = { - inherit inputs outputs; + "pi4" = pi4-nixos-raspberrypi.lib.nixosSystem { + specialArgs = inputs // + { + inherit outputs; }; system = "aarch64-linux"; modules = [ @@ -570,10 +567,19 @@ pi4-disko.nixosModules.disko ./share/disko/pi-uefi-disko.nix pi4-nixos-hardware.nixosModules.raspberry-pi-4 + { + # Hardware specific configuration, see section below for a more complete + # list of modules + imports = with pi4-nixos-raspberrypi.nixosModules; [ + raspberry-pi-4.base + raspberry-pi-4.display-vc4 + raspberry-pi-4.bluetooth + raspberry-pi-4.case-argonone + ]; + } pi4-impermanence.nixosModules.impermanence pi4-sops-nix.nixosModules.sops ./hosts/pi4/configuration.nix - pi4-argon40-nix.nixosModules.default pi4-home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/hosts/nas/nix-serve.nix b/hosts/nas/nix-serve.nix index 813d5d5..90c3317 100755 --- a/hosts/nas/nix-serve.nix +++ b/hosts/nas/nix-serve.nix @@ -299,8 +299,8 @@ in }; }; - nix.settings.builders-use-substitutes = true; - nix.distributedBuilds = true; +# nix.settings.builders-use-substitutes = true; +# nix.distributedBuilds = true; nix.buildMachines = [ { hostName = "pi5.local"; diff --git a/hosts/pi4/argononed.nix b/hosts/pi4/argononed.nix index 270cb19..38bbe17 100644 --- a/hosts/pi4/argononed.nix +++ b/hosts/pi4/argononed.nix @@ -1,51 +1,51 @@ -{ ... }: -{ - programs.argon.one = { - enable = true; +# { ... }: +# { +# programs.argon.one = { +# enable = true; - settings = { - # Is 'celsius' by default, can also be set to 'fahrenheit' - displayUnits = "celsius"; +# settings = { +# # Is 'celsius' by default, can also be set to 'fahrenheit' +# displayUnits = "celsius"; - # This is the same config as the original Argon40 config. - # This is also the default config for this flake. - fanspeed = [ - { - # This the temperature threshold at which this fan speed will activate. - # The temperature is in the above specified unit. - temperature = 55; - # This is speed percentage at which the fan will spin. - speed = 30; - } - { - temperature = 60; - speed = 55; - } - { - temperature = 65; - speed = 100; - } - ]; - ir = { - enable = true; - gpio.enable = true; - keymap = { - "POWER" = "00ff39c6"; - "UP" = "00ff53ac"; - "DOWN" = "00ff4bb4"; - "LEFT" = "00ff9966"; - "RIGHT" = "00ff837c"; - "VOLUMEUP" = "00ff01fe"; - "VOLUMEDOWN" = "00ff817e"; - "OK" = "00ff738c"; - "HOME" = "00ffd32c"; - "MENU" = "00ffb946"; - "BACK" = "00ff09f6"; - }; - }; - }; - }; -} +# # This is the same config as the original Argon40 config. +# # This is also the default config for this flake. +# fanspeed = [ +# { +# # This the temperature threshold at which this fan speed will activate. +# # The temperature is in the above specified unit. +# temperature = 55; +# # This is speed percentage at which the fan will spin. +# speed = 30; +# } +# { +# temperature = 60; +# speed = 55; +# } +# { +# temperature = 65; +# speed = 100; +# } +# ]; +# ir = { +# enable = true; +# gpio.enable = true; +# keymap = { +# "POWER" = "00ff39c6"; +# "UP" = "00ff53ac"; +# "DOWN" = "00ff4bb4"; +# "LEFT" = "00ff9966"; +# "RIGHT" = "00ff837c"; +# "VOLUMEUP" = "00ff01fe"; +# "VOLUMEDOWN" = "00ff817e"; +# "OK" = "00ff738c"; +# "HOME" = "00ffd32c"; +# "MENU" = "00ffb946"; +# "BACK" = "00ff09f6"; +# }; +# }; +# }; +# }; +# } # { lib, stdenv, pkgs, config, ...}: # { # imports = let diff --git a/hosts/pi4/boot.nix b/hosts/pi4/boot.nix index 2a35ce5..9d4cf36 100755 --- a/hosts/pi4/boot.nix +++ b/hosts/pi4/boot.nix @@ -1,23 +1,63 @@ +# { pkgs, lib, ... }: +# let +# uefi_pi4 = pkgs.callPackage ./pi4-uefi.nix { }; +# in +# { +# boot = { +# loader = { +# systemd-boot.enable = lib.mkForce false; +# efi.canTouchEfiVariables = false; +# generic-extlinux-compatible.enable = lib.mkForce true; +# }; +# plymouth.enable = false; +# kernelPackages = pkgs.linuxPackages_rpi4; +# kernelModules = [ "i2c-dev" "i2c-bcm2835" ]; +# initrd.kernelModules = [ "i2c-dev" "i2c-bcm2835" ]; +# }; +# # environment.systemPackages = [ uefi_pi4 ]; + +# # Copy UEFI firmware files to the boot partition +# # system.activationScripts.installUEFIFirmware.text = '' +# # cp -r ${uefi_pi4}/share/uefi_rpi4/* /boot/firmware/ +# # ''; +# } { pkgs, lib, ... }: let - uefi_pi4 = pkgs.callPackage ./pi4-uefi.nix { }; + kernelBundle = pkgs.linuxAndFirmware.latest; in { boot = { - loader = { - systemd-boot.enable = lib.mkForce false; - efi.canTouchEfiVariables = false; - generic-extlinux-compatible.enable = lib.mkForce true; - }; - plymouth.enable = false; - kernelPackages = pkgs.linuxPackages_rpi4; - kernelModules = [ "i2c-dev" "i2c-bcm2835" ]; - initrd.kernelModules = [ "i2c-dev" "i2c-bcm2835" ]; + loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw; + kernelPackages = kernelBundle.linuxPackages_rpi4; }; - # environment.systemPackages = [ uefi_pi4 ]; + + hardware.raspberry-pi.config = { + all = { # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters - # Copy UEFI firmware files to the boot partition - # system.activationScripts.installUEFIFirmware.text = '' - # cp -r ${uefi_pi4}/share/uefi_rpi4/* /boot/firmware/ - # ''; + 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 = { + + }; + + }; + }; } diff --git a/hosts/pi4/configuration.nix b/hosts/pi4/configuration.nix index 6c33c57..e2a36c3 100755 --- a/hosts/pi4/configuration.nix +++ b/hosts/pi4/configuration.nix @@ -10,11 +10,11 @@ in { imports = [ ./adguard.nix - ./argononed.nix + # ./argononed.nix ./boot.nix ./impermanence.nix ./networking.nix - ./pi4-hw.nix + # ./pi4-hw.nix ./sops.nix ]; @@ -29,6 +29,29 @@ in }; }; + # Configure nixpkgs + 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; + }) + ]; + }; + + system.nixos.tags = let + cfg = config.boot.loader.raspberryPi; + in [ + "raspberry-pi-${cfg.variant}" + cfg.bootloader + config.boot.kernelPackages.kernel.version + ]; + programs.zsh.enable = true; hardware.i2c.enable = true;