diff --git a/flake.nix b/flake.nix index 7a9d6a8..b1646f6 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,7 @@ url = "github:Nixos/nixpkgs?rev=8fcb6f1c4948305af52d19f887b89011ee2c080d"; }; font-patcher.url = "github:Doloro1978/nix-nerd-fonts-patcher"; + inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; outputs = inputs@{ @@ -154,6 +155,7 @@ }; inherit (utils) mkHost; configurations = [ + # Desktops (mkHost { hardware = "doloro"; host = "doloro"; @@ -173,6 +175,16 @@ rocmSupport = false; }; }) + # Servers + (mkHost { + hardware = "rpi-5"; + host = "rpi-5"; + system = "aarch64-linux"; + stateVersion = "25.11"; + nixpkgsConfig = { + rocmSupport = false; + }; + }) ]; in (utils.deepMerge configurations); diff --git a/hardwares/rpi-5/disks.nix b/hardwares/rpi-5/disks.nix new file mode 100644 index 0000000..685ab75 --- /dev/null +++ b/hardwares/rpi-5/disks.nix @@ -0,0 +1,64 @@ +{ inputs, ... }: +{ + imports = [ inputs.disko.nixosModules.disko ]; + disko.devices = { + disk = { + main = { + device = "/dev/mmcblk0"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + ESP = { + name = "ESP"; + priority = 1; + size = "4G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + plainSwap = { + size = "8G"; + content = { + type = "swap"; + discardPolicy = "both"; # Both "once" and page discard policies + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "@" = { + mountpoint = "/"; + }; + # Subvolume name is the same as the mountpoint + "@home" = { + mountpoint = "/home"; + }; + # Parent is not mounted so the mountpoint must be set + "@nix" = { + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hardwares/rpi-5/home.nix b/hardwares/rpi-5/home.nix new file mode 100644 index 0000000..6462967 --- /dev/null +++ b/hardwares/rpi-5/home.nix @@ -0,0 +1 @@ +{...}: {} diff --git a/hardwares/rpi-5/nixos.nix b/hardwares/rpi-5/nixos.nix new file mode 100644 index 0000000..bbf323f --- /dev/null +++ b/hardwares/rpi-5/nixos.nix @@ -0,0 +1,7 @@ +{ lib, inputs, ... }: +{ + imports = [ + ./disks.nix + inputs.nixos-hardware.nixosModules.raspberry-pi-4 + ]; +}