NixOS on RISCV/VisionFive 2
VisionFive 2 | |
---|---|
Manufacturer | StarFive |
Architecture | RISC-V |
Bootloader | Custom or UEFI |
Boot order | Configurable; SD, USB, Netboot |
Maintainer | onny |
VisionFive 2 | |
SoC | JH7110 |
The VisionFive 2 is a single board computer (SBC) that uses a RISC-V processor with an integrated GPU. It supports Linux operating system and various multimedia features, such as 4K video decoding and OpenGL ES 3.212.
Building a SD-card image
This example assumes you have the latest revision of the board (v1.3) with 8GB memory. First create this Flake file
flake.nix
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
# Some dependencies of this flake are not yet available on non linux systems
inputs.systems.url = "github:nix-systems/x86_64-linux";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
outputs = { self, nixpkgs, nixos-hardware, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
rec {
packages.default = packages.sd-image;
packages.sd-image = (import "${nixpkgs}/nixos" {
configuration =
{ config, ... }: {
imports = [
"${nixos-hardware}/starfive/visionfive/v2/sd-image-installer.nix"
];
# If you want to use ssh set a password
users.users.nixos.password = "test123";
# OR add your public ssh key
# users.users.nixos.openssh.authorizedKeys.keys = [ "ssh-rsa ..." ];
# AND configure networking
networking.interfaces.end0.useDHCP = true;
networking.interfaces.end1.useDHCP = true;
# Additional configuration goes here
hardware.deviceTree.overlays = [{
name = "8GB-patch";
dtsFile = "${nixos-hardware}/starfive/visionfive/v2/8gb-patch.dts";
}];
sdImage.compressImage = false;
nixpkgs.crossSystem = {
config = "riscv64-unknown-linux-gnu";
system = "riscv64-linux";
};
system.stateVersion = "24.05";
};
inherit system;
}).config.system.build.sdImage;
});
}
Run following command to build the SD-card image
nix build .#