diff --git a/pkgs/by-name/ty/typora/package.nix b/pkgs/by-name/ty/typora/package.nix index 9cf0bde5ae6c..4a87315d3a67 100644 --- a/pkgs/by-name/ty/typora/package.nix +++ b/pkgs/by-name/ty/typora/package.nix @@ -22,14 +22,27 @@ let pname = "typora"; - version = "1.11.5"; - src = fetchurl { - urls = [ - "https://download.typora.io/linux/typora_${version}_amd64.deb" - "https://downloads.typoraio.cn/linux/typora_${version}_amd64.deb" - ]; - hash = "sha256-CpUF8pRLzR3RzFD85Cobbmo3BInaeCee0NWKsmelPGs="; - }; + version = "1.12.2"; + + src = + fetchurl + { + x86_64-linux = { + urls = [ + "https://download.typora.io/linux/typora_${version}_amd64.deb" + "https://downloads.typoraio.cn/linux/typora_${version}_amd64.deb" + ]; + hash = "sha256-g5GB4hc1cphnOXcVV+YR+YULJOzWAslio3yXjW9MGOk="; + }; + aarch64-linux = { + urls = [ + "https://download.typora.io/linux/typora_${version}_arm64.deb" + "https://downloads.typoraio.cn/linux/typora_${version}_arm64.deb" + ]; + hash = "sha256-br9kn3P4Pzbef6u581YcX8c0uiB/c1pKqGogLX3sruw="; + }; + } + .${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); typoraBase = stdenv.mkDerivation { inherit pname version src; @@ -116,7 +129,7 @@ let in stdenv.mkDerivation { - inherit pname version; + inherit pname version src; dontUnpack = true; dontConfigure = true; @@ -132,11 +145,17 @@ stdenv.mkDerivation { runHook postInstall ''; + passthru.updateScript = ./update.sh; + meta = { description = "A minimal Markdown editor and reader."; homepage = "https://typora.io/"; + changelog = "https://typora.io/releases/all"; license = lib.licenses.unfree; - maintainers = with lib.maintainers; [ npulidomateo ]; + maintainers = with lib.maintainers; [ + npulidomateo + chillcicada + ]; platforms = [ "x86_64-linux" ]; mainProgram = "typora"; }; diff --git a/pkgs/by-name/ty/typora/update.sh b/pkgs/by-name/ty/typora/update.sh new file mode 100755 index 000000000000..21f2c63395c8 --- /dev/null +++ b/pkgs/by-name/ty/typora/update.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl common-updater-scripts + +set -euo pipefail + +version=$(curl -s "https://typora.io/#linux" | sed -E -n 's/.*typora_([0-9.]+)_amd64.*/\1/p') + +amd64_hash=$(nix-hash --type sha256 --to-sri $(nix-prefetch-url https://download.typora.io/linux/typora_${version}_amd64.deb)) +update-source-version typora $version $amd64_hash --system=x86_64-linux --ignore-same-version + +arm64_hash=$(nix-hash --type sha256 --to-sri $(nix-prefetch-url https://download.typora.io/linux/typora_${version}_arm64.deb)) +update-source-version typora $version $arm64_hash --system=aarch64-linux --ignore-same-version