anchor.diff:  , e2fsprogs
   , libfaketime
   , perl
  +, lkl
   }:
   
   let
  
positive.code: pkgs.stdenv.mkDerivation {
    name = "ext4-fs.img";
  
    nativeBuildInputs = [e2fsprogs.bin libfaketime perl];
  
    buildCommand =
      ''
        # Add the closures of the top-level store objects.
        storePaths=$(cat ${sdClosureInfo}/store-paths)
  
        # Also include a manifest of the closures in a format suitable for nix-store --load-db.
        cp ${sdClosureInfo}/registration nix-path-registration
  
        # Make a crude approximation of the size of the target image.
        # If the script starts failing, increase the fudge factors here.
  
negative.code:       truncate -s $bytes $out
        faketime -f "1970-01-01 00:00:01" mkfs.ext4 -L ${volumeLabel} -U ${uuid} $out
  
        # Also include a manifest of the closures in a format suitable for nix-store --load-db.
        cp ${sdClosureInfo}/registration nix-path-registration
        cptofs -t ext4 -i $out nix-path-registration /
  
        # Create nix/store before copying paths
        faketime -f "1970-01-01 00:00:01" mkdir -p nix/store
        cptofs -t ext4 -i $out nix /
  
        echo "copying store paths to image..."
        cptofs -t ext4 -i $out $storePaths /nix/store/
  
        # I have ended up with corrupted images sometimes, I suspect that happens when the build machine's disk gets full during the build.
        if ! fsck.ext4 -n -f $out; then
  