From d979a126aba07dd9e9a3b818ec0e38da06bd4513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Sun, 15 May 2022 15:45:00 +0200 Subject: [PATCH] feat(home-server): update hardware & boot configuration To commodate switch to Tow-Boot & new partitioning using scripts/setup-partitions. --- hardware/rpi4.nix | 44 ++++++++++++++++++++++++++------------------ rpi4.nix | 24 +++++++++--------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/hardware/rpi4.nix b/hardware/rpi4.nix index 46325c4..6d43328 100644 --- a/hardware/rpi4.nix +++ b/hardware/rpi4.nix @@ -1,38 +1,46 @@ { config, lib, pkgs, modulesPath, ... }: { - boot.initrd.availableKernelModules = [ "usbhid" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - boot.initrd.luks.devices."enc-media".device = - "/dev/disk/by-uuid/47158a41-995a-45d5-b7e1-1dc6e1868be7"; - - fileSystems."/boot" = { - device = "/dev/disk/by-label/NIXOS_BOOT"; - fsType = "vfat"; - }; - fileSystems."/" = { - device = "/dev/disk/by-label/NIXOS_SD"; - fsType = "ext4"; - }; - - fileSystems."/media" = { - device = "/dev/disk/by-uuid/2441d724-7f8e-4bbb-a50f-9074f3d0d3f1"; + device = "/dev/disk/by-uuid/7bb1e67d-8c6f-4ace-b8e7-b09cdfd82cab"; fsType = "btrfs"; options = [ "subvol=@" "compress-force=zstd" "noatime" ]; }; - fileSystems."/media/.snapshots" = { - device = "/dev/disk/by-uuid/2441d724-7f8e-4bbb-a50f-9074f3d0d3f1"; + boot.initrd.luks.devices."enc".device = + "/dev/disk/by-uuid/d163376b-a038-4196-8ef5-7c7fb5508f0c"; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/7bb1e67d-8c6f-4ace-b8e7-b09cdfd82cab"; + fsType = "btrfs"; + options = [ "subvol=@home" "compress-force=zstd" "noatime" ]; + }; + + fileSystems."/.swap" = { + device = "/dev/disk/by-uuid/7bb1e67d-8c6f-4ace-b8e7-b09cdfd82cab"; + fsType = "btrfs"; + options = [ "subvol=@swap" "nodatacow" "noatime" ]; + neededForBoot = true; + }; + + fileSystems."/.snapshots" = { + device = "/dev/disk/by-uuid/7bb1e67d-8c6f-4ace-b8e7-b09cdfd82cab"; fsType = "btrfs"; options = [ "subvol=@snapshots" "compress-force=zstd" "noatime" ]; }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/9ECA-C9A7"; + fsType = "vfat"; + }; + swapDevices = [{ - device = "/swapfile"; + device = "/.swap/swapfile"; size = 4096; }]; diff --git a/rpi4.nix b/rpi4.nix index 2122f05..61a1cb9 100644 --- a/rpi4.nix +++ b/rpi4.nix @@ -37,19 +37,15 @@ in with builtins; { nixpkgs.config.allowUnfree = true; - # rpi4 base config + boot.loader.systemd-boot.enable = true; boot.loader.generic-extlinux-compatible.enable = false; - boot.loader.raspberryPi.enable = true; - boot.loader.raspberryPi.version = 4; - # boot.loader.raspberryPi.uboot.enable = true; - boot.loader.raspberryPi.firmwareConfig = '' - gpu_mem=320 - hdmi_group=1 - hdmi_mode=97 - hdmi_enable_4kp60=1 - disable_overscan=1 - ''; - boot.kernelParams = [ "console=ttyAMA0,115200" "console=tty1" ]; + # boot.loader.efi.canTouchEfiVariables = true; + boot.tmpOnTmpfs = true; + + # rpi4 base config + boot.kernelPackages = pkgs.linuxPackages_rpi4; + boot.kernelParams = + [ "8250.nr_uarts=1" "console=ttyAMA0,115200" "console=tty1" "cma=128" ]; # improve memory performance zramSwap.enable = true; @@ -109,9 +105,7 @@ in with builtins; { enable = true; ssh = { enable = true; - # requires support for initrd secrets (might work w/ uboot when it's supported) - # hostKeys = map (f: f.path) hostKeys; - hostKeys = [ ./host_key ]; + hostKeys = map (f: f.path) hostKeys; authorizedKeys = config.users.users.felschr.openssh.authorizedKeys.keys; }; };