Installing NixOS on a Raspberry Pi 3

965 views
Skip to first unread message

Gareth Charnock

unread,
Sep 10, 2017, 12:22:01 PM9/10/17
to nix-devel
I've been giving this a try, but I'm at a total loss. There's lots of bits and hints that its possible, and may even work quite well, but they seem to be from different eras and are generally incomplete. There was apparently a wiki at one point, but that vanished meaning that links from all over the internet to it are broken; that doesn't help either.

I've been following these instructions as suggested by this reddit comment.

So far, I've:
 * Managed to install nix itself. I can use `nix-env` and friends. I've used these tools to build GNU hello and nix-repl so they seem to be working.
 * I coped /etc/nixos/configuration.nix and tweeked the partitions as they didn't quite match.

I get stuck here

```
export NIXOS_CONFIG=/etc/nixos/configuration.nix
nix
-env -i \
 
-A config.system.build.nixos-install \
 
-A config.system.build.nixos-option \
 
-A config.system.build.nixos-generate-config \
 
-j 4 --cores 4 -f "nixpkgs/nixos" # Set 4 to the cores you have.

```

However, it complains about infinite recursion (output on pastbin as it's quite large). I've tried a few values of the -f argument including omitting it and pointing it at a checked out nix packages repo. Nothing really seems to work. I think what this step is trying to accomplish is to building nixos-install and co. I can't find any nixos-install on any of the package searches (though there seem to be plenty of other invisible packages).

Also, I've managed stumble on these:


Which seem very suggestive. Would I be better off trying to work out how to nix-build them somehow? The command in the comment doesn't seem to work (working directory is the root of the nixpkgs git repo).

pi@raspberrypi:~/nixpkgs $ nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix -A config.system.build.sdImage
error: attribute ‘sdImage’ in selection path ‘config.system.build.sdImage’ not found

John Ramsden

unread,
Sep 10, 2017, 4:55:43 PM9/10/17
to nix-...@googlegroups.com
Just so you know, the wiki has been reposted at nixos.wiki, and unless I'm mistaken, the old wiki has been migrated there. 

search on the wiki turned up hits on the Raspberry Pi 2 as well as NixOS on ARM. I don't know if either of those are useful to you but I figured it would be worth informing you of the new wiki at least.

--
  John Ramsden
--
You received this message because you are subscribed to the Google Groups "nix-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nix-devel+...@googlegroups.com.
To post to this group, send email to nix-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

辻隆太郎

unread,
Sep 10, 2017, 6:22:16 PM9/10/17
to nix-devel
I installed according to the following page.

But, since uboot error occurred at boot time, we could not proceed with setting.so I will try again at 17.09.

2017年9月11日月曜日 1時22分01秒 UTC+9 Gareth Charnock:

Tuomas Tynkkynen

unread,
Sep 16, 2017, 2:12:41 PM9/16/17
to nix-devel
Hi,

I have updated the documentation on https://nixos.wiki/wiki/NixOS_on_ARM. Hopefully it works, I had to make a last-minute change (adding cma=32M) for the virtual console to work. 

辻隆太郎

unread,
Sep 18, 2017, 2:36:10 AM9/18/17
to nix-devel
Thank. I will try!

2017年9月17日日曜日 3時12分41秒 UTC+9 Tuomas Tynkkynen:

Gareth Charnock

unread,
Sep 18, 2017, 8:11:55 AM9/18/17
to nix-devel
Thanks. I will look at that soon (I've taken the plunge and installed NixOS on my laptop and I'm going to spend a few weeks getting used to the philosophy before making another attempt. I think that'll be more sensible than trying to install an unfamiliar OS on unfamiliar hardware--walk before you can run).

Alexander Vorobiev

unread,
Oct 5, 2017, 12:23:10 AM10/5/17
to nix-devel
The aarch64 image worked for me. Here are the remaining issues:

1. I requested xserver in configuration.nix and at some point it tries to compile xf86-video-intel-2017-04-18 and fails so I am unable to have a GUI.
2. It only shows eth0 interface, no wifi.
3. How do I connect bluetooth devices?

Thanks,
Alex

Tuomas Tynkkynen

unread,
Oct 5, 2017, 10:37:45 AM10/5/17
to nix-devel
Hi,


On Thursday, October 5, 2017 at 7:23:10 AM UTC+3, Alexander Vorobiev wrote:
The aarch64 image worked for me. Here are the remaining issues:

1. I requested xserver in configuration.nix and at some point it tries to compile xf86-video-intel-2017-04-18 and fails so I am unable to have a GUI.

This can be avoided with `services.xserver.videoDrivers = [ "modesetting" ];`. I suppose I could switch the default of that option on non-x86 to just that.
 
2. It only shows eth0 interface, no wifi.
3. How do I connect bluetooth devices?

It's still a bit unclear to me how well the WiFi/BT combo chip on the RPi3 is supported in the mainline kernel. The Gentoo wiki claims that only the firmware files (brcmfmac43430-sdio.txt and brcmfmac43430-sdio.bin) need to be packaged somewhere, but I was under the impression there are still some stability issues with the mainline wifi drivers.

Alexander Vorobiev

unread,
Oct 5, 2017, 6:25:13 PM10/5/17
to nix-devel
Thanks for the advice! I will try the setting for xserver tonight.

A few other things I discovered I cannot install because of the non-x86 platform:

1. firefox needs to bootstrap something in rust whose nix expression throws an error if it is not on x86
2. ghc
3. kodi

All of the above allegedly work in say raspbian so they should theoretically be fixable by their nix expressions...

Thanks,
Alex

Linus

unread,
Oct 6, 2017, 2:16:58 AM10/6/17
to Alexander Vorobiev, nix-devel
Rust is outdated and doesn't have very good tooling in nixpkgs currently. For rust itself you'll want to use the nixpkgs-mozilla overlay. To just get Firefox, the firefox-bin package (which downloads and patches the official binary distribution) is probably your best bet for now, unless you want to fix rust yourself (I tried doing this for armv7 myself a while back, but the standard library wouldn't compile).

Tuomas Tynkkynen

unread,
Oct 6, 2017, 9:37:03 AM10/6/17
to nix-devel
On Friday, October 6, 2017 at 9:16:58 AM UTC+3, Linus wrote:
Rust is outdated and doesn't have very good tooling in nixpkgs currently. For rust itself you'll want to use the nixpkgs-mozilla overlay. To just get Firefox, the firefox-bin package (which downloads and patches the official binary distribution) is probably your best bet for now, unless you want to fix rust yourself (I tried doing this for armv7 myself a while back, but the standard library wouldn't compile).

Well firefox-bin isn't going to work either since there are no aarch64 binaries offered by Mozilla at all. I'd be surprised if getting Rust to work would be too difficult given that the upstream has a CI building that architecture.

Alexander Vorobiev

unread,
Oct 6, 2017, 9:50:24 PM10/6/17
to nix-devel
Correct, firefox-bin installed with no errors but refuses to start due to wrong binary format. I tried building chromium but the build failed. Is there any browser which works on nixos/aarch64? As I mentioned, raspbian has firefox so it should be possible to build it.

One more thing, in order to make xserver to work I had to set cma to 128M. Should the wiki page be updated?
Reply all
Reply to author
Forward
0 new messages