Author: sandervanderburg
Date: Sat Oct 16 17:22:39 2010
New Revision: 24321
URL: https://svn.nixos.org/websvn/nix/?rev=24321&sc=1

Log:
Stealing write support from NixOS' qemu-vm.nix and some fixes to disnix-vm-env 
working again

Modified:
   disnix/disnix-vm-addons/trunk/data/qemu-vm.nix
   disnix/disnix-vm-addons/trunk/scripts/disnix-backdoor-client.in

Modified: disnix/disnix-vm-addons/trunk/data/qemu-vm.nix
==============================================================================
--- disnix/disnix-vm-addons/trunk/data/qemu-vm.nix      Sat Oct 16 15:23:02 
2010        (r24320)
+++ disnix/disnix-vm-addons/trunk/data/qemu-vm.nix      Sat Oct 16 17:22:39 
2010        (r24321)
@@ -99,7 +99,17 @@
         example = "-vga std";
         description = "Options passed to QEMU.";
       };
-      
+    
+    virtualisation.writableStore = 
+      mkOption {
+        default = true;
+        description =
+          ''
+            If enabled, the Nix store in the VM is made writable by
+            layering an AUFS/tmpfs filesystem on top of the host's Nix
+            store.
+          '';
+      };
   };
 
   cfg = config.virtualisation;
@@ -154,7 +164,11 @@
   # CIFS.  Also use paravirtualised network and block devices for
   # performance.
   boot.initrd.availableKernelModules =
-    [ "cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" 
"nls_utf8" ];
+    [ "cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" 
"nls_utf8" ]
+    ++ optional cfg.writableStore [ "aufs" ];
+
+  boot.extraModulePackages =
+    optional cfg.writableStore config.boot.kernelPackages.aufs2;
 
   boot.initrd.extraUtilsCommands =
     ''
@@ -194,7 +208,18 @@
         ${config.environment.nix}/bin/nix-store --load-db < $regInfo
       )
     '';
-      
+
+  boot.initrd.postMountCommands =
+    ''
+      mkdir -p $targetRoot/boot
+      mount -o remount,ro $targetRoot/nix/store
+      ${optionalString cfg.writableStore ''
+        mkdir /mnt-store-tmpfs
+        mount -t tmpfs -o "mode=755" none /mnt-store-tmpfs
+        mount -t aufs -o dirs=/mnt-store-tmpfs=rw:$targetRoot/nix/store=rr 
none $targetRoot/nix/store
+      ''}
+    '';
+
   virtualisation.pathsInNixDB = [ config.system.build.toplevel ];
   
   # Mount the host filesystem via CIFS, and bind-mount the Nix store

Modified: disnix/disnix-vm-addons/trunk/scripts/disnix-backdoor-client.in
==============================================================================
--- disnix/disnix-vm-addons/trunk/scripts/disnix-backdoor-client.in     Sat Oct 
16 15:23:02 2010        (r24320)
+++ disnix/disnix-vm-addons/trunk/scripts/disnix-backdoor-client.in     Sat Oct 
16 17:22:39 2010        (r24321)
@@ -164,12 +164,12 @@
        exit $exitStatus
         ;;
     set)
-       outputFile=$(mktemp -p $TMPDIR)
-        echo "disnix-client $profileArg --set $@; echo \$?" | socat stdio 
$socketFile > $outputFile
-       exitStatus=$(tail -1 $outputFile)
-       head -n -1 $outputFile
-       rm -f $outputFile
-       exit $exitStatus
+       #outputFile=$(mktemp -p $TMPDIR)
+        #echo "disnix-client $profileArg --set $@; echo \$?" | socat stdio 
$socketFile > $outputFile
+       #exitStatus=$(tail -1 $outputFile)
+       #head -n -1 $outputFile
+       #rm -f $outputFile
+       #exit $exitStatus
         ;;
     query-installed)
        outputFile=$(mktemp -p $TMPDIR)
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to