nixos: do not test with a disk without a store
This commit is contained in:
parent
26d4f6b62e
commit
983c63aa0b
|
@ -394,7 +394,7 @@ in {
|
|||
bootDriveImage = import ./lib/make-bootable-image.nix {
|
||||
inherit config pkgs espImage storeFsImage;
|
||||
};
|
||||
in bootDriveImage;
|
||||
in lib.mkIf (config.genode.boot.storeBackend != "tarball") bootDriveImage;
|
||||
|
||||
# virtualisation.useEFIBoot = config.genode.boot.storeBackend == "usb";
|
||||
|
||||
|
|
|
@ -25,15 +25,6 @@ with lib;
|
|||
}));
|
||||
};
|
||||
|
||||
hardware.genode.platform.policies = lib.mkOption {
|
||||
type = with types; listOf path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of policies to append to the Genode platform driver.
|
||||
Type is Init.Config.Policy.Type.
|
||||
'';
|
||||
};
|
||||
|
||||
hardware.genode = {
|
||||
|
||||
ahci.enable = lib.mkEnableOption "AHCI (SATA) block driver";
|
||||
|
@ -58,11 +49,21 @@ with lib;
|
|||
|
||||
};
|
||||
|
||||
platform.policies = lib.mkOption {
|
||||
type = with types; listOf path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of policies to append to the Genode platform driver.
|
||||
Type is Init.Config.Policy.Type.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
};
|
||||
|
||||
config = let cfg = config.hardware.genode;
|
||||
in {
|
||||
|
||||
assertions = with builtins;
|
||||
let
|
||||
|
@ -99,7 +100,7 @@ with lib;
|
|||
hardware.genode.usb.storage.enable = config.genode.boot.storeBackend
|
||||
== "usb";
|
||||
|
||||
hardware.genode.usb.enable = config.hardware.genode.usb.storage.enable;
|
||||
hardware.genode.usb.enable = cfg.usb.storage.enable;
|
||||
|
||||
hardware.genode.platform.policies = lib.lists.imap0 (i: name:
|
||||
builtins.toFile (name + ".platform-policy.dhall") ''
|
||||
|
@ -119,7 +120,7 @@ with lib;
|
|||
]
|
||||
}
|
||||
'') (builtins.attrNames config.networking.interfaces)
|
||||
++ (lib.optional config.hardware.genode.ahci.enable
|
||||
++ (lib.optional cfg.ahci.enable
|
||||
(builtins.toFile ("ahci.platform-policy.dhall") ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
|
@ -131,7 +132,7 @@ with lib;
|
|||
{ name = "pci", attributes = toMap { class = "AHCI" } }
|
||||
]
|
||||
}
|
||||
'')) ++ (lib.optional config.hardware.genode.framebuffer.enable
|
||||
'')) ++ (lib.optional cfg.framebuffer.enable
|
||||
(builtins.toFile ("framebuffer.platform-policy.dhall") ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
|
@ -143,7 +144,7 @@ with lib;
|
|||
{ name = "pci", attributes = toMap { class = "VGA" } }
|
||||
]
|
||||
}
|
||||
'')) ++ (lib.optional config.hardware.genode.usb.enable
|
||||
'')) ++ (lib.optional cfg.usb.enable
|
||||
(builtins.toFile ("usb.platform-policy.dhall") ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
|
@ -296,7 +297,7 @@ with lib;
|
|||
|
||||
in lib.filterAttrs (n: v: v != null) (nics // sockets);
|
||||
|
||||
genode.core.children.ahci_drv = {
|
||||
genode.core.children.ahci_drv = lib.mkIf cfg.ahci.enable {
|
||||
inputs = [ pkgs.genodePackages.ahci_drv ];
|
||||
configFile = pkgs.writeText "ahci_drv.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
@ -359,9 +360,8 @@ with lib;
|
|||
|
||||
genode.core.children.platform_drv = {
|
||||
inputs = [ pkgs.genodePackages.platform_drv ];
|
||||
configFile = let
|
||||
policies =
|
||||
map (policy: ", ${policy}") config.hardware.genode.platform.policies;
|
||||
configFile =
|
||||
let policies = map (policy: ", ${policy}") cfg.platform.policies;
|
||||
in pkgs.writeText "platform_drv.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
|
@ -390,12 +390,11 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
genode.core.children.usb_drv = let
|
||||
cfg = config.hardware.genode.usb;
|
||||
toYesNo = b: if b then "yes" else "no";
|
||||
in mkIf cfg.enable {
|
||||
genode.core.children.usb_drv = let toYesNo = b: if b then "yes" else "no";
|
||||
in mkIf cfg.usb.enable {
|
||||
inputs = [ pkgs.genodePackages.usb_drv ];
|
||||
configFile = builtins.toFile "usb_drv.dhall" ''
|
||||
configFile = with cfg.usb;
|
||||
builtins.toFile "usb_drv.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
let XML = Genode.Prelude.XML
|
||||
|
@ -419,10 +418,10 @@ with lib;
|
|||
|
||||
in Init.Config::{
|
||||
, attributes = toMap
|
||||
{ ehci = "${toYesNo cfg.ehciSupport}"
|
||||
, ohci = "${toYesNo cfg.ohciSupport}"
|
||||
, uhci = "${toYesNo cfg.uhciSupport}"
|
||||
, xhci = "${toYesNo cfg.xhciSupport}"
|
||||
{ ehci = "${toYesNo ehciSupport}"
|
||||
, ohci = "${toYesNo ohciSupport}"
|
||||
, uhci = "${toYesNo uhciSupport}"
|
||||
, xhci = "${toYesNo xhciSupport}"
|
||||
}
|
||||
, content =
|
||||
[ XML.element
|
||||
|
@ -443,8 +442,7 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
genode.core.children.usb_block_drv =
|
||||
mkIf config.hardware.genode.usb.storage.enable {
|
||||
genode.core.children.usb_block_drv = mkIf cfg.usb.storage.enable {
|
||||
inputs = [ pkgs.genodePackages.usb_block_drv ];
|
||||
configFile = builtins.toFile "usb_block_drv.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
@ -470,19 +468,18 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
genode.core.children.fb_drv =
|
||||
mkIf config.hardware.genode.framebuffer.enable {
|
||||
genode.core.children.fb_drv = mkIf cfg.framebuffer.enable {
|
||||
inputs = with pkgs.genodePackages;
|
||||
{
|
||||
"boot" = [ boot_fb_drv ];
|
||||
"vesa" = [ vesa_drv ];
|
||||
}.${config.hardware.genode.framebuffer.driver};
|
||||
}.${cfg.framebuffer.driver};
|
||||
configFile = let
|
||||
binary = with pkgs.genodePackages;
|
||||
{
|
||||
"boot" = "boot_fb_drv";
|
||||
"vesa" = "vesa_fb_drv";
|
||||
}.${config.hardware.genode.framebuffer.driver};
|
||||
}.${cfg.framebuffer.driver};
|
||||
in builtins.toFile "fb_drv.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
|
@ -504,7 +501,7 @@ with lib;
|
|||
|
||||
virtualisation.useBootLoader = config.genode.boot.storeBackend != "tarball";
|
||||
|
||||
virtualisation.qemu.options = lib.optional config.hardware.genode.usb.enable
|
||||
virtualisation.qemu.options = lib.optional cfg.usb.enable
|
||||
(lib.optional (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) "-usb"
|
||||
++ lib.optional (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64)
|
||||
"-device usb-ehci,id=usb0");
|
||||
|
|
|
@ -23,7 +23,7 @@ let
|
|||
# Shell script to start the VM.
|
||||
startVM = ''
|
||||
#! ${pkgs.buildPackages.runtimeShell}
|
||||
|
||||
'' + lib.optionalString (config.virtualisation.diskImage != null) ''
|
||||
NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}})
|
||||
|
||||
if ! test -w "$NIX_DISK_IMAGE"; then
|
||||
|
@ -36,6 +36,7 @@ let
|
|||
${toString config.virtualisation.diskSize}M || exit 1
|
||||
fi
|
||||
|
||||
'' + ''
|
||||
# Create a directory for storing temporary data of the running VM.
|
||||
if [ -z "$TMPDIR" -o -z "$USE_TMPDIR" ]; then
|
||||
TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
|
||||
|
@ -72,7 +73,8 @@ in {
|
|||
};
|
||||
|
||||
virtualisation.diskImage = mkOption {
|
||||
default = "./${config.system.name}.qcow2";
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
description = ''
|
||||
Path to the disk image containing the root filesystem.
|
||||
The image will be created on startup if it does not
|
||||
|
|
Loading…
Reference in New Issue