aerion: init at 0.3.2 (#521267)

This commit is contained in:
Jonas Heinrich
2026-07-21 08:49:25 +00:00
committed by GitHub
3 changed files with 194 additions and 0 deletions

View File

@@ -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 ];
};
}

View File

@@ -0,0 +1,103 @@
{
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
''
);
passthru = {
inherit frontend;
updateScript = ./update.sh;
};
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 ];
};
}

View File

@@ -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!"