patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 37b470cba890f65c3b45e743edcaaed7396e5d3b 1515 bytes (raw)
name: release/installer/run-vm.nix 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021-2025 Alyssa Ross <hi@alyssa.is>

import ../../lib/call-package.nix (
{ callSpectrumPackage, lib, coreutils, qemu_kvm, stdenv, writeShellScript }:

let
  inherit (builtins) storeDir;
  inherit (lib) makeBinPath escapeShellArg;

  eosimages = callSpectrumPackage ../combined/eosimages.nix {};

  installer = callSpectrumPackage ./. {
    extraConfig = {
      boot.initrd.availableKernelModules = [ "9p" "9pnet_virtio" ];

      fileSystems.${storeDir} = {
        fsType = "9p";
        device = "store";
      };
    };
  };
in

writeShellScript "run-spectrum-installer-vm.sh" ''
  export PATH=${makeBinPath [ coreutils qemu_kvm ]}
  img="$(mktemp spectrum-installer-target.XXXXXXXXXX.img)"
  truncate -s 20G "$img"
  exec 3<>"$img"
  rm -f "$img"
  exec ${../../scripts/run-qemu.sh} -cpu max -m 4G \
    -device virtio-keyboard \
    -device virtio-mouse \
    -device virtio-gpu \
    -parallel none \
    -vga none \
    -virtfs local,mount_tag=store,path=/nix/store,security_model=none,readonly=true \
    -drive file=${qemu_kvm}/share/qemu/edk2-${stdenv.hostPlatform.qemuArch}-code.fd,format=raw,if=pflash,readonly=true \
    -drive file=${eosimages},format=raw,if=virtio,readonly=true \
    -drive file=/proc/self/fd/3,format=raw,if=virtio \
    -kernel ${installer.kernel} \
    -initrd ${installer.initramfs} \
    -append ${escapeShellArg (toString [
      installer.kernelParams
      "systemd.journald.forward_to_console"
    ])}
'') (_: {})

debug log:

solving 37b470cba890f65c3b45e743edcaaed7396e5d3b ...
found 37b470cba890f65c3b45e743edcaaed7396e5d3b in https://spectrum-os.org/git/spectrum

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).