diff --git a/nix/raspberry_pi/flake.lock b/nix/raspberry_pi/flake.lock new file mode 100644 index 0000000..14e3cb3 --- /dev/null +++ b/nix/raspberry_pi/flake.lock @@ -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 +} diff --git a/nix/raspberry_pi/flake.nix b/nix/raspberry_pi/flake.nix new file mode 100644 index 0000000..17a6f3b --- /dev/null +++ b/nix/raspberry_pi/flake.nix @@ -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; + }) + ]; + }; + }; +}