|
@@ -0,0 +1,43 @@
|
|
|
+{ config, pkgs, lib, ... }:
|
|
|
+
|
|
|
+{
|
|
|
+ imports = [ <nixpkgs/nixos/modules/installer/sd-card/sd-image.nix> ];
|
|
|
+
|
|
|
+ # Define the image name
|
|
|
+ sdImage.imageBaseName = "nixos-rpi2";
|
|
|
+ sdImage.compressImage = false;
|
|
|
+
|
|
|
+ # Required: Set populateRootCommands
|
|
|
+ sdImage.populateRootCommands = ''
|
|
|
+ mkdir -p ./files
|
|
|
+ echo "NixOS for Raspberry Pi 2" > ./files/welcome.txt
|
|
|
+ '';
|
|
|
+ sdImage.populateFirmwareCommands = "";
|
|
|
+
|
|
|
+ # Bootloader: Use U-Boot for Raspberry Pi 2
|
|
|
+ boot.loader.generic-extlinux-compatible.enable = true;
|
|
|
+ hardware.deviceTree.enable = true;
|
|
|
+ hardware.deviceTree.name = "bcm2836-rpi-2-b.dtb"; # Correct DTB for RPi2
|
|
|
+
|
|
|
+ # Disable GRUB (not used on Raspberry Pi)
|
|
|
+ boot.loader.grub.enable = false;
|
|
|
+
|
|
|
+ # Networking
|
|
|
+ networking.hostName = "nixos-rpi2";
|
|
|
+ networking.wireless.enable = false; # Enable this if using WiFi
|
|
|
+ networking.interfaces.eth0.useDHCP = true;
|
|
|
+
|
|
|
+ # Enable SSH
|
|
|
+ services.openssh.enable = true;
|
|
|
+
|
|
|
+ # User setup
|
|
|
+ users.users.nixos = {
|
|
|
+ isNormalUser = true;
|
|
|
+ initialPassword = "nixos";
|
|
|
+ extraGroups = [ "wheel" ];
|
|
|
+ };
|
|
|
+ users.groups.nixos = {};
|
|
|
+
|
|
|
+ # Set system version (avoid warnings)
|
|
|
+ system.stateVersion = "25.05";
|
|
|
+}
|