From 42a2e79889d0f55dffdaaaaf41b6dc922b1dea07 Mon Sep 17 00:00:00 2001 From: mjallen <=> Date: Mon, 12 May 2025 15:39:36 +0000 Subject: [PATCH] temp pi4 --- flake.lock | 8 +-- flake.nix | 24 ++++----- hosts/pi4/boot.nix | 60 +++++++++++----------- hosts/pi4/configuration.nix | 61 ++++++++++++----------- hosts/pi4/hardware-configuration.nix | 74 ++++++++++++++++++++++++++++ 5 files changed, 154 insertions(+), 73 deletions(-) create mode 100644 hosts/pi4/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 66b25a7..d4b3d7a 100755 --- a/flake.lock +++ b/flake.lock @@ -1337,16 +1337,16 @@ }, "pi4-nixpkgs": { "locked": { - "lastModified": 1735563628, - "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", + "lastModified": 1746904237, + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index a1ce403..7c2e8c1 100755 --- a/flake.nix +++ b/flake.nix @@ -152,7 +152,7 @@ # nixpgs pi4-nixpkgs = { - url = "github:NixOS/nixpkgs/nixos-24.05"; + url = "github:NixOS/nixpkgs/nixos-unstable"; }; # Home Manager @@ -461,22 +461,22 @@ }; # pi4 - "pi4" = pi4-nixos-raspberrypi.lib.nixosSystem { - specialArgs = inputs; + "pi4" = pi4-nixpkgs.lib.nixosSystem { + # specialArgs = inputs; system = "aarch64-linux"; modules = [ pi4-impermanence.nixosModules.impermanence pi4-sops-nix.nixosModules.sops ./hosts/pi4/configuration.nix - { - # Hardware specific configuration, see section below for a more complete - # list of modules - imports = with nixos-raspberrypi.nixosModules; [ - raspberry-pi-4.base - raspberry-pi-4.display-vc4 - raspberry-pi-4.bluetooth - ]; - } + #{ + # # Hardware specific configuration, see section below for a more complete + # # list of modules + # imports = with nixos-raspberrypi.nixosModules; [ + # raspberry-pi-4.base + # raspberry-pi-4.display-vc4 + # raspberry-pi-4.bluetooth + # ]; + #} pi4-home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/hosts/pi4/boot.nix b/hosts/pi4/boot.nix index 35a4edf..163b30f 100755 --- a/hosts/pi4/boot.nix +++ b/hosts/pi4/boot.nix @@ -1,52 +1,56 @@ { pkgs, lib, ... }: let - kernelBundle = pkgs.linuxAndFirmware.v6_6_31; +# kernelBundle = pkgs.linuxAndFirmware.v6_6_31; in { boot = { - loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw; - kernelPackages = kernelBundle.linuxPackages_rpi4; + loader.systemd-boot.enable = true; + # loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw; + # kernelPackages = kernelBundle.linuxPackages_rpi4; + loader.efi.canTouchEfiVariables = false; + kernelPackages = pkgs.linuxPackages_latest; }; - hardware.raspberry-pi.config = { - all = { # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters +# hardware.raspberry-pi.config = { +# all = { # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters - options = { +# 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; - }; +# 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; - }; - }; +# 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://github.com/raspberrypi/linux/blob/a1d3defcca200077e1e382fe049ca613d16efd2b/arch/arm/boot/dts/overlays/README#L1323 +# base-dt-params = { # https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-pcie - pciex1 = { - enable = true; - value = "on"; - }; +# 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"; - }; +# pciex1_gen = { +# enable = true; +# value = "3"; +# }; - }; +# }; - }; - }; +# }; +# }; } diff --git a/hosts/pi4/configuration.nix b/hosts/pi4/configuration.nix index 2c317e8..e562a6f 100755 --- a/hosts/pi4/configuration.nix +++ b/hosts/pi4/configuration.nix @@ -5,52 +5,54 @@ { config, lib, pkgs, ... }: let user = "matt"; - password = config.sops.secrets."jallen-nas/admin_password".path; - kernelBundle = pkgs.linuxAndFirmware.v6_6_31; + password = config.sops.secrets."desktop/matt_password".path; +# kernelBundle = pkgs.linuxAndFirmware.v6_6_31; in { imports = [ ./boot.nix ./impermanence.nix + ./hardware-configuration.nix ./networking.nix ./sops.nix ../default.nix ]; + programs.zsh.enable = true; # Enable nix flakes and nix-command tools - nix = { - settings = { - substituters = [ - "https://nixos-raspberrypi.cachix.org" - ]; - trusted-public-keys = [ - "nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI=" - ]; - }; - }; +# nix = { +# settings = { +# substituters = [ +# "https://nixos-raspberrypi.cachix.org" +# ]; +# trusted-public-keys = [ +# "nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI=" +# ]; +# }; +# }; # Configure nixpkgs - nixpkgs = { - overlays = lib.mkAfter [ - (self: super: { - # This is used in (modulesPath + "/hardware/all-firmware.nix") when at least +# 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; +# inherit (kernelBundle) raspberrypiWirelessFirmware; # Some derivations want to use it as an input, # e.g. raspberrypi-dtbs, omxplayer, sd-image-* modules - inherit (kernelBundle) raspberrypifw; - }) - ]; - }; +# inherit (kernelBundle) raspberrypifw; +# }) +# ]; +# }; - system.nixos.tags = let - cfg = config.boot.loader.raspberryPi; - in [ - "raspberry-pi-${cfg.variant}" - cfg.bootloader - config.boot.kernelPackages.kernel.version - ]; +# system.nixos.tags = let +# cfg = config.boot.loader.raspberryPi; +# in [ +# "raspberry-pi-${cfg.variant}" +# cfg.bootloader +# config.boot.kernelPackages.kernel.version +# ]; systemd.services.btattach = { before = [ "bluetooth.service" ]; @@ -75,7 +77,8 @@ in mutableUsers = false; users."${user}" = { isNormalUser = true; - hashedPasswordFile = password; + initialPassword = "BogieDudie1"; +# hashedPasswordFile = password; extraGroups = [ "wheel" "docker" diff --git a/hosts/pi4/hardware-configuration.nix b/hosts/pi4/hardware-configuration.nix new file mode 100644 index 0000000..edfaa11 --- /dev/null +++ b/hosts/pi4/hardware-configuration.nix @@ -0,0 +1,74 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "none"; + fsType = "tmpfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/BB3E-1C0D"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + fileSystems."/boot/firmware" = + { device = "/dev/disk/by-uuid/BB27-527E"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/683f2c98-9802-44bb-bd89-69ad960b8655"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/etc" = + { device = "/dev/disk/by-uuid/683f2c98-9802-44bb-bd89-69ad960b8655"; + fsType = "btrfs"; + options = [ "subvol=etc" ]; + }; + + fileSystems."/var/log" = + { device = "/dev/disk/by-uuid/683f2c98-9802-44bb-bd89-69ad960b8655"; + fsType = "btrfs"; + options = [ "subvol=log" ]; + }; + + fileSystems."/root" = + { device = "/dev/disk/by-uuid/683f2c98-9802-44bb-bd89-69ad960b8655"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/683f2c98-9802-44bb-bd89-69ad960b8655"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.end0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +}