Merge pull request #112746 from mkg20001/qemu-extra-disks

This commit is contained in:
Maciej Krüger 2021-02-14 13:20:44 +01:00 committed by GitHub
commit 8429831b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 19 additions and 16 deletions

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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" ];
};

View File

@ -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";

View File

@ -40,7 +40,7 @@ in
networking.domain = "nfs.test";
networking.hostName = "client";
fileSystems = lib.mkVMOverride
virtualisation.fileSystems =
{ "/data" = {
device = "server.nfs.test:/";
fsType = "nfs";

View File

@ -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";

View File

@ -9,7 +9,7 @@ let
virtualisation.emptyDiskImages = [ 4096 ];
fileSystems = pkgs.lib.mkVMOverride
virtualisation.fileSystems =
{ "/data" =
{ device = "/dev/disk/by-label/data";
fsType = "ext4";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";