NixOS on RISCV/VisionFive 2: Difference between revisions

Misuzu (talk | contribs)
m Add link to another sdcard image
Onny (talk | contribs)
m Setup: Add uboot btrfs config
 
(3 intermediate revisions by the same user not shown)
Line 36: Line 36:


= Setup =
= Setup =
Precompiled SD-card images can be found [https://hydra.nichi.co/job/nixos/riscv/visionfive2 on NickCao's Hydra instance] or [https://hydra.ztier.in/job/nixos/nixos-unstable/sd-image-riscv64-new-kernel-no-zfs-installer-cross/latest on misuzu's Hydra instance]. Before flashing the image, use <code>unzstd</code> to unpack the downloaded archive.
Precompiled SD-card images with unstable NixOS can be found [https://hydra.ztier.in/job/nixos/nixos-unstable/sd-image-riscv64-new-kernel-no-zfs-installer-cross/latest on misuzu's Hydra instance]. 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 = "nixpkgs/nixos-24.11";
   inputs.nixpkgs.url = "nixpkgs/nixos-25.11";
   inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
   inputs.nixos-hardware.url = "github:nixos/nixos-hardware";


Line 80: Line 80:
               };
               };


               system.stateVersion = "24.11";
               system.stateVersion = "25.11";
             };
             };
           inherit system;
           inherit system;
Line 87: Line 87:
}
}
</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
{{file|flake.nix|nix|<nowiki>
sdImage = {
  compressImage = false;
  rootFilesystemCreator = "${pkgs.path}/nixos/lib/make-btrfs-fs.nix";
  # do this manually as replacing the resize2fs string in postBootCommands
  # might be too complex. btrfs uses its own resize command.
  expandOnBoot = false;
};
nixpkgs.overlays = [
  (final: prev: {
    ubootVisionFive2 = prev.ubootVisionFive2.overrideAttrs (oldAttrs: {
      extraConfig = (oldAttrs.extraConfig or "") + ''
        CONFIG_FS_BTRFS=y
        CONFIG_CMD_BTRFS=y
      '';
    });
  })
];
</nowiki>}}
You might need to adjust [[U-Boot]] configuration if you wish to boot other filesystems or filesystem features.


It might be helpful to add [[RISC-V#Binary cache|third-party binary cache configuration]] to this system configuration.
It might be helpful to add [[RISC-V#Binary cache|third-party binary cache configuration]] to this system configuration.