NixOS on ARM/Raspberry Pi 5: Difference between revisions
Line 83: | Line 83: | ||
=== Step 2: Installing NixOS === | === Step 2: Installing NixOS === | ||
Once you're running an installer image, you can | Once you're running an installer image, you can create a flake referencing the repository. For example:{{File|filename=flake.nix|language=nix|contents={ | ||
description = "Example Raspberry Pi 5 configuration flake"; | |||
inputs = { | |||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; | |||
nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi"; | |||
}; | |||
nixConfig = { | |||
extra-substituters = [ | |||
"https://nixos-raspberrypi.cachix.org" | |||
]; | |||
extra-trusted-public-keys = [ | |||
"nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI=" | |||
]; | |||
}; | |||
outputs = { self, nixpkgs, nixos-raspberrypi }@inputs: | |||
{ | |||
nixosConfigurations = { | |||
yourHostname = nixos-raspberrypi.lib.nixosSystem { | |||
specialArgs = inputs; | |||
modules = [ | |||
({...}: { | |||
imports = with nixos-raspberrypi.nixosModules; [ | |||
raspberry-pi-5.base | |||
raspberry-pi-5.bluetooth | |||
]; | |||
}) | |||
({ ... }: { | |||
networking.hostName = "yourHostName"; | |||
users.users.yourUserName = { | |||
initialPassword = "yourInitialPassword"; | |||
isNormalUser = true; | |||
extraGroups = [ | |||
"wheel" | |||
]; | |||
}; | |||
services.openssh.enable = true; | |||
}) | |||
({ ... }: { | |||
fileSystems = { | |||
"/boot/firmware" = { | |||
device = "/dev/disk/by-uuid/2175-794E"; | |||
fsType = "vfat"; | |||
options = [ | |||
"noatime" | |||
"noauto" | |||
"x-systemd.automount" | |||
"x-systemd.idle-timeout=1min" | |||
]; | |||
}; | |||
"/" = { | |||
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; | |||
fsType = "ext4"; | |||
options = [ "noatime" ]; | |||
}; | |||
}; | |||
}) | |||
]; | |||
}; | |||
}; | |||
}; | |||
}}}Finally, simply <code>nixos-rebuild switch --flake .#yourHostname</code> the flake. | |||
== Other Solutions == | == Other Solutions == |