NixOS on RISCV/VisionFive 2: Difference between revisions

Onny (talk | contribs)
Setup: Update and fix btrfs image instruction
Onny (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 88: Line 88:
</nowiki>}}
</nowiki>}}


If you want to use an alternative filesystem for system root, for example [[Btrfs]], you could change the <code>sdImage</code>-part to this
If you want to use an alternative filesystem for system root, for example [[Btrfs]], you could change the <code>sdImage</code>-part to this. Currently [https://github.com/NixOS/nixpkgs/pull/434122 this patch] is required to produce a functioning btrfs image.


{{file|flake.nix|nix|<nowiki>
{{file|flake.nix|nix|<nowiki>
Line 115: Line 115:
     "compress=zstd"  
     "compress=zstd"  
     "noatime"  
     "noatime"  
    "rw"
   ];
   ];
};
};
Line 153: Line 152:
</syntaxhighlight>It is recommended to [[RISC-V#Binary cache|configure third-party binary caches]] to speed up build times.
</syntaxhighlight>It is recommended to [[RISC-V#Binary cache|configure third-party binary caches]] to speed up build times.


== Tips and tricks ==
= Tips and tricks =


=== Using the Visionfive 2 as a remote builder to build native RISCV packages for e.g. the Visionfive 2 ===
== Using the Visionfive 2 as a remote builder to build native RISCV packages for e.g. the Visionfive 2 ==
Building an NixOS system image that can be flashed to an SD card or NVMe SSD requires to '''build RISCV binaries''', more specifically for the <code>"riscv64-linux"</code>platform. From a typical Intel/AMD computer we can either
Building an NixOS system image that can be flashed to an SD card or NVMe SSD requires to '''build RISCV binaries''', more specifically for the <code>"riscv64-linux"</code>platform. From a typical Intel/AMD computer we can either


Line 170: Line 169:
# '''flash that resulting image onto an SD card''' or NVMe SSD using a call similar to <code>zstdcat result/sd-image/nixos-sd-image-23.11.20230703.ea4c80b-riscv64-linux.img.zst | sudo dd of=/dev/mmcblk0 bs=100M status=progress</code> and place that card into the Visionfive 2.
# '''flash that resulting image onto an SD card''' or NVMe SSD using a call similar to <code>zstdcat result/sd-image/nixos-sd-image-23.11.20230703.ea4c80b-riscv64-linux.img.zst | sudo dd of=/dev/mmcblk0 bs=100M status=progress</code> and place that card into the Visionfive 2.


=== Deploy and Update the Visionfive 2 NixOS system once it's running NixOS ===
== Deploy and Update the Visionfive 2 NixOS system once it's running NixOS ==
Once the Visionfive 2 is running NixOS, you can update it with newer NixOS system configurations using e.g. the usual  <code>nix-rebuild</code>
Once the Visionfive 2 is running NixOS, you can update it with newer NixOS system configurations using e.g. the usual  <code>nix-rebuild</code>


Line 181: Line 180:
See [https://nixcademy.com/2023/08/10/nixos-rebuild-remote-deployment/ this guide] for a good explanation of this terminal call.
See [https://nixcademy.com/2023/08/10/nixos-rebuild-remote-deployment/ this guide] for a good explanation of this terminal call.


== See also ==
= See also =


* There's also a port of the UEFI reference implementation EDK2 available at https://github.com/starfive-tech/edk2 to support a future generic RISCV Linux image that can be booted from any RISCV device.
* There's also a port of the UEFI reference implementation EDK2 available at https://github.com/starfive-tech/edk2 to support a future generic RISCV Linux image that can be booted from any RISCV device.