anchor.diff:          set -o errexit
           set -o nounset
           set -o pipefail
  -        
  +
           # reset version first so that both platforms are always updated and in sync
           update-source-version libreoffice 0 ${nullHash} --system=aarch64-darwin
           update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --system=aarch64-darwin
  
positive.code: { stdenv
  , lib
  , fetchurl
  , undmg
  
negative.code:     };
    };
  in
  stdenvNoCC.mkDerivation {
    inherit version;
    pname = "libreoffice";
    src = fetchurl {
      inherit (dist.${stdenvNoCC.hostPlatform.system} or
        (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}")) url sha256;
    };
  
    nativeBuildInputs = [ undmg ];
    sourceRoot = "${appName}";
  
    installPhase = ''
      runHook preInstall
      mkdir -p $out/{Applications/${appName},bin}
      cp -R . $out/Applications/${appName}
      cat > $out/bin/${scriptName} << EOF
      #!${stdenvNoCC.shell}
      open -na $out/Applications/${appName} --args "$@"
      EOF
      chmod +x $out/bin/${scriptName}
      runHook postInstall
    '';
  
    passthru.updateScript =
  