NixOS on Pocket

I’ve been working on bringing up NixOS on Pocket Reform with imx8mq. I’ve got things booting on 6.9.7, but haven’t finished testing all of the hardware. This is all based on @lykso’s amazing work to bring up NixOS on the original reform, but based around the 6.9 kernel with some tweaks for Pocket with imx8mp.

The WIP merge request is here if anyone is interested in helping with this.

9 Likes

Hey any plan on maintaining your PR? I would love to try to port my NixOS config on my Pocket Refom if you end up writing some steps (specially for the bootloader part which scares me a bit given it’s custom)

1 Like

Really funny timing on this question!

I’ve actually been reworking and updating not only this PR, but also support for the original Reform as well, to use the latest MNT firmware & kernel repos - as well as adding keyboard & syscon firmware builds for the Pocket with IMX8MP.

I haven’t put any more work into the branch on @lykso’s project as they’ve not been using NixOS anymore AFAIK. I was planning up posting in this thread once I had everything tested, but the builds have been taking a while on the hardware I have available (an older rockchip SBC - which is still faster than cross-compiling on my main x86_64 workstation).

The very work-in-progress untested project is here.

5 Likes

You are doing god’s work!

I just got my Pocket and yearn for NixOS!

Lovely!

I’m still running nixos on my original imx8mq reform but have not taken the time to bring in the new reform kernel/firmware changes in a while. I’ll try basing the next kernel upgrade on your changes when I find some time.

A tip to ease the kernel builds is to try https://nixbuild.net. A full kernel build on their aarc64 cluster costs less than 1€, and is significantly faster than cross compiling on my (admittedly old) x64 buildserver.

1 Like

Thanks for doing all that work :grinning_cat:

I’m also interested in running NixOS on the Pocket Reform, but with the RK3588.
I guess I’ll have to port it myself for now and make a dive into NixOS.

I hope I’ll be able to contribute something once my Pocket Reform arrives.

2 Likes

I’ve got 24.11 with the new 6.14 kernel + recent patches working on the original Reform2 (with imx8mq) and Pocket Reform (with imx8mp) including wifi & have also packaged up and tested the LPC driver successfully. Display & WiFi working on both as well.

I’m going to do some more testing & also do a full encrypted NVMe install and make sure that works OK, but looking good. The updated SD card images can be built by anyone brave who wants to test them out using the flake in this repo

5 Likes

Oh, I should also mention: I’ve left all the stuff in there which (should) be needed for RK3588, A311D, etc - I just don’t have those modules to be able hack on and test them out. So if anyone with those modules would like to use NixOS and would like some pointers/guidance on getting them added I’m happy to help. I’m here and on the #mnt-reform IRC channel.

3 Likes

Thanks for all the work you’ve done.

I might come back to you regarding the rk3588 once my Pocket Reform has arrived :grinning_cat:

Cheers,
Triss

2 Likes

Hey there :grinning_cat:

Since my Pocket Reform finally arrived and is working now, I’m ready to tackle the NixOS port for RK3588.

I just wanted to ask whether there are any news since May I could build on. Otherwise I’ll have to start with the data from then.

I simply don’t wanna re-do the work someone else has already done (and that might be of a way better quality) :sweat_smile:

Cheers, Triss

1 Like

I spent a couple of hours looking at it recently, but I haven’t done any significant work other than browsing through repos and thinking about the work to be done. From what I saw the build process seems a little different than the prior two modules, so it won’t be as straightforward as I hoped. I was planning to start by making my own RK3588-only build to keep things simple, then I may adapt this work into patches to the existing repo. But I am moving slowly on this, with some other more critical work in the pipeline, so I’m glad to see someone else working on it.

1 Like

I’m also interested in getting this working, so if the three of us wanted to join forces in a repo somewhere, I’d be down.

1 Like

I’m not aware of any specific changes for NixOS on Pocket for the RK3588 - however the current kernel build (which could probably use an update to whatever the current system image is using) has the patches & config for the RK3588. That needs testing of course because I don’t have access to this hardware. The other thing not provided by the current flake is a u-boot build, which would be I think the main gap. In the past for the other images that’s just been a matter of looking at the config and upstream source for the one used to build the system image and adding a new package/derivation, with an extra flake output. Looking at the flake.nix is a good starting point, let me know if I can help with anything!

2 Likes

I should also mention that I’ve got an ITX motherboard with an RK3588 processor coming in the mail over the next week or so which I’m intending to install into my server rack so I have a dedicated, fast aarch64 build host - that’s definitely been a barrier for working on these images for me. Once I have that it’ll be much easier for me to keep them updated. Right now they probably need a bump for 25.05

1 Like

Hey there :grinning_cat:

I finally found the time to give this a try but I couldn’t build your apparently working imx8mp port.

I got nix installed and flakes working but running
nix build .#imx8mpPocket.sdImage -l
got me some errors in flake.nix

Do I need to install any additional software on the Pocket that is not mentioned in your readme?

Just to make things clear: I’m quite new with nix and might need someone or some project to learn the ropes. I hope I’ll be able to contribute some useful stuff soon :sweat_smile:

Thanks for your help.

Cheers,

Triss

It’s hard to say what might have gone wrong without knowing the error you got - could you share it?

There’s a few things it’s worth learning about before trying to build NixOS images, especially for aarch64. If you’re building from an x86_64 machine you’ll need to set up your machine to be able to perform emulated builds for aarch64. It’s also helpful to get familiar with the nixpkgs helpers for building aarch64 SD images (i.e. here which is commonly used for building aarch64 sd install images, and this project was originally based on).

Have you guys seen this post? Any experience with NixOS on MNT Reform? - #9 by leif

Does this help for bringing up NixOS on the pocket reform? Could we maybe streamline efforts and also work in the NixOS-hardware respository or is this somehow completely different from the efforts in this thread? :blush:

1 Like

It would make sense to focus on contributing to nixos-hardware, I think that’s a good idea. Given the work done by @leif focuses on the RCORE module it will be easier to build on that work to enable the RCORE Pocket Reform to run NixOS. The project I have been working on has focused previously on the original modules, so is likely only useful as a reference. nixos-hardware is more easily discoverable by other Pocket Reform owners and has the RCORE for Reform tested so it would make sense to target that. If I find myself with the time, I’ll likely migrate support for the IMX8MP (Pocket Reform) and IMX8MQ (Reform) devices I have to nixos-hardware too.

1 Like

If you have time could you check if you are able to boot with my kernel? The config seems similar except I use more yes vs module. I just translated the debian config into nix and removed some options (see comments). I have not packaged any firmware except for uboot.

1 Like

Hey there :grinning_cat:

I finally got the time to teat your setup. I had to cross compile the image due to some issues on the Debian/nix installation on my Pocket but was finally able to make a SD card.

The Pocket was able to boot from it and create a first configuration.nix. I next gotta check the setup, give it a first boot and then try to switch to an encrypted drive. Looks promising :grinning_cat_with_smiling_eyes:

I’ll then have to see whether I can add some more convenient install method to the image like getting calamare to work. But that’s for the future.

Cheers, Triss

2 Likes