standardnotes: 3.23.69 -> 3.129.0
- add updater script - move source urls and hashes to separate json file - add support for linux-aarch64
This commit is contained in:
parent
244d1ad6c9
commit
318177054b
@ -1,26 +1,14 @@
|
||||
{ lib, stdenv, appimageTools, autoPatchelfHook, desktop-file-utils
|
||||
{ callPackage, lib, stdenv, appimageTools, autoPatchelfHook, desktop-file-utils
|
||||
, fetchurl, libsecret }:
|
||||
|
||||
let
|
||||
version = "3.23.69";
|
||||
srcjson = builtins.fromJSON (builtins.readFile ./src.json);
|
||||
version = srcjson.version;
|
||||
pname = "standardnotes";
|
||||
name = "${pname}-${version}";
|
||||
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
||||
|
||||
plat = {
|
||||
i686-linux = "i386";
|
||||
x86_64-linux = "x86_64";
|
||||
}.${stdenv.hostPlatform.system} or throwSystem;
|
||||
|
||||
sha256 = {
|
||||
i686-linux = "sha256-/A2LjV8ky20bcKgs0ijwldryi5VkyROwz49vWYXYQus=";
|
||||
x86_64-linux = "sha256-fA9WH9qUtvAHF9hTFRtxQdpz2dpK0joD0zX9VYBo10g=";
|
||||
}.${stdenv.hostPlatform.system} or throwSystem;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/standardnotes/app/releases/download/%40standardnotes%2Fdesktop%40${version}/standard-notes-${version}-linux-${plat}.AppImage";
|
||||
inherit sha256;
|
||||
};
|
||||
src = fetchurl (srcjson.appimage.${stdenv.hostPlatform.system} or throwSystem);
|
||||
|
||||
appimageContents = appimageTools.extract {
|
||||
inherit name src;
|
||||
@ -47,6 +35,8 @@ in appimageTools.wrapType2 rec {
|
||||
ln -s ${appimageContents}/usr/share/icons share
|
||||
'';
|
||||
|
||||
passthru.updateScript = callPackage ./update.nix {};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A simple and private notes app";
|
||||
longDescription = ''
|
||||
@ -55,8 +45,8 @@ in appimageTools.wrapType2 rec {
|
||||
'';
|
||||
homepage = "https://standardnotes.org";
|
||||
license = licenses.agpl3;
|
||||
maintainers = with maintainers; [ mgregoire chuangzhu ];
|
||||
maintainers = with maintainers; [ mgregoire chuangzhu squalus ];
|
||||
sourceProvenance = [ sourceTypes.binaryNativeCode ];
|
||||
platforms = [ "i686-linux" "x86_64-linux" ];
|
||||
platforms = builtins.attrNames srcjson.appimage;
|
||||
};
|
||||
}
|
||||
|
17
pkgs/applications/editors/standardnotes/src.json
Normal file
17
pkgs/applications/editors/standardnotes/src.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": "3.129.0",
|
||||
"appimage": {
|
||||
"x86_64-linux": {
|
||||
"url": "https://github.com/standardnotes/app/releases/download/%40standardnotes/desktop%403.129.0/standard-notes-3.129.0-linux-x86_64.AppImage",
|
||||
"hash": "sha512-JLO2jX9Us6BjqmTZIkVyxy2pqFM/eFGpwi6vXicMOgDB0UsgEMTK+Ww+9g+vJ1KbFRFmlt187qkdSNcevQPt7w=="
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"url": "https://github.com/standardnotes/app/releases/download/%40standardnotes/desktop%403.129.0/standard-notes-3.129.0-linux-arm64.AppImage",
|
||||
"hash": "sha512-LGUSRqMrJ+hVHyi/bjI/NkWRVsmY0Kh/wRY9RNJXm0C3dKQSFV8ca4GeY9+VCuJEecR4LGnWp4agS5jPybPP6w=="
|
||||
},
|
||||
"i686-linux": {
|
||||
"url": "https://github.com/standardnotes/app/releases/download/%40standardnotes/desktop%403.129.0/standard-notes-3.129.0-linux-i386.AppImage",
|
||||
"hash": "sha512-XbQ4hn3QJ61hDC12cK95zsUowbyXPYArHZoRDx5trQ30phtQxtz6nV+pL00m4S9kYeEhsAwk1wXlRq9Ylbz2IA=="
|
||||
}
|
||||
}
|
||||
}
|
55
pkgs/applications/editors/standardnotes/update.nix
Normal file
55
pkgs/applications/editors/standardnotes/update.nix
Normal file
@ -0,0 +1,55 @@
|
||||
{ writeScript
|
||||
, lib, curl, runtimeShell, jq, coreutils, moreutils, nix, gnused }:
|
||||
|
||||
writeScript "update-standardnotes" ''
|
||||
#!${runtimeShell}
|
||||
PATH=${lib.makeBinPath [ jq curl nix coreutils moreutils gnused ]}
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
tmpDir=$(mktemp -d)
|
||||
srcJson=pkgs/applications/editors/standardnotes/src.json
|
||||
jsonPath="$tmpDir"/latest
|
||||
|
||||
oldVersion=$(jq -r .version < "$srcJson")
|
||||
|
||||
curl https://api.github.com/repos/standardnotes/app/releases/latest > "$jsonPath"
|
||||
|
||||
tagName=$(jq -r .tag_name < "$jsonPath")
|
||||
|
||||
if [[ ! "$tagName" =~ "desktop" ]]; then
|
||||
echo "latest release '$tagName' not a desktop release"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
newVersion=$(jq -r .tag_name < "$jsonPath" | sed s,@standardnotes/desktop@,,g)
|
||||
|
||||
if [[ "$oldVersion" == "$newVersion" ]]; then
|
||||
echo "version did not change"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
function getDownloadUrl() {
|
||||
jq -r ".assets[] | select(.name==\"standard-notes-$newVersion-$1.AppImage\") | .browser_download_url" < "$jsonPath"
|
||||
}
|
||||
|
||||
function setJsonKey() {
|
||||
jq "$1 = \"$2\"" "$srcJson" | sponge "$srcJson"
|
||||
}
|
||||
|
||||
function updatePlatform() {
|
||||
nixPlatform="$1"
|
||||
upstreamPlatform="$2"
|
||||
url=$(getDownloadUrl "$upstreamPlatform")
|
||||
hash=$(nix-prefetch-url "$url" --type sha512)
|
||||
sriHash=$(nix hash to-sri --type sha512 $hash)
|
||||
setJsonKey .appimage[\""$nixPlatform"\"].url "$url"
|
||||
setJsonKey .appimage[\""$nixPlatform"\"].hash "$sriHash"
|
||||
}
|
||||
|
||||
updatePlatform x86_64-linux linux-x86_64
|
||||
updatePlatform aarch64-linux linux-arm64
|
||||
updatePlatform i686-linux linux-i386
|
||||
setJsonKey .version "$newVersion"
|
||||
''
|
Loading…
Reference in New Issue
Block a user