3
0
Fork 0
forked from mirrors/nixpkgs

Add a priority level for overrides in VM tests

Now that overriding fileSystems in qemu-vm.nix works again, it's
important that the VM tests that add additional file systems use the
same override priority.  Instead of using the same magic constant
everywhere, they can now use mkVMOverride.

http://hydra.nixos.org/build/6695561
This commit is contained in:
Eelco Dolstra 2013-10-29 13:04:52 +01:00
parent f0b7b0af12
commit adc1b38b85
5 changed files with 20 additions and 19 deletions

View file

@ -284,9 +284,10 @@ rec {
inherit priority content; inherit priority content;
}; };
mkOptionDefault = mkOverride 1001; mkOptionDefault = mkOverride 1001; # priority of option defaults
mkDefault = mkOverride 1000; mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default
mkForce = mkOverride 50; mkForce = mkOverride 50;
mkVMOverride = mkOverride 10; # used by nixos-rebuild build-vm
mkFixStrictness = id; # obsolete, no-op mkFixStrictness = id; # obsolete, no-op

View file

@ -273,7 +273,7 @@ in
config = { config = {
boot.loader.grub.device = mkOverride 50 "/dev/vda"; boot.loader.grub.device = mkVMOverride "/dev/vda";
boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse"; boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse";
@ -337,13 +337,13 @@ in
virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ]; virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ];
# Mount the host filesystem via 9P, and bind-mount the Nix store of # Mount the host filesystem via 9P, and bind-mount the Nix store
# the host into our own filesystem. We use mkOverride to allow this # of the host into our own filesystem. We use mkVMOverride to
# module to be applied to "normal" NixOS system configuration, where # allow this module to be applied to "normal" NixOS system
# the regular value for the `fileSystems' attribute should be # configuration, where the regular value for the `fileSystems'
# disregarded for the purpose of building a VM test image (since # attribute should be disregarded for the purpose of building a VM
# those filesystems don't exist in the VM). # test image (since those filesystems don't exist in the VM).
fileSystems = mkOverride 10 fileSystems = mkVMOverride
{ "/".device = "/dev/vda"; { "/".device = "/dev/vda";
"/nix/store" = "/nix/store" =
{ device = "store"; { device = "store";
@ -371,7 +371,7 @@ in
}; };
}; };
swapDevices = mkOverride 50 [ ]; swapDevices = mkVMOverride [ ];
# Don't run ntpd in the guest. It should get the correct time from KVM. # Don't run ntpd in the guest. It should get the correct time from KVM.
services.ntp.enable = false; services.ntp.enable = false;
@ -385,10 +385,10 @@ in
# When building a regular system configuration, override whatever # When building a regular system configuration, override whatever
# video driver the host uses. # video driver the host uses.
services.xserver.videoDriver = mkOverride 50 null; services.xserver.videoDriver = mkVMOverride null;
services.xserver.videoDrivers = mkOverride 50 [ "vesa" ]; services.xserver.videoDrivers = mkVMOverride [ "vesa" ];
services.xserver.defaultDepth = mkOverride 50 0; services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkOverride 50 [ { x = 1024; y = 768; } ]; services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
services.xserver.monitorSection = services.xserver.monitorSection =
'' ''
# Set a higher refresh rate so that resolutions > 800x600 work. # Set a higher refresh rate so that resolutions > 800x600 work.
@ -397,7 +397,7 @@ in
''; '';
# Wireless won't work in the VM. # Wireless won't work in the VM.
networking.wireless.enable = mkOverride 50 false; networking.wireless.enable = mkVMOverride false;
system.requiredKernelConfig = with config.lib.kernelConfig; system.requiredKernelConfig = with config.lib.kernelConfig;
[ (isEnabled "VIRTIO_BLK") [ (isEnabled "VIRTIO_BLK")

View file

@ -40,7 +40,7 @@ rec {
device = "share:/repos2"; device = "share:/repos2";
fsType = "nfs"; fsType = "nfs";
}; };
in pkgs.lib.mkOverride 50 [ in pkgs.lib.mkVMOverride [
repos1 repos1
repos1 # check remount repos1 # check remount
repos2 # check after remount repos2 # check after remount

View file

@ -6,7 +6,7 @@ let
client = client =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ fileSystems = pkgs.lib.mkOverride 50 { fileSystems = pkgs.lib.mkVMOverride
[ { mountPoint = "/data"; [ { mountPoint = "/data";
device = "server:${if version == 4 then "/" else "/data"}"; device = "server:${if version == 4 then "/" else "/data"}";
fsType = "nfs"; fsType = "nfs";

View file

@ -27,7 +27,7 @@
webserver = webserver =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ fileSystems = pkgs.lib.mkOverride 50 { fileSystems = pkgs.lib.mkVMOverride
[ { mountPoint = "/repos"; [ { mountPoint = "/repos";
device = "storage:/repos"; device = "storage:/repos";
fsType = "nfs"; fsType = "nfs";