anchor.diff:           (attrs: ((attrs.user  or null) == null)
                 == ((attrs.group or null) == null))
            contents;
  +assert onlyNixStore -> contents == [] && configFile == null && !installBootLoader;
   
   with lib;
   
  
positive.code:         tune2fs -T now -c 0 -i 0 $rootDisk
        ''}
      ''
  )
  
negative.code:     ''}
  
      echo "copying staging root to image..."
      cptofs -p ${optionalString (partitionTableType != "none") "-P ${rootPartition}"} \
             -t ${fsType} \
             -i $diskImage \
             $root${optionalString onlyNixStore builtins.storeDir}/* / ||
        (echo >&2 "ERROR: cptofs failed. diskSize might be too small for closure."; exit 1)
    '';
  
    moveOrConvertImage = ''
      ${if format == "raw" then ''
        mv $diskImage $out/${filename}
      '' else ''
        ${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} ${compress} $diskImage $out/${filename}
      ''}
      diskImage=$out/${filename}
    '';
  
    buildImage = pkgs.vmTools.runInLinuxVM (
      pkgs.runCommand name {
        preVM = prepareImage;
        buildInputs = with pkgs; [ util-linux e2fsprogs dosfstools ];
        postVM = moveOrConvertImage + postVM;
        memSize = 1024;
      } ''
        export PATH=${binPath}:$PATH
  
        rootDisk=${if partitionTableType != "none" then "/dev/vda${rootPartition}" else "/dev/vda"}
  