WIP
This commit is contained in:
parent
13d57e18a0
commit
b65cc31518
9
base.nix
9
base.nix
@ -6,6 +6,15 @@
|
||||
# RISC-V Quirks and patches, should be upstreamed
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
vte = (prev.vte.override {
|
||||
stdenv = prev.stdenv;
|
||||
}).overrideAttrs (old: {
|
||||
buildInputs = old.buildInputs ++ [ prev.gobject-introspection prev.glib ];
|
||||
depsBuildHost = [ prev.pkg-config ];
|
||||
#nativeBuildInputs = old.nativeBuildInputs ++ [ prev.glib ];
|
||||
propagatedBuildInputs = [ prev.gtk3 pkgs.pango ];
|
||||
#NIX_DEBUG = 5;
|
||||
});
|
||||
gusb = prev.gusb.overrideAttrs (old: {
|
||||
buildInputs = old.buildInputs ++ [ prev.gobject-introspection ];
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./examples/launchCageOnBoot.nix
|
||||
@ -17,7 +18,13 @@
|
||||
|
||||
networking.hostName = "visionfive-nix";
|
||||
|
||||
boot.kernelParams = [ "boot.shell_on_fail" ];
|
||||
boot = {
|
||||
kernelParams = [ "boot.shell_on_fail" ];
|
||||
consoleLogLevel = lib.mkDefault 7;
|
||||
initrd.kernelModules = [
|
||||
"virtio_blk"
|
||||
];
|
||||
};
|
||||
|
||||
# Enable ssh on boot
|
||||
services.openssh.enable = true;
|
||||
|
55
run-visionfive-nix-vm.sh
Executable file
55
run-visionfive-nix-vm.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#! /nix/store/r4vxljid3iq94jp7qvd639sps0fscwy3-bash-5.2-p15/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./visionfive-nix.qcow2}")
|
||||
|
||||
if ! test -e "$NIX_DISK_IMAGE"; then
|
||||
/nix/store/gn94kgxqg9wv7y9cjkkavv2626sbq5vz-qemu-host-cpu-only-riscv64-unknown-linux-gnu-7.0.0/bin/qemu-img create -f qcow2 "$NIX_DISK_IMAGE" \
|
||||
1024M
|
||||
fi
|
||||
|
||||
# Create a directory for storing temporary data of the running VM.
|
||||
if [ -z "$TMPDIR" ] || [ -z "$USE_TMPDIR" ]; then
|
||||
TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Create a directory for exchanging data with the VM.
|
||||
mkdir -p "$TMPDIR/xchg"
|
||||
|
||||
|
||||
|
||||
cd "$TMPDIR"
|
||||
|
||||
|
||||
QEMU_KERNEL_PARAMS="boot.trace "
|
||||
|
||||
# Start QEMU.
|
||||
exec /nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/qemu-system-riscv64 \
|
||||
-name visionfive-nix \
|
||||
-m 1024 \
|
||||
-smp 1 \
|
||||
-nographic \
|
||||
-machine virt \
|
||||
-device virtio-rng-pci \
|
||||
-net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \
|
||||
-virtfs local,path=/nix/store,security_model=none,mount_tag=nix-store \
|
||||
-virtfs local,path="${SHARED_DIR:-$TMPDIR/xchg}",security_model=none,mount_tag=shared \
|
||||
-virtfs local,path="$TMPDIR"/xchg,security_model=none,mount_tag=xchg \
|
||||
-hda "$NIX_DISK_IMAGE" \
|
||||
-device virtio-keyboard \
|
||||
-kernel ${NIXPKGS_QEMU_KERNEL_visionfive_nix:-/nix/store/y0912x26b1fxrs0d8yfzsznak56pk2c8-nixos-system-visionfive-nix-22.11.20220712.39a827f/kernel} \
|
||||
-initrd /nix/store/y0912x26b1fxrs0d8yfzsznak56pk2c8-nixos-system-visionfive-nix-22.11.20220712.39a827f/initrd \
|
||||
-append "$(cat /nix/store/y0912x26b1fxrs0d8yfzsznak56pk2c8-nixos-system-visionfive-nix-22.11.20220712.39a827f/kernel-params) init=/nix/store/y0912x26b1fxrs0d8yfzsznak56pk2c8-nixos-system-visionfive-nix-22.11.20220712.39a827f/init regInfo=/nix/store/x3zpwfbk2wkiisxhgi7zwsfwbdfxk0w1-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS" \
|
||||
$QEMU_OPTS \
|
||||
"$@"
|
||||
|
||||
#console=tty0
|
||||
#console=ttyS0,115200n8
|
||||
#
|
||||
# -fsdev local,id=fsdev1,path=/nix/store,security_model=none \
|
||||
# -device virtio-9p-pci,fsdev=fsdev1,mount_tag=store,bus=pcie.1 \
|
||||
#
|
||||
# -drive cache=writeback,file="$NIX_DISK_IMAGE",id=drive1,if=none,index=1,werror=report -device virtio-blk-pci,drive=drive1 \
|
Loading…
Reference in New Issue
Block a user