Merge pull request #260279 from autrimpo/multiarch-ferdium
ferdium: add aarch64-linux
This commit is contained in:
@@ -1,20 +1,27 @@
|
||||
{ lib, mkFranzDerivation, fetchurl, xorg, nix-update-script }:
|
||||
{ lib, mkFranzDerivation, fetchurl, xorg, nix-update-script, stdenv }:
|
||||
|
||||
mkFranzDerivation rec {
|
||||
let
|
||||
arch = {
|
||||
x86_64-linux = "amd64";
|
||||
aarch64-linux = "arm64";
|
||||
}."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
hash = {
|
||||
amd64-linux_hash = "sha256-Oai5z6/CE/R2rH9LBVhY7eaKpF8eIIYI+3vjJPbq+rw=";
|
||||
arm64-linux_hash = "sha256-bRJTktwnyZgCow8oRZNhTK8FgOhIcjrbESVlYfeaa8E=";
|
||||
}."${arch}-linux_hash";
|
||||
in mkFranzDerivation rec {
|
||||
pname = "ferdium";
|
||||
name = "Ferdium";
|
||||
version = "6.4.1";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/ferdium/ferdium-app/releases/download/v${version}/Ferdium-linux-${version}-amd64.deb";
|
||||
hash = "sha256-Oai5z6/CE/R2rH9LBVhY7eaKpF8eIIYI+3vjJPbq+rw=";
|
||||
url = "https://github.com/ferdium/ferdium-app/releases/download/v${version}/Ferdium-linux-${version}-${arch}.deb";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
extraBuildInputs = [ xorg.libxshmfence ];
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [ "--override-filename" ./default.nix ];
|
||||
};
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
@@ -22,7 +29,7 @@ mkFranzDerivation rec {
|
||||
homepage = "https://ferdium.org/";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ magnouvean ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
hydraPlatforms = [ ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused nix-prefetch jq
|
||||
|
||||
set -e
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
|
||||
updateHash()
|
||||
{
|
||||
version=$1
|
||||
arch=$2
|
||||
|
||||
hashKey="${arch}-linux_hash"
|
||||
|
||||
url="https://github.com/ferdium/ferdium-app/releases/download/v$version/Ferdium-linux-$version-$arch.deb"
|
||||
hash=$(nix-prefetch-url --type sha256 $url)
|
||||
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
||||
|
||||
sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
|
||||
}
|
||||
|
||||
updateVersion()
|
||||
{
|
||||
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
|
||||
}
|
||||
|
||||
currentVersion=$(cd $dirname && nix eval --raw -f ../../../../.. ferdium.version)
|
||||
|
||||
latestTag=$(curl https://api.github.com/repos/ferdium/ferdium-app/releases/latest | jq -r ".tag_name")
|
||||
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
||||
|
||||
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "Ferdium is up-to-date: ${currentVersion}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
updateVersion $latestVersion
|
||||
|
||||
updateHash $latestVersion amd64
|
||||
updateHash $latestVersion arm64
|
||||
Reference in New Issue
Block a user