Files
machine_setup/nix/raspberry_pi/flake.nix
2026-07-31 21:47:01 -04:00

47 lines
1.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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;
})
];
};
};
}