diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index bf3615f2fe7..5360cff22f3 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -7,7 +7,7 @@ # the VM in the host. On the other hand, the root filesystem is a # read/writable disk image persistent across VM reboots. -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, options, ... }: with lib; with import ../../lib/qemu-flags.nix { inherit pkgs; }; @@ -266,6 +266,8 @@ in options = { + virtualisation.fileSystems = options.fileSystems; + virtualisation.memorySize = mkOption { default = 384; @@ -659,6 +661,7 @@ in # attribute should be disregarded for the purpose of building a VM # test image (since those filesystems don't exist in the VM). fileSystems = mkVMOverride ( + cfg.fileSystems // { "/".device = cfg.bootDevice; ${if cfg.writableStore then "/nix/.ro-store" else "/nix/store"} = { device = "store"; diff --git a/nixos/tests/bees.nix b/nixos/tests/bees.nix index 6e6a9c3446b..58a9c295135 100644 --- a/nixos/tests/bees.nix +++ b/nixos/tests/bees.nix @@ -8,7 +8,7 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: ${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux2 /dev/vdc ''; virtualisation.emptyDiskImages = [ 4096 4096 ]; - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/aux1" = { # filesystem configured to be deduplicated device = "/dev/disk/by-label/aux1"; fsType = "btrfs"; diff --git a/nixos/tests/fsck.nix b/nixos/tests/fsck.nix index e522419fde2..5453f3bc48b 100644 --- a/nixos/tests/fsck.nix +++ b/nixos/tests/fsck.nix @@ -4,7 +4,7 @@ import ./make-test-python.nix { machine = { lib, ... }: { virtualisation.emptyDiskImages = [ 1 ]; - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/mnt" = { device = "/dev/vdb"; fsType = "ext4"; diff --git a/nixos/tests/glusterfs.nix b/nixos/tests/glusterfs.nix index cb07bc09511..ef09264a021 100644 --- a/nixos/tests/glusterfs.nix +++ b/nixos/tests/glusterfs.nix @@ -3,7 +3,7 @@ import ./make-test-python.nix ({pkgs, lib, ...}: let client = { pkgs, ... } : { environment.systemPackages = [ pkgs.glusterfs ]; - fileSystems = pkgs.lib.mkVMOverride + virtualisation.fileSystems = { "/gluster" = { device = "server1:/gv0"; fsType = "glusterfs"; @@ -22,7 +22,7 @@ let virtualisation.emptyDiskImages = [ 1024 ]; - fileSystems = pkgs.lib.mkVMOverride + virtualisation.fileSystems = { "/data" = { device = "/dev/disk/by-label/data"; fsType = "ext4"; diff --git a/nixos/tests/hardened.nix b/nixos/tests/hardened.nix index d3f1f317296..0c26eaa310d 100644 --- a/nixos/tests/hardened.nix +++ b/nixos/tests/hardened.nix @@ -18,7 +18,7 @@ import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... } : { boot.initrd.postDeviceCommands = '' ${pkgs.dosfstools}/bin/mkfs.vfat -n EFISYS /dev/vdb ''; - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/efi" = { device = "/dev/disk/by-label/EFISYS"; fsType = "vfat"; diff --git a/nixos/tests/locate.nix b/nixos/tests/locate.nix index 67ae610fe01..e8ba41812a8 100644 --- a/nixos/tests/locate.nix +++ b/nixos/tests/locate.nix @@ -7,7 +7,7 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: nodes = rec { a = { environment.systemPackages = with pkgs; [ sshfs ]; - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/ssh" = { device = "alice@b:/"; fsType = "fuse.sshfs"; diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix index fda2e60a41b..fb19b706056 100644 --- a/nixos/tests/misc.nix +++ b/nixos/tests/misc.nix @@ -16,7 +16,7 @@ import ./make-test-python.nix ({ pkgs, ...} : rec { environment.variables.EDITOR = mkOverride 0 "emacs"; documentation.nixos.enable = mkOverride 0 true; systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ]; - fileSystems = mkVMOverride { "/tmp2" = + virtualisation.fileSystems = { "/tmp2" = { fsType = "tmpfs"; options = [ "mode=1777" "noauto" ]; }; diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix index 90050447042..0b8e1937128 100644 --- a/nixos/tests/nextcloud/basic.nix +++ b/nixos/tests/nextcloud/basic.nix @@ -15,7 +15,7 @@ in { echo "http://nextcloud/remote.php/webdav/ ${adminuser} ${adminpass}" > /tmp/davfs2-secrets chmod 600 /tmp/davfs2-secrets ''; - fileSystems = pkgs.lib.mkVMOverride { + virtualisation.fileSystems = { "/mnt/dav" = { device = "http://nextcloud/remote.php/webdav/"; fsType = "davfs"; diff --git a/nixos/tests/nfs/kerberos.nix b/nixos/tests/nfs/kerberos.nix index 078f0b7814c..75d1210496b 100644 --- a/nixos/tests/nfs/kerberos.nix +++ b/nixos/tests/nfs/kerberos.nix @@ -40,7 +40,7 @@ in networking.domain = "nfs.test"; networking.hostName = "client"; - fileSystems = lib.mkVMOverride + virtualisation.fileSystems = { "/data" = { device = "server.nfs.test:/"; fsType = "nfs"; diff --git a/nixos/tests/nfs/simple.nix b/nixos/tests/nfs/simple.nix index 630c68a5b05..6a01089c082 100644 --- a/nixos/tests/nfs/simple.nix +++ b/nixos/tests/nfs/simple.nix @@ -4,7 +4,7 @@ let client = { pkgs, ... }: - { fileSystems = pkgs.lib.mkVMOverride + { virtualisation.fileSystems = { "/data" = { # nfs4 exports the export with fsid=0 as a virtual root directory device = if (version == 4) then "server:/" else "server:/data"; diff --git a/nixos/tests/orangefs.nix b/nixos/tests/orangefs.nix index 24b7737058c..fe9f9cc37ea 100644 --- a/nixos/tests/orangefs.nix +++ b/nixos/tests/orangefs.nix @@ -9,7 +9,7 @@ let virtualisation.emptyDiskImages = [ 4096 ]; - fileSystems = pkgs.lib.mkVMOverride + virtualisation.fileSystems = { "/data" = { device = "/dev/disk/by-label/data"; fsType = "ext4"; diff --git a/nixos/tests/samba.nix b/nixos/tests/samba.nix index 142269752b3..d1d50caabfa 100644 --- a/nixos/tests/samba.nix +++ b/nixos/tests/samba.nix @@ -8,7 +8,7 @@ import ./make-test-python.nix ({ pkgs, ... }: nodes = { client = { pkgs, ... }: - { fileSystems = pkgs.lib.mkVMOverride + { virtualisation.fileSystems = { "/public" = { fsType = "cifs"; device = "//server/public"; diff --git a/nixos/tests/snapper.nix b/nixos/tests/snapper.nix index 018102d7f64..098d8d9d72f 100644 --- a/nixos/tests/snapper.nix +++ b/nixos/tests/snapper.nix @@ -9,7 +9,7 @@ import ./make-test-python.nix ({ ... }: virtualisation.emptyDiskImages = [ 4096 ]; - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/home" = { device = "/dev/disk/by-label/aux"; fsType = "btrfs"; diff --git a/nixos/tests/systemd.nix b/nixos/tests/systemd.nix index f7c13a587c5..e0685f53a94 100644 --- a/nixos/tests/systemd.nix +++ b/nixos/tests/systemd.nix @@ -9,7 +9,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { environment.systemPackages = [ pkgs.cryptsetup ]; - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/test-x-initrd-mount" = { device = "/dev/vdb"; fsType = "ext2"; diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix index 03aa5e5399c..ba5eb7cd528 100644 --- a/nixos/tests/zfs.nix +++ b/nixos/tests/zfs.nix @@ -29,7 +29,7 @@ let # Setup regular fileSystems machinery to ensure forceImportAll can be # tested via the regular service units. - fileSystems = lib.mkVMOverride { + virtualisation.fileSystems = { "/forcepool" = { device = "forcepool"; fsType = "zfs";