diff --git a/pkgs/by-name/or/orion-browser/package.nix b/pkgs/by-name/or/orion-browser/package.nix new file mode 100644 index 000000000000..280e11396949 --- /dev/null +++ b/pkgs/by-name/or/orion-browser/package.nix @@ -0,0 +1,52 @@ +{ + lib, + stdenvNoCC, + fetchurl, + makeWrapper, + unzip, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "orion-browser"; + version = "149"; + + src = fetchurl { + url = "https://cdn.kagi.com/updates/26_0/${finalAttrs.version}.zip"; + hash = "sha256-C0mtGNE9Or0alFe2Gu4LkRcHMvk1RLXZ/mUo/XtWB2g="; + }; + + strictDeps = true; + __structuredAttrs = true; + + unpackCmd = "unzip -q $curSrc -x '__MACOSX/*'"; + + nativeBuildInputs = [ + makeWrapper + unzip + ]; + + sourceRoot = "."; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/Applications" "$out/bin" + cp -R Orion.app "$out/Applications" + makeWrapper "$out/Applications/Orion.app/Contents/MacOS/Orion" "$out/bin/orion" + + runHook postInstall + ''; + + passthru.updateScript = ./update.sh; + + meta = { + description = "WebKit-based web browser by Kagi"; + homepage = "https://orionbrowser.com/"; + changelog = "https://orionbrowser.com/updates/orion-release-notes"; + license = lib.licenses.unfree; + mainProgram = "orion"; + maintainers = with lib.maintainers; [ pradyuman ]; + platforms = [ "aarch64-darwin" ]; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + }; +}) diff --git a/pkgs/by-name/or/orion-browser/update.sh b/pkgs/by-name/or/orion-browser/update.sh new file mode 100755 index 000000000000..d362428fd5c5 --- /dev/null +++ b/pkgs/by-name/or/orion-browser/update.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env nix +#!nix shell -f ```` curl jq libplist _7zz common-updater-scripts -c bash + +set -euo pipefail + +macos_version="26_0" + +tmpdir="$(mktemp -d)" +trap 'rm -rf "$tmpdir"' EXIT + +dmg="$tmpdir/Orion.dmg" +curl -fsSL -o "$dmg" "https://cdn.kagi.com/downloads/$macos_version/Orion.dmg" +version="$( + 7zz e -so "$dmg" "Orion/Orion.app/Contents/Info.plist" \ + | plistutil -i - -f json -o - \ + | jq -r '.CFBundleVersion' +)" + +if [[ -z "$version" ]]; then + echo "[update] Failed to read Orion version from Info.plist" >&2 + exit 1 +fi + +zip="$tmpdir/Orion.zip" +curl -fsSL -o "$zip" "https://cdn.kagi.com/updates/$macos_version/$version.zip" +hash="$(nix hash file --type sha256 --sri "$zip")" + +update-source-version orion-browser "$version" "$hash"