From 22ab5aa5cf66a6cb83ad5d93d313cf94f3eafdcc Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Tue, 15 Apr 2025 23:39:10 +0200 Subject: [PATCH] :sparkles: [pi4] Split module config --- hosts/pi4/boot.nix | 16 ++++++++++++ hosts/pi4/default.nix | 42 +++++------------------------- hosts/pi4/hardware.nix | 12 +++++++++ hosts/pi4/home-manager/default.nix | 4 ++- hosts/pi4/networking.nix | 10 +++++++ hosts/pi4/security.nix | 7 +++++ justfile | 6 +++++ 7 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 hosts/pi4/boot.nix create mode 100644 hosts/pi4/hardware.nix create mode 100644 hosts/pi4/networking.nix create mode 100644 hosts/pi4/security.nix diff --git a/hosts/pi4/boot.nix b/hosts/pi4/boot.nix new file mode 100644 index 0000000..27449d5 --- /dev/null +++ b/hosts/pi4/boot.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: + +{ + boot = { + kernelPackages = pkgs.linuxKernel.packages.linux_rpi4; + initrd.availableKernelModules = [ + "xhci_pci" + "usbhid" + "usb_storage" + ]; + loader = { + grub.enable = false; + generic-extlinux-compatible.enable = true; + }; + }; +} diff --git a/hosts/pi4/default.nix b/hosts/pi4/default.nix index 0427367..d125052 100644 --- a/hosts/pi4/default.nix +++ b/hosts/pi4/default.nix @@ -1,45 +1,15 @@ { - pkgs, systemConfig, ... }: { - boot = { - kernelPackages = pkgs.linuxKernel.packages.linux_rpi4; - initrd.availableKernelModules = [ - "xhci_pci" - "usbhid" - "usb_storage" - ]; - loader = { - grub.enable = false; - generic-extlinux-compatible.enable = true; - }; - }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-label/NIXOS_SD"; - fsType = "ext4"; - options = [ "noatime" ]; - }; - }; - - hardware.enableRedistributableFirmware = true; - - networking = { - hostName = systemConfig.hostName; - networkmanager.enable = true; - }; - - services.openssh.enable = true; - - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - services.pcscd.enable = true; + imports = [ + ./boot.nix + ./hardware.nix + ./networking.nix + ./security.nix + ]; system.stateVersion = systemConfig.version; diff --git a/hosts/pi4/hardware.nix b/hosts/pi4/hardware.nix new file mode 100644 index 0000000..5deee3f --- /dev/null +++ b/hosts/pi4/hardware.nix @@ -0,0 +1,12 @@ +{ + fileSystems = { + "/" = { + device = "/dev/disk/by-label/NIXOS_SD"; + fsType = "ext4"; + options = [ "noatime" ]; + }; + # TODO mount ext hdd + }; + + hardware.enableRedistributableFirmware = true; +} diff --git a/hosts/pi4/home-manager/default.nix b/hosts/pi4/home-manager/default.nix index 3ba4a47..8c0f5a2 100644 --- a/hosts/pi4/home-manager/default.nix +++ b/hosts/pi4/home-manager/default.nix @@ -1,5 +1,6 @@ { lib, + inputs, outputs, systemConfig, ... @@ -7,9 +8,10 @@ { imports = [ + inputs.catppuccin.homeModules.catppuccin (lib.custom.relativeToRoot "shared/home-manager/btop.nix") (lib.custom.relativeToRoot "shared/home-manager/development/git.nix") - (lib.custom.relativeToRoot "shared/home-manager/development/nixvim.nix") + (lib.custom.relativeToRoot "shared/home-manager/development/nixvim") (lib.custom.relativeToRoot "shared/home-manager/fastfetch.nix") (lib.custom.relativeToRoot "shared/home-manager/fish.nix") (lib.custom.relativeToRoot "shared/home-manager/gpg.nix") diff --git a/hosts/pi4/networking.nix b/hosts/pi4/networking.nix new file mode 100644 index 0000000..abc678c --- /dev/null +++ b/hosts/pi4/networking.nix @@ -0,0 +1,10 @@ +{ systemConfig, ... }: + +{ + networking = { + hostName = systemConfig.hostName; + networkmanager.enable = true; + }; + + services.openssh.enable = true; +} diff --git a/hosts/pi4/security.nix b/hosts/pi4/security.nix new file mode 100644 index 0000000..78a5300 --- /dev/null +++ b/hosts/pi4/security.nix @@ -0,0 +1,7 @@ +{ + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + services.pcscd.enable = true; +} diff --git a/justfile b/justfile index 01ee804..0863203 100644 --- a/justfile +++ b/justfile @@ -4,6 +4,12 @@ default: fmt: treefmt --on-unmatched info +build HOST: + git add . + just fmt + nh os build . -H {{HOST}} + + test *FLAGS: git add . just fmt