diff --git a/host-registry.nix b/host-registry.nix index 83312477..38b2fe2b 100644 --- a/host-registry.nix +++ b/host-registry.nix @@ -22,6 +22,7 @@ rec { "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE9RKlt+mIew5epxHt7Gab44yFOdeD+L/EhhA6Ospzyq"; builders = [ "ssh://client@172.22.99.110" ]; wol = true; + raspberryPi = 3; }; samba = { }; storage-ng.publicKey = @@ -119,6 +120,7 @@ rec { }; radiobert.ip4 = "172.22.99.117"; + radiobert.rasbperryPi = 4; }; hqGlobal = builtins.attrNames hosts; diff --git a/lib/default.nix b/lib/default.nix index f637ecb6..d083f3d1 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -2,7 +2,7 @@ # That includes physical servers, VMs, containers, and personal machines. # -{ inputs, config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: let hqPrefix64 = "fd23:42:c3d2:523"; @@ -31,8 +31,8 @@ in { ./users ./stats.nix ./openwebrx.nix - ] - ++ lib.optional config.boot.loader.raspberryPi.enable "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"; + ./raspberrypi.nix + ]; options.c3d2 = with lib; with lib.types; { diff --git a/lib/raspberrypi.nix b/lib/raspberrypi.nix new file mode 100644 index 00000000..16d53269 --- /dev/null +++ b/lib/raspberrypi.nix @@ -0,0 +1,21 @@ +{ inputs, hostRegistry, options, lib, ... }: + +let + enabled = hostRegistry.hosts.${config.networking.hostName} ? raspberryPi && + hostRegistry.hosts.${config.networking.hostName}.raspberryPi != null; +in +{ + imports = lib.optionals enabled [ + "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + ]; + config = lib.mkIf enabled { + sdImage = { + compressImage = false; + imageBaseName = config.networking.hostName; + firmwareSize = 512; + }; + # Don't build ZFS for aarch64 (broken?) + boot.supportedFilesystems = lib.mkForce [ "vfat" "ext4" ]; + boot.zfs.enableUnstable = true; + }; +}