This commit is contained in:
mjallen
2025-05-12 15:39:36 +00:00
parent af365fd1e8
commit 42a2e79889
5 changed files with 154 additions and 73 deletions

8
flake.lock generated
View File

@@ -1337,16 +1337,16 @@
}, },
"pi4-nixpkgs": { "pi4-nixpkgs": {
"locked": { "locked": {
"lastModified": 1735563628, "lastModified": 1746904237,
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-24.05", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@@ -152,7 +152,7 @@
# nixpgs # nixpgs
pi4-nixpkgs = { pi4-nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-24.05"; url = "github:NixOS/nixpkgs/nixos-unstable";
}; };
# Home Manager # Home Manager
@@ -461,22 +461,22 @@
}; };
# pi4 # pi4
"pi4" = pi4-nixos-raspberrypi.lib.nixosSystem { "pi4" = pi4-nixpkgs.lib.nixosSystem {
specialArgs = inputs; # specialArgs = inputs;
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ modules = [
pi4-impermanence.nixosModules.impermanence pi4-impermanence.nixosModules.impermanence
pi4-sops-nix.nixosModules.sops pi4-sops-nix.nixosModules.sops
./hosts/pi4/configuration.nix ./hosts/pi4/configuration.nix
{ #{
# Hardware specific configuration, see section below for a more complete # # Hardware specific configuration, see section below for a more complete
# list of modules # # list of modules
imports = with nixos-raspberrypi.nixosModules; [ # imports = with nixos-raspberrypi.nixosModules; [
raspberry-pi-4.base # raspberry-pi-4.base
raspberry-pi-4.display-vc4 # raspberry-pi-4.display-vc4
raspberry-pi-4.bluetooth # raspberry-pi-4.bluetooth
]; # ];
} #}
pi4-home-manager.nixosModules.home-manager pi4-home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;

View File

@@ -1,52 +1,56 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
kernelBundle = pkgs.linuxAndFirmware.v6_6_31; # kernelBundle = pkgs.linuxAndFirmware.v6_6_31;
in in
{ {
boot = { boot = {
loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw; loader.systemd-boot.enable = true;
kernelPackages = kernelBundle.linuxPackages_rpi4; # loader.raspberryPi.firmwarePackage = kernelBundle.raspberrypifw;
# kernelPackages = kernelBundle.linuxPackages_rpi4;
loader.efi.canTouchEfiVariables = false;
kernelPackages = pkgs.linuxPackages_latest;
}; };
hardware.raspberry-pi.config = { # hardware.raspberry-pi.config = {
all = { # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters # 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 # https://www.raspberrypi.com/documentation/computers/config_txt.html#enable_uart
# in conjunction with `console=serial0,115200` in kernel command line (`cmdline.txt`) # in conjunction with `console=serial0,115200` in kernel command line (`cmdline.txt`)
# creates a serial console, accessible using GPIOs 14 and 15 (pins # creates a serial console, accessible using GPIOs 14 and 15 (pins
# 8 and 10 on the 40-pin header) # 8 and 10 on the 40-pin header)
enable_uart = { # enable_uart = {
enable = true; # enable = true;
value = true; # value = true;
}; # };
# https://www.raspberrypi.com/documentation/computers/config_txt.html#uart_2ndstage # https://www.raspberrypi.com/documentation/computers/config_txt.html#uart_2ndstage
# enable debug logging to the UART, also automatically enables # enable debug logging to the UART, also automatically enables
# UART logging in `start.elf` # UART logging in `start.elf`
uart_2ndstage = { # uart_2ndstage = {
enable = true; # enable = true;
value = true;
}; # value = true;
}; # };
# };
# Base DTB parameters # Base DTB parameters
# https://github.com/raspberrypi/linux/blob/a1d3defcca200077e1e382fe049ca613d16efd2b/arch/arm/boot/dts/overlays/README#L132 # https://github.com/raspberrypi/linux/blob/a1d3defcca200077e1e382fe049ca613d16efd2b/arch/arm/boot/dts/overlays/README#L1323
base-dt-params = { # base-dt-params = {
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-pcie # https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-pcie
pciex1 = { # pciex1 = {
enable = true; # enable = true;
value = "on"; # value = "on";
}; # };
# PCIe Gen 3.0 # PCIe Gen 3.0
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0 # https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0
pciex1_gen = { # pciex1_gen = {
enable = true; # enable = true;
value = "3"; # value = "3";
}; # };
}; # };
}; # };
}; # };
} }

View File

@@ -5,52 +5,54 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
user = "matt"; user = "matt";
password = config.sops.secrets."jallen-nas/admin_password".path; password = config.sops.secrets."desktop/matt_password".path;
kernelBundle = pkgs.linuxAndFirmware.v6_6_31; # kernelBundle = pkgs.linuxAndFirmware.v6_6_31;
in in
{ {
imports = [ imports = [
./boot.nix ./boot.nix
./impermanence.nix ./impermanence.nix
./hardware-configuration.nix
./networking.nix ./networking.nix
./sops.nix ./sops.nix
../default.nix ../default.nix
]; ];
programs.zsh.enable = true;
# Enable nix flakes and nix-command tools # Enable nix flakes and nix-command tools
nix = { # nix = {
settings = { # settings = {
substituters = [ # substituters = [
"https://nixos-raspberrypi.cachix.org" # "https://nixos-raspberrypi.cachix.org"
]; # ];
trusted-public-keys = [ # trusted-public-keys = [
"nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI=" # "nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI="
]; # ];
}; # };
}; # };
# Configure nixpkgs # Configure nixpkgs
nixpkgs = { # nixpkgs = {
overlays = lib.mkAfter [ # overlays = lib.mkAfter [
(self: super: { # (self: super: {
# This is used in (modulesPath + "/hardware/all-firmware.nix") when at least # # This is used in (modulesPath + "/hardware/all-firmware.nix") when at least
# enableRedistributableFirmware is enabled # enableRedistributableFirmware is enabled
# I know no easier way to override this package # I know no easier way to override this package
inherit (kernelBundle) raspberrypiWirelessFirmware; # inherit (kernelBundle) raspberrypiWirelessFirmware;
# Some derivations want to use it as an input, # Some derivations want to use it as an input,
# e.g. raspberrypi-dtbs, omxplayer, sd-image-* modules # e.g. raspberrypi-dtbs, omxplayer, sd-image-* modules
inherit (kernelBundle) raspberrypifw; # inherit (kernelBundle) raspberrypifw;
}) # })
]; # ];
}; # };
system.nixos.tags = let # system.nixos.tags = let
cfg = config.boot.loader.raspberryPi; # cfg = config.boot.loader.raspberryPi;
in [ # in [
"raspberry-pi-${cfg.variant}" # "raspberry-pi-${cfg.variant}"
cfg.bootloader # cfg.bootloader
config.boot.kernelPackages.kernel.version # config.boot.kernelPackages.kernel.version
]; # ];
systemd.services.btattach = { systemd.services.btattach = {
before = [ "bluetooth.service" ]; before = [ "bluetooth.service" ];
@@ -75,7 +77,8 @@ in
mutableUsers = false; mutableUsers = false;
users."${user}" = { users."${user}" = {
isNormalUser = true; isNormalUser = true;
hashedPasswordFile = password; initialPassword = "BogieDudie1";
# hashedPasswordFile = password;
extraGroups = [ extraGroups = [
"wheel" "wheel"
"docker" "docker"

View File

@@ -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.<interface>.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";
}