~ehmry/sigil

3343ce8ab85780838744585c52118a62d9da5695 — Emery Hemingway 4 years ago 4817d73 vbox-hangs-at-LockMachine
Copy VDI with vfs_import
2 files changed, 22 insertions(+), 25 deletions(-)

M nixos-modules/default.nix
M nixos-modules/dhall/vbox-guest.dhall
M nixos-modules/default.nix => nixos-modules/default.nix +6 -3
@@ 26,14 26,15 @@ let
  '' + builtins.concatStringsSep "," (lib.mapAttrsToList (vmName: cfg:
    let
      inherit (cfg) config;
      vdiFile = "${toVdi config}/nixos.vdi";
      vdiRoot = toVdi config;
    in lib'.runDhallCommand "vbox.dhall" { } ''
      vdiUuid=$(${pkgs.virtualbox}/bin/VBoxManage showmediuminfo "${vdiFile}" | awk '/^UUID:/ {print $2}')
      vdiUuid=$(${pkgs.virtualbox}/bin/VBoxManage showmediuminfo "${vdiRoot}/nixos.vdi" | awk '/^UUID:/ {print $2}')
      dhall > $out << END
      { mapKey = "vbox-${vmName}"
      , mapValue =
          ${./dhall/vbox-guest.dhall}
            { vdiFilename = "${vdiFile}"
            { vdiFilename = "nixos.vdi"
            , vdiRoot = "${vdiRoot}"
            , vdiUuid = "$vdiUuid"
            , memorySize = ${toString config.virtualbox.memorySize}
            , vmName = "${vmName}"


@@ 80,6 81,7 @@ let
      "vbox5"
      "vfs"
      "vfs_audit"
      "vfs_import"
      "vfs_ttf"
    ] ++ lib.optional (cfg.fbDriver == "vesa") "vesa_drv"
      ++ lib.optional (cfg.fbDriver == "intel") "intel_fb_drv")


@@ 96,6 98,7 @@ let
      "libstdcxx.so"
      "libvfs.so"
      "libvfs_audit.so"
      "libvfs_import.so"
      "libvfs_rump.so"
      "libvfs_ttf.so"
    ];

M nixos-modules/dhall/vbox-guest.dhall => nixos-modules/dhall/vbox-guest.dhall +16 -22
@@ 26,6 26,7 @@ let Vfs/inline =
let toVbox =
        λ ( params
          : { vdiFilename : Text
            , vdiRoot : Text
            , vdiUuid : Text
            , memorySize : Natural
            , vmName : Text


@@ 91,9 92,7 @@ let toVbox =
              , binary = "virtualbox5"
              , config = Init.Config::{
                , attributes = toMap
                    { vbox_file = "machine.vbox"
                    , vm_name = params.vmName
                    }
                    { vbox_file = "machine.vbox", vm_name = params.vmName }
                , content =
                  [ XML.leaf
                      { name = "libc"


@@ 120,36 119,31 @@ let toVbox =
                                  , attributes = toMap { name = "dev" }
                                  , content = [ tag "log", tag "rtc" ]
                                  }
                              , XML.leaf
                                  { name = "fs"
                                  , attributes = toMap { writeable = "yes" }
                                  }
                              , XML.element
                                  { name = "dir"
                                  , attributes = toMap { name = "nix" }
                                  { name = "import"
                                  , attributes = toMap { overwrite = "no" }
                                  , content =
                                    [ XML.element
                                        { name = "dir"
                                        , attributes = toMap { name = "store" }
                                        , content =
                                          [ XML.leaf
                                              { name = "fs"
                                              , attributes = toMap
                                                  { writeable = "no"
                                                  , label = "nix"
                                                  }
                                              }
                                          ]
                                    [ XML.leaf
                                        { name = "fs"
                                        , attributes = toMap
                                            { label = "nix"
                                            , root = "${params.vdiRoot}"
                                            }
                                        }
                                    ]
                                  }
                              , XML.leaf
                                  { name = "fs"
                                  , attributes = toMap { writeable = "yes" }
                                  }
                              ]
                      }
                  ]
                }
              , resources = Resources::{
                , caps = 1024
                , ram = Genode.units.MiB 128 + Genode.units.MiB params.memorySize
                , ram =
                    Genode.units.MiB 128 + Genode.units.MiB params.memorySize
                }
              , routes =
                [ ServiceRoute.parent "File_system"