Add a nixos config for the raspberry pi 3b.

This commit is contained in:
Tom Alexander
2026-07-31 21:00:40 -04:00
parent 649e4033fd
commit 416f3bd789
2 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
# nix build .#nixosConfigurations.rpi3.config.system.build.sdImage
{
description = "Minimal NixOS Raspberry Pi 3B Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs, ... }@inputs:
{
nixosConfigurations.rpi3 = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
# Include the official SD card image builder module
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
({ lib, pkgs, ... }: {
# System basic configuration
system.stateVersion = "24.11";
networking.hostName = "nixos-pi3";
# Enable necessary hardware firmware
hardware.enableRedistributableFirmware = true;
# Create a default user so you can log in
users.users.root.initialHashedPassword = ""; # Or set a password/SSH key
users.users.nixos = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo
initialPassword = "changeme";
};
# Enable SSH for remote access on first boot
services.openssh = {
enable = true;
settings.PermitRootLogin = "yes"; # Change or use keys for security
};
# Expand root partition automatically on first boot
# services.growpart.enable = true;
})
];
};
};
}