{ config, lib, pkgs, modulesPath, ... }: { imports = [ (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") ]; # Raspberry Pi 4 platform nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; # Boot configuration - provided by sd-image-aarch64.nix # (grub disabled, generic-extlinux-compatible enabled, U-Boot setup) # Override root filesystem to use tmpfs (from impermanence-tmpfs.nix) # The sd-image module sets root to /dev/disk/by-label/NIXOS_SD (ext4) # but impermanence-tmpfs.nix overrides it to tmpfs # /boot/firmware is automatically configured by sd-image module # Device: /dev/disk/by-label/FIRMWARE (vfat) # Mount /nix from the NIXOS_SD partition # /nix/persist will be a directory on this partition (not a separate mount) fileSystems."/nix" = { device = "/dev/disk/by-label/NIXOS_SD"; fsType = "ext4"; options = [ "noatime" ]; neededForBoot = true; }; # No swap on SD card (wear concern) swapDevices = [ ]; # SD image build configuration sdImage = { compressImage = true; # Populate root with directories populateRootCommands = '' mkdir -p ./files/boot ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot # Create /nix/persist directory structure for impermanence mkdir -p ./files/nix/persist/var/lib/nixos mkdir -p ./files/nix/persist/home/ppetru mkdir -p ./files/nix/persist/etc ''; }; }