anchor.diff: -{ fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg }:
  +{ fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg, zstd }:
   
   let
     pname = "anki-bin";
     # Update hashes for both Linux and Darwin!
  -  version = "2.1.49";
  +  version = "2.1.51";
   
     sources = {
       linux = fetchurl {
  -      url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux.tar.bz2";
  -      sha256 = "sha256-uG39g9CXnquArFsxtFHWWoDaNwu8y2KKh+SqGt8aqi0=";
  +      url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
  +      sha256 = "sha256-ZKVc+TvkNu5mGgibhRIuoLuIfvyoVDy+c4h+Apz9P+0=";
       };
  -    darwin = fetchurl {
  -      url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac.dmg";
  -      sha256 = "sha256-sEVWZQpICL7RYrOuPm1Y5XhzPxCwNk1WGP1rctTtE4Y=";
  +
  +    # For some reason anki distributes completely separate dmg-files for the aarch64 version and the x86_64 version
  +    darwin-x86_64 = fetchurl {
  +      url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-intel-qt6.dmg";
  +      sha256 = "sha256-wZMJEbcpezVAuBSKlwNTHlqjp0FfmyDB7XD6BBuJhyA=";
  +    };
  +    darwin-aarch64 = fetchurl {
  +      url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-apple-qt6.dmg";
  +      sha256 = "sha256-6RDTYKoisX5DJ9VPWrP9VH9DCABabb9MB3nG4S8jtR0=";
       };
     };
   
     unpacked = stdenv.mkDerivation {
       inherit pname version;
   
  +    nativeBuildInputs = [ zstd ];
       src = sources.linux;
   
       installPhase = ''
  
positive.code: }) else stdenv.mkDerivation {
    inherit pname version passthru;
  
    src = sources.darwin;
  
    nativeBuildInputs = [ undmg ];
    sourceRoot = ".";
  
negative.code: if stdenv.isLinux then buildFHSUserEnv (appimageTools.defaultFhsEnvArgs // {
    name = "anki";
  
    # Dependencies of anki
    targetPkgs = pkgs: (with pkgs; [ xorg.libxkbfile krb5 ]);
  
    runScript = writeShellScript "anki-wrapper.sh" ''
      exec ${unpacked}/bin/anki
    '';
  