diff --git a/bin/ABOUTME.md b/bin/ABOUTME.md index 4292306..d75ecf1 100644 --- a/bin/ABOUTME.md +++ b/bin/ABOUTME.md @@ -24,7 +24,7 @@ bin/ | `skyg remote switch ` | Deploy to a remote host | | `skyg hm switch` | Apply Home Manager config | | `skyg update [input]` | Update flake inputs | -| `skyg build-iso` | Build bootable ISO | +| `skyg build-image iso|pi1|pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) | | `skyg openwrt` | Deploy OpenWrt config | | `skyg rollback` | Roll back to previous generation | | `skyg profiles` | List valid local/remote profiles | diff --git a/bin/lib/cmds.nu b/bin/lib/cmds.nu index 4ed6066..fb3fa97 100644 --- a/bin/lib/cmds.nu +++ b/bin/lib/cmds.nu @@ -308,18 +308,19 @@ export def "skyg openwrt" [ } } -# Build ISO image -export def "skyg build-iso" [] { +# Build a bootable image: ISO, or Pi SD card image (fully-baked, no on-device rebuild) +export def "skyg build-image" [ + target: string@image-targets +] { cd $REPO_ROOT - nix build .#nixosConfigurations.iso.config.system.build.isoImage - ls -l result/iso -} - -# Build hl-pi1 SD card image (fully-baked, no on-device rebuild needed) -export def "skyg build-pi-sd-image" [] { - cd $REPO_ROOT - nix build .#nixosConfigurations.hl-pi1-sd-image.config.system.build.sdImage - ls -l result/sd-image + let spec = (match $target { + "iso" => { config: "iso", out: "iso", attr: "isoImage" } + "pi1" => { config: "hl-pi1-sd-image", out: "sd-image", attr: "sdImage" } + "pi2" => { config: "hl-pi2-sd-image", out: "sd-image", attr: "sdImage" } + _ => { error make { msg: $"Unknown image target '($target)'. Expected: iso, pi1, pi2" } } + }) + nix build $".#nixosConfigurations.($spec.config).config.system.build.($spec.attr)" + ls -l $"result/($spec.out)" } # Home Manager operations diff --git a/bin/lib/types.nu b/bin/lib/types.nu index 2e474a6..b1fcdc5 100644 --- a/bin/lib/types.nu +++ b/bin/lib/types.nu @@ -8,6 +8,10 @@ export def remote-cmds [] { ["test", "dry-activate", "run", "switch", "build", "boot"] } +export def image-targets [] { + ["iso", "pi1", "pi2"] +} + export def secret-names [] { cd $REPO_ROOT diff --git a/flake.nix b/flake.nix index 7ef572b..97e2e99 100644 --- a/flake.nix +++ b/flake.nix @@ -296,6 +296,22 @@ ./hosts/hl-pi1.nix ]; }; + hl-pi2 = lib.makeNixOs { + system = "aarch64-linux"; + hostName = "hl-pi2"; + configuration = [ + ./hosts/hl-pi2.nix + ./hosts/hl-pi2.hardware-configuration.nix + ]; + }; + # Fully-baked bootable SD card image for hl-pi2 — builds the whole + # target system off-Pi so flashing it needs no on-device rebuild. + hl-pi2-sd-image = lib.makeSdImage { + hostName = "hl-pi2"; + configuration = [ + ./hosts/hl-pi2.nix + ]; + }; hl-terra1 = lib.makeNixOs { hostName = "hl-terra1"; configuration = [ diff --git a/hosts/ABOUTME.md b/hosts/ABOUTME.md index 48be142..5b23c40 100644 --- a/hosts/ABOUTME.md +++ b/hosts/ABOUTME.md @@ -29,6 +29,7 @@ hosts/ | `hl-minipc2.nix` | hl-minipc2 | Container/media server | | `hl-minipc3.nix` | hl-minipc3 | K3s worker node | | `hl-pi1.nix` | hl-pi1 | Raspberry Pi CM4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi1-sd-image` nixosConfiguration (`skyg build-pi-sd-image`) | +| `hl-pi2.nix` | hl-pi2 | Raspberry Pi 4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi2-sd-image` nixosConfiguration | | `hl-terra1.nix` | hl-terra1 | NFS storage + Jellyfin backup | | `iso.nix` | iso | Bootable NixOS installer image | diff --git a/hosts/fwbook.nix b/hosts/fwbook.nix index 86506bd..ab57fd1 100644 --- a/hosts/fwbook.nix +++ b/hosts/fwbook.nix @@ -37,6 +37,7 @@ in desktop = { enable = true; crypto.enable = true; + printers.enable = true; fixes = { airpod-bluetooth.enabled = true; }; diff --git a/hosts/hl-pi1.nix b/hosts/hl-pi1.nix index b713d44..1a73386 100644 --- a/hosts/hl-pi1.nix +++ b/hosts/hl-pi1.nix @@ -1,7 +1,24 @@ { lib, pkgs, determinate, ... }: { - skyg.user.enable = true; - skyg.nixos.common.ssh-server.enable = true; + skyg = { + user.enable = true; + nixos = { + common.ssh-server.enable = true; + common.hardware = { + sound.enable = true; + pipewire.enable = true; + }; + desktop = { + enable = true; + tiler = { + enable = true; + hyprland.enable = true; + noctalia.enable = true; + quickshell.enable = true; + }; + }; + }; + }; # Determinate Nix builds its own Nix from source (no aarch64-linux binary # cache hit for us), and its test suite fails under QEMU emulation because diff --git a/hosts/hl-pi2.hardware-configuration.nix b/hosts/hl-pi2.hardware-configuration.nix new file mode 100644 index 0000000..8b7cf0a --- /dev/null +++ b/hosts/hl-pi2.hardware-configuration.nix @@ -0,0 +1,25 @@ +{ lib, modulesPath, ... }: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-label/NIXOS_SD"; + fsType = "ext4"; + }; + + fileSystems."/boot/firmware" = { + device = "/dev/disk/by-label/FIRMWARE"; + fsType = "vfat"; + options = [ "nofail" "noauto" ]; + }; + + swapDevices = [ ]; + + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} diff --git a/hosts/hl-pi2.nix b/hosts/hl-pi2.nix new file mode 100644 index 0000000..2df4492 --- /dev/null +++ b/hosts/hl-pi2.nix @@ -0,0 +1,43 @@ +{ lib, pkgs, determinate, ... }: +{ + skyg = { + user.enable = true; + nixos = { + common.ssh-server.enable = true; + common.hardware = { + sound.enable = true; + pipewire.enable = true; + }; + desktop = { + enable = true; + tiler = { + enable = true; + hyprland.enable = true; + noctalia.enable = false; + quickshell.enable = true; + }; + }; + }; + }; + + # Determinate Nix builds its own Nix from source (no aarch64-linux binary + # cache hit for us), and its test suite fails under QEMU emulation because + # nested seccomp doesn't work through the translation layer. Skip the test + # suite for this build only — Determinate Nix itself stays enabled. + nix.package = lib.mkForce ( + determinate.inputs.nix.packages.${pkgs.stdenv.system}.default.overrideAttrs (old: { + doCheck = false; + }) + ); + + # Pi 4 boots via Pi firmware + U-Boot reading extlinux.conf (set up by the + # official NixOS SD image) — not systemd-boot/EFI like the other hosts. + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + + # Serial console, useful for headless debugging over UART. + boot.kernelParams = [ "console=ttyS0,115200n8" "console=tty0" ]; + + # SD image has no swap partition; use compressed RAM swap instead. + zramSwap.enable = true; +} diff --git a/modules/nixos/desktop/printers.nix b/modules/nixos/desktop/printers.nix index b2f5d89..c874725 100644 --- a/modules/nixos/desktop/printers.nix +++ b/modules/nixos/desktop/printers.nix @@ -1,6 +1,11 @@ { pkgs, lib, config, ... }: { - config = lib.mkIf config.skyg.nixos.desktop.enable { + options = { + skyg.nixos.desktop.printers = { + enable = lib.mkEnableOption "Enable Printers"; + }; + }; + config = lib.mkIf config.skyg.nixos.desktop.printers.enable { services.flatpak.overrides = { "org.chromium.Chromium" = { diff --git a/secrets/glmain.json.age b/secrets/glmain.json.age index 14e23bd..329d0f2 100644 Binary files a/secrets/glmain.json.age and b/secrets/glmain.json.age differ