NixOS images for the Pine64 STAR64 SBC
- fgaz' work
- Old and New NixOS wikis. (Careful, the later has instructions for unstable mostly).
- Many thanks to @CORAAL , without whom this project wouldn't have been possible.
- The Gaming Linux FR community, especially the side dedicated to the "immutable distros" branch.
Understand how nixos works in general, with flakes, and make it work on the Star64 from Pine64.
Please be advised:
I'm still new to NixOS, and i'm actively learning about both nix, flakes, and NixOS.
Mistakes, corrections on the go, and other things like that are to be expected.
This repo itself is an attempt at understanding fgaz' work with limited knowledge on the subject and pure reverse-engineering.
Thank you for your understanding.
- You first need to know if you have the 8Gb variant or the 4Gb one. As the process varies depending on that.
- Every package included in your config (alongside subpackages) will be compiled from source, since we lack binary caches.
- You will need to enable the experimental features for both the
nix
command and theflake
features. I made the required changes in the SBC install, thanks to the env.nix for your convenience. But on a native nix install, you'll still need need to enable them manually on the builder machine.
star64
- This module takes the file./configuration.nix
within the flake (considering your work directory is the flake directory itself).8gb-patch
- This module adds the patch 8Gb for the 8Gb variant of the SBC, the said patch unlocks the 4 gigabytes left of your ram for usage - it isn't the case by default.copyConfiguration
- This modules creates the folder/etc/nixos/
and puts./configuration.nix
inside.
.#star64
- This config applies thestar64
module andcopyConfiguration
, in order to maintain an existing installation of nixos (nixos-rebuild --flake .#star64
)..#star64-8gb
- This config does the same but applies the8gb-patch
. This config is thus used to maintain an existing 8Gb install (nixos-rebuild --flake .#star64-8gb
)
N.B: Do note that the 4Gb config is compatible with 8Gb models, but you will be limited with 4Gb of ram while usage.
You probably do not have any powerful enough hardware to compile a whole system from scratch, and the absolute max 20W of power this SBC can draw would take you weeks at best to achieve that.
.#sd-image
- This config, also the default one,.#
- allows you to create the base system (config.#star64
), then converts the result system into a.img
file, meant to be burned into a SD card (withdd
for example), this is based on the methods of NixOS (ref: github:nixos/nixpkgs/nixos/modules/system/build.sdImage..#sd-image-8gb
- This config does the same, executing.#star64-8gb
then converting it into a.img
file.
Now, as said above, you WON'T use that, except if you have a beefy, native
riscv64-linux
machine with nix installed. As a consequence, we rely on the 2 next configs that enable crossbuilding.
Check the list of
supportedSystems
in flake.nix before heading in. Just to make sure your system is compatible.
.#sd-image-cross
- This config does the same thing as.#sd-image
, however, it enables crossbuilding capabilities for allsupportedSystems
..#sd-image-cross-8gb
- This config does the same as.#sd-image-8gb
, however this one enables crossbuilding, such as.#sd-image-cross
.
Alright, well except if you live in the year 2077 and Arasaka gave you the first riscv64 SOC with 48 logical cores, you won't get anywhere.
Forget about nix build .#sd-image
and nix build .#sd-image-8gb
.
You need to use a beefy machine, to compile in a reasonable time. I used to do that with a 12 logical cores (you can check by running nproc
), withing 10 minutes more or less.
The said machine will surely have a cpu architecture like x86_64 or aarch64 or something.
Two options then:
- You have a Star64 SBC with 4Gb of Ram: run
nix build .#sd-image-cross
- it will create a.img
file in your flake folder, burn it on a SD card using something likedd
. after that, install the card in your SBC and boot. OR - You have a Star64 SBC with 8Gb of Ram: run
nix build .#sd-image-cross-8gb
and same thing here:.img
image, burn it on an sd card and boom, working nixos.
- Star64 4Gb: run
nixos-rebuild switch/test --flake .#star64
within the flake folder, on your SBC install. OU - Star64 8Gb: run
nixos-rebuild switch/test --flake .#star64-8gb
, still within the flake folder on your SBC install.
Note: If by mistake you burned the 4Gb version on the SD Card, you don't need to destroy the install.
Just runnixos-rebuild switch/test --flake .#star64-8gb
from the flake to apply the 8gb-patch while keeping what you already did.
- Just run
nix flake update
, add theflake.lock
file to your git repo and re-run the correct command in case 2.
The code, like nixos-hardware from which it's taken, is released under CC0-1.0. Licenses of the composing packages apply to the prebuilt images.