From 6b82c5bb3cb9068e25132642b9a6ceba60956571 Mon Sep 17 00:00:00 2001 From: Curious Date: Wed, 27 May 2026 23:54:27 +0800 Subject: [PATCH 1/2] aerion: init at 0.3.2 --- pkgs/by-name/ae/aerion-creds/package.nix | 58 ++++++++++++++ pkgs/by-name/ae/aerion/package.nix | 98 ++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 pkgs/by-name/ae/aerion-creds/package.nix create mode 100644 pkgs/by-name/ae/aerion/package.nix diff --git a/pkgs/by-name/ae/aerion-creds/package.nix b/pkgs/by-name/ae/aerion-creds/package.nix new file mode 100644 index 000000000000..1a35d0db6abe --- /dev/null +++ b/pkgs/by-name/ae/aerion-creds/package.nix @@ -0,0 +1,58 @@ +{ + lib, + stdenv, + fetchurl, +}: + +let + version = "0.3.2"; + + archMap = { + "x86_64-linux" = "x86_64"; + "aarch64-linux" = "aarch64"; + }; + sysArch = + archMap.${stdenv.hostPlatform.system} + or (throw "Unsupported architecture: ${stdenv.hostPlatform.system}"); + + shimHashes = { + "x86_64" = "sha256-8WvuQgWTJNe4UpmS6uSYDYm46sIqxJbwVZ/J3CRz0OI="; + "aarch64" = "sha256-4RvFbxJGwM70huziY2ELoCouTrtMasgoqFUncBeBFvU="; + }; +in +stdenv.mkDerivation { + pname = "aerion-creds"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchurl { + url = "https://github.com/hkdb/aerion/releases/download/v${version}/flathub-build-env-v${version}-linux-${sysArch}"; + hash = shimHashes.${sysArch}; + }; + + dontUnpack = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp $src $out/bin/aerion-creds + chmod +x $out/bin/aerion-creds + + runHook postInstall + ''; + + meta = { + description = "OAuth credentials shim for Aerion"; + homepage = "https://github.com/hkdb/aerion"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ curious ]; + platforms = [ + "x86_64-linux" + "aarch64-linux" + ]; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + }; +} diff --git a/pkgs/by-name/ae/aerion/package.nix b/pkgs/by-name/ae/aerion/package.nix new file mode 100644 index 000000000000..9b878de5518b --- /dev/null +++ b/pkgs/by-name/ae/aerion/package.nix @@ -0,0 +1,98 @@ +{ + lib, + stdenv, + buildGoModule, + buildNpmPackage, + fetchFromGitHub, + pkg-config, + wrapGAppsHook3, + gtk3, + webkitgtk_4_1, + glib, + + aerion-creds, + withOAuth ? false, +}: + +let + version = "0.3.2"; + + src = fetchFromGitHub { + owner = "hkdb"; + repo = "aerion"; + rev = "v${version}"; + hash = "sha256-elmk4huz4mvc7t+5/ZM5AK2R4pSKrLsZM0HxWFmQldE="; + }; + + frontend = buildNpmPackage { + pname = "aerion-frontend"; + inherit version src; + + sourceRoot = "${src.name}/frontend"; + + npmDepsHash = "sha256-dC+xGwSqdzItIfDipAVIVnbUJHiFkmzanjV/5xFsbkc="; + + buildPhase = '' + npm run build + ''; + + installPhase = '' + mkdir -p $out + cp -r dist/* $out/ + ''; + }; + +in +buildGoModule { + pname = "aerion"; + inherit version src; + + __structuredAttrs = true; + + vendorHash = "sha256-ptsrOpJo3i+yRSCGuHynbzi+C+GD/mBmPuHqWSVV/+4="; + + nativeBuildInputs = [ + pkg-config + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + wrapGAppsHook3 + ]; + + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + gtk3 + webkitgtk_4_1 + glib + ]; + + tags = [ + "production" + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + "desktop" + "webkit2_41" + ]; + + preBuild = '' + mkdir -p frontend/dist + cp -r ${frontend}/* frontend/dist/ + ''; + + postInstall = lib.optionalString stdenv.hostPlatform.isLinux ( + '' + install -Dm644 build/linux/aerion.png $out/share/pixmaps/io.github.hkdb.Aerion.png + install -Dm644 build/linux/aerion.desktop $out/share/applications/io.github.hkdb.Aerion.desktop + '' + + lib.optionalString withOAuth '' + rm -f $out/bin/aerion-creds + ln -s ${aerion-creds}/bin/aerion-creds $out/bin/aerion-creds + '' + ); + + meta = { + description = "An Open Source Lightweight E-Mail Client"; + homepage = "https://github.com/hkdb/aerion"; + license = lib.licenses.asl20; + mainProgram = "aerion"; + maintainers = with lib.maintainers; [ curious ]; + }; +} From 6f542178213c3834d589f6493e718d37d55dcf24 Mon Sep 17 00:00:00 2001 From: Curious Date: Sun, 19 Jul 2026 20:31:17 +0800 Subject: [PATCH 2/2] aerion: add update.sh --- pkgs/by-name/ae/aerion/package.nix | 5 +++++ pkgs/by-name/ae/aerion/update.sh | 33 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 pkgs/by-name/ae/aerion/update.sh diff --git a/pkgs/by-name/ae/aerion/package.nix b/pkgs/by-name/ae/aerion/package.nix index 9b878de5518b..d4325f5ce8b6 100644 --- a/pkgs/by-name/ae/aerion/package.nix +++ b/pkgs/by-name/ae/aerion/package.nix @@ -88,6 +88,11 @@ buildGoModule { '' ); + passthru = { + inherit frontend; + updateScript = ./update.sh; + }; + meta = { description = "An Open Source Lightweight E-Mail Client"; homepage = "https://github.com/hkdb/aerion"; diff --git a/pkgs/by-name/ae/aerion/update.sh b/pkgs/by-name/ae/aerion/update.sh new file mode 100755 index 000000000000..b07f4e73f5ed --- /dev/null +++ b/pkgs/by-name/ae/aerion/update.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p nix nix-update nix-prefetch-scripts common-updater-scripts + +set -euo pipefail + +nixpkgs="$(git rev-parse --show-toplevel)" +aerion_creds_file="$nixpkgs/pkgs/by-name/ae/aerion-creds/package.nix" + +version=$(list-git-tags --url=https://github.com/hkdb/aerion \ + | grep -oP '^v\d+\.\d+\.\d+$' \ + | sed 's/^v//' \ + | sort -V \ + | tail -1) + +echo "Updating aerion and aerion-creds to v$version" + +# Update version in creds file +sed -i "s/version = \".*\";/version = \"$version\";/" "$aerion_creds_file" + +# Update creds binary hashes +for arch in x86_64 aarch64; do + url="https://github.com/hkdb/aerion/releases/download/v$version/flathub-build-env-v$version-linux-$arch" + echo " Fetching creds hash for $arch..." + hash=$(nix-prefetch-url --type sha256 "$url") + sri_hash=$(nix-hash --to-sri --type sha256 "$hash") + sed -i "s|\"$arch\" = \"sha256-[^\"]*\";|\"$arch\" = \"$sri_hash\";|" "$aerion_creds_file" +done + +# Update main package (handles version, source hash, npmDepsHash, vendorHash) +cd "$nixpkgs" +nix-update --version="$version" --subpackage frontend aerion + +echo "Done!"