From b75d15a9a88c5f8e31d1c91d44cbaaf00e3bb8f2 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Fri, 16 Apr 2010 15:09:47 +0000 Subject: [PATCH] virtualisation: add option to switch off readonly host fs in vm svn path=/nixos/trunk/; revision=21126 --- lib/testing.nix | 1 + modules/virtualisation/qemu-vm.nix | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/testing.nix b/lib/testing.nix index ca0b7297251..392ae8ca9b0 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -145,6 +145,7 @@ rec { { config, pkgs, ... }: { virtualisation.memorySize = 1024; + virtualisation.readonlyHostFS = false; services.xserver.enable = true; services.xserver.displayManager.slim.enable = false; services.xserver.displayManager.auto.enable = true; diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index a17e167cb46..c8b45f86b82 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -60,6 +60,15 @@ let ''; }; + virtualisation.readonlyHostFS = + mkOption { + default = true; + description = + '' + Whether to mount the hostfs read-only. + ''; + }; + }; cfg = config.virtualisation; @@ -163,7 +172,7 @@ in { mountPoint = "/hostfs"; device = "//10.0.2.4/qemu"; fsType = "cifs"; - options = "guest,username=nobody,noperm"; + options = "guest,username=nobody${if config.virtualisation.readonlyHostFS then ",noperm" else ""}"; neededForBoot = true; } { mountPoint = "/nix/store";