anchor.diff:  with lib;
   
   let
  -  extensions = {
  +  filename = "nixos." + {
       qcow2 = "qcow2";
       vpc   = "vhd";
       raw   = "img";
  -  };
  +  }.${format};
   
     nixpkgs = cleanSource pkgs.path;
   
  
positive.code:     fakeroot nixos-prepare-root $root ${channelSources} ${config.system.build.toplevel} closure
  
      echo "copying staging root to image..."
      cptofs ${pkgs.lib.optionalString partitioned "-P 1"} -t ${fsType} -i $diskImage $root/* /
    '';
  in pkgs.vmTools.runInLinuxVM (
    pkgs.runCommand name
  
negative.code:       exportReferencesGraph = [ "closure" metaClosure ];
        postVM = ''
          ${if format == "raw" then ''
            mv $diskImage $out/${filename}
          '' else ''
            ${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/${filename}
          ''}
          diskImage=$out/${filename}
          ${postVM}
        '';
        memSize = 1024;
  