2 # This needs to be a VM test because the FUSE kernel module can't be used inside of a derivation in the Nix sandbox.
3 # This test also exercises the LZFSE support in darling-dmg.
5 # The last kitty release which is stored on an HFS+ filesystem inside the disk image
6 test-dmg-file = pkgs.fetchurl {
7 url = "https://github.com/kovidgoyal/kitty/releases/download/v0.17.4/kitty-0.17.4.dmg";
8 hash = "sha256-m+c5s8fFrgUc0xQNI196WplYBZq9+lNgems5haZUdvA=";
13 meta.maintainers = with lib.maintainers; [ Luflosi ];
20 machine.succeed("mkdir mount-point")
21 machine.succeed("'${pkgs.darling-dmg}/bin/darling-dmg' '${test-dmg-file}' mount-point")
23 # Crude way to verify the contents
24 # Taken from https://stackoverflow.com/questions/545387/linux-compute-a-single-hash-for-a-given-folder-contents
25 # This could be improved. It does not check symlinks for example.
26 hash = machine.succeed("""
27 (find mount-point -type f -print0 | sort -z | xargs -0 sha256sum; \
28 find mount-point \( -type f -o -type d \) -print0 | sort -z | \
29 xargs -0 stat -c '%n %a') \
32 assert hash == "00e61c2ef171093fbf194e420c17bb84bcdb823238d70eb46e375bab2427cc21 -", f"The disk image contents differ from what was expected (was {hash})"