NixOS on RISCV/VisionFive 2: Difference between revisions

Onny (talk | contribs)
Mel (talk | contribs)
m Typo
 
(6 intermediate revisions by 3 users not shown)
Line 36: Line 36:


= Setup =
= Setup =
Precompiled SD-card images can be found [https://hydra.nichi.co/job/nixos/riscv/visionfive2 on the Hydra instance] my NickCao. Before flashing the image, use <code>unzstd</code> to unpack the downloaded archive.
Precompiled SD-card images can be found [https://hydra.nichi.co/job/nixos/riscv/visionfive2 on the Hydra instance] by NickCao. Before flashing the image, use <code>unzstd</code> to unpack the downloaded archive.


=== Manually build a SD-card image ===
=== Manually build a SD-card image ===
Line 43: Line 43:
{{file|flake.nix|nix|<nowiki>
{{file|flake.nix|nix|<nowiki>
{
{
   inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
   inputs.nixpkgs.url = "nixpkgs/nixos-24.11";
   inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
   inputs.nixos-hardware.url = "github:nixos/nixos-hardware";


Line 80: Line 80:
               };
               };


               system.stateVersion = "24.05";
               system.stateVersion = "24.11";
             };
             };
           inherit system;
           inherit system;
Line 87: Line 87:
}
}
</nowiki>}}
</nowiki>}}
It might be helpful to add [[RISC-V#Binary cache|third-party binary cache configuration]] to this system configuration.


Run following command to build the SD-card image
Run following command to build the SD-card image
Line 95: Line 97:


=== Flashing the image ===
=== Flashing the image ===
After successfull build or unpack, flash the resulting file (build file is in the directory <code>results/sd-image</code>) to the target device such as a NVME SSD drive or in this example the SD-card (<code>/dev/mmcblk*</code>). Note that everything on the target device gets erased.
After successfull build or unpack, flash the resulting file (build file is in the directory <code>results/sd-image</code>) to the target device such as a NVME SSD or in this example the SD-card (<code>/dev/mmcblk*</code>). Note that everything on the target device gets erased.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 117: Line 119:
</syntaxhighlight>Bootstrap NixOS system configuration at <code>/etc/nixos/configuration.nix</code><syntaxhighlight lang="bash">
</syntaxhighlight>Bootstrap NixOS system configuration at <code>/etc/nixos/configuration.nix</code><syntaxhighlight lang="bash">
nixos-generate-config
nixos-generate-config
</syntaxhighlight>
</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 ==