gopeed: 1.6.6 -> 1.6.8 and add update script (#378261)
This commit is contained in:
@@ -1,65 +1,76 @@
|
||||
{
|
||||
lib,
|
||||
fetchurl,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
flutter324,
|
||||
autoPatchelfHook,
|
||||
dpkg,
|
||||
makeWrapper,
|
||||
wrapGAppsHook3,
|
||||
buildGoModule,
|
||||
libayatana-appindicator,
|
||||
libayatana-indicator,
|
||||
libdbusmenu,
|
||||
ayatana-ido,
|
||||
zenity,
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "gopeed";
|
||||
version = "1.6.6";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/GopeedLab/gopeed/releases/download/v${version}/Gopeed-v${version}-linux-amd64.deb";
|
||||
hash = "sha256-Q2eCOah5Pz5kOiHjvB0CzC0iL8m4XAjAJzYxQ+YyBoY=";
|
||||
let
|
||||
version = "1.6.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "GopeedLab";
|
||||
repo = "gopeed";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-Z6t652m420FcCK4V9sG9I+Dzc2OTyXwWunBhVSreyac=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
dpkg
|
||||
autoPatchelfHook
|
||||
wrapGAppsHook3
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libayatana-appindicator
|
||||
libayatana-indicator
|
||||
libdbusmenu
|
||||
ayatana-ido
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir $out
|
||||
cp -r opt $out/app
|
||||
cp -r usr/share $out/share
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
preFixup = ''
|
||||
makeWrapper $out/app/gopeed/gopeed $out/bin/gopeed \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--prefix PATH : ${lib.makeBinPath [ zenity ]}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://gopeed.com";
|
||||
description = "Modern download manager that supports all platforms. Built with Golang and Flutter";
|
||||
mainProgram = "gopeed";
|
||||
platforms = [ "x86_64-linux" ];
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
metaCommon = {
|
||||
description = "Modern download manager that supports all platforms";
|
||||
homepage = "https://github.com/GopeedLab/gopeed";
|
||||
license = with lib.licenses; [ gpl3Plus ];
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
|
||||
libgopeed = buildGoModule {
|
||||
inherit version src;
|
||||
pname = "libgopeed";
|
||||
|
||||
vendorHash = "sha256-rJriTQF4tf7sZXcEDS6yZXk3xUI8Cav8OC7o4egpfIw=";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir -p $out/lib
|
||||
go build -tags nosqlite -ldflags="-w -s -X github.com/GopeedLab/gopeed/pkg/base.Version=v${version}" -buildmode=c-shared -o $out/lib/libgopeed.so github.com/GopeedLab/gopeed/bind/desktop
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
meta = metaCommon;
|
||||
};
|
||||
in
|
||||
flutter324.buildFlutterApplication {
|
||||
inherit version src libgopeed;
|
||||
pname = "gopeed";
|
||||
|
||||
sourceRoot = "${src.name}/ui/flutter";
|
||||
|
||||
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
||||
|
||||
gitHashes.permission_handler_windows = "sha256-MRTmuH0MfhGaMEb9bRotimAPRlFyl3ovtJUJ2WK7+DA=";
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
|
||||
buildInputs = [ libayatana-appindicator ];
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p linux/bundle/lib
|
||||
cp ${libgopeed}/lib/libgopeed.so linux/bundle/lib/libgopeed.so
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -Dm644 linux/assets/com.gopeed.Gopeed.desktop $out/share/applications/gopeed.desktop
|
||||
install -Dm644 assets/icon/icon_512.png $out/share/icons/hicolor/512x512/apps/com.gopeed.Gopeed.png
|
||||
install -Dm644 assets/icon/icon_1024.png $out/share/icons/hicolor/1024x1024/apps/com.gopeed.Gopeed.png
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = metaCommon // {
|
||||
mainProgram = "gopeed";
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=./. -i bash -p curl gnused jq yq nix bash coreutils nix-update
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/GopeedLab/gopeed/releases/latest | jq --raw-output .tag_name)
|
||||
latestVersion=$(echo "$latestTag" | sed 's/^v//')
|
||||
|
||||
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; gopeed.version or (lib.getVersion gopeed)" | tr -d '"')
|
||||
|
||||
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "package is up-to-date: $currentVersion"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
nix-update gopeed.libgopeed
|
||||
|
||||
curl https://raw.githubusercontent.com/GopeedLab/gopeed/${latestTag}/ui/flutter/pubspec.lock | yq . >$ROOT/pubspec.lock.json
|
||||
Reference in New Issue
Block a user