Add a nixos config for the raspberry pi 3b.
This commit is contained in:
27
nix/raspberry_pi/flake.lock
generated
Normal file
27
nix/raspberry_pi/flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1780749050,
|
||||||
|
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
46
nix/raspberry_pi/flake.nix
Normal file
46
nix/raspberry_pi/flake.nix
Normal 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;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user