NixOS on ARM/Raspberry Pi: Difference between revisions

imported>Drupol
No edit summary
imported>Rogarb
No edit summary
Line 117: Line 117:


=== Raspberry Pi (1) ===
=== Raspberry Pi (1) ===
{{Expansion|It is unclear where to fetch this image or how to build it yourself.}}
The ARMv6 image boots out-of-the-box. The instructions to build an image for ARMv6 are adapted from [[NixOS_on_ARM#Build_your_own_image_natively|here]].
The ARMv6 image boots out-of-the-box.
 
First, create your own configuration in sd-image.nix (adding cross-compiling information if needed):
<syntaxHighlight lang=nix>
# save as sd-image.nix somewhere
{ ... }: {
  # uncomment for enabling cross compilation
  #nixpkgs.crossSystem.system = "armv6l-linux";
  imports = [
    # This contains the default definition for the sdcard image build
    <nixpkgs/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix>
  ];
  # put your own configuration here, for example ssh keys:
  #users.users.root.openssh.authorizedKeys.keys = [
  #  "ssh-ed25519 AAAAC3NzaC1lZDI1.... username@tld"
  #];
}
</syntaxHighlight>
 
Then build the image:
 
<syntaxHighlight lang=nix>
$ nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./sd-image.nix
</syntaxHighlight>


=== Raspberry Pi 2 ===
=== Raspberry Pi 2 ===