Raspberry Pi: Difference between revisions

From NixOS Wiki
imported>Fadenb
m Syntax highlighting
imported>Makefu
m Makefu moved page Raspberry Pi 2 to Raspberry Pi
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Also consult the page [[NixOS_on_ARM]]
== Status ==
The code in master as of June 2015 should be able to prepare a bootable NixOS for Raspberry PI 2.


 
#REDIRECT [[NixOS_on_ARM/Raspberry_Pi]]
There are still some drawbacks:
* NixOS does not provide a /boot/config.txt (the FAT32 partition).
 
Making NixOS work in the Raspberry PI 2 is mainly the result of the recent work of ambro718, Dezgeg and viric (#nixos@irc.freenode.net).
 
== Download ==
If you want to test, you can flash this 4GB SD image (DOS partition table + fat32 + ext4 rootfs): [magnet:?xt=urn:btih:0def3f6acb3bceddb22cb24098f58e40e2853ec2&dn=rpi2-nixos-4b09501f2-img.xz&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80magnet link (viric)]
{{notice|text=nixpkgs contain code to [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix build the sd-image for aarch64] but this is not currently built by hydra. Cross-building is unavailable for this, you will need another AARCH64 machine}}
 
Then you should be able to nixos-rebuild any configuration.nix changes.
 
The image is the result of a "nixos-install" alone. No root password has been set, and it does not include a nixpkgs checkout or channel.
 
In fact I (viric) created the FS into a NBD, not a real SD, to create this image.
 
== Related Details ==
For reference, below is the content of /etc/nixos/configuration.nix extracted from the image:
<syntaxhighlight lang="nix">
{pkgs, config, ...}:
 
{
  boot.consoleLogLevel = 7;
  boot.loader.grub.enable = false;
  boot.loader.generationsDir.enable = false;
  boot.loader.raspberryPi.enable = true;
  boot.loader.raspberryPi.version = 2;
  boot.extraTTYs = [ "ttyAMA0" ];
  boot.kernelPackages = pkgs.linuxPackages_rpi;
  boot.kernelParams = [
    #"coherent_pool=6M"
    #"smsc95xx.turbo_mode=N"
    "dwc_otg.lpm_enable=0"
    "console=ttyAMA0,115200"
    "root=/dev/mmcblk0p2"
    "rootfstype=ext4"
    "rootwait"
    #"console=tty1"
    "elevator=deadline"
  ];
 
  # cpufrequtils doesn't build on ARM
  powerManagement.enable = false;
 
  fileSystems = {
    "/boot" = { device = "/dev/mmcblk0p1"; fsType = "vfat"; };
    "/" = { device = "/dev/mmcblk0p2"; fsType = "ext4"; };
  };
 
  networking.hostName = "pi2";
  services.xserver.enable = false;
  services.openssh = {
    enable = true;
    # permitRootLogin = "yes";
    passwordAuthentication = false;
  };
 
  services.nixosManual.enable = false;
 
  nixpkgs.config = {
    platform = pkgs.platforms.raspberrypi2;
    allowUnfree = true;
  };
 
  nix.buildCores = 4;
  nix.binaryCaches = [ ];
 
  environment.systemPackages = [
    pkgs.ts
    pkgs.vim
    pkgs.git
    pkgs.pigz
    pkgs.cjdns
    pkgs.pv
    pkgs.lzop
    pkgs.nbd
  ];
 
  security.sudo = {
    enable = true;
    wheelNeedsPassword = false;
  };
}
</syntaxhighlight>

Latest revision as of 19:42, 9 April 2019