Commit 2c678667 authored by nayeko's avatar nayeko
Browse files

gopeed: 1.6.6 -> 1.6.8

parent daa72ff3
Loading
Loading
Loading
Loading
+55 −46
Original line number Diff line number Diff line
{
  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
  ];
  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;
  };

  buildInputs = [
    libayatana-appindicator
    libayatana-indicator
    libdbusmenu
    ayatana-ido
  ];
  libgopeed = buildGoModule {
    inherit version src;
    pname = "libgopeed";

  installPhase = ''
    runHook preInstall
    vendorHash = "sha256-rJriTQF4tf7sZXcEDS6yZXk3xUI8Cav8OC7o4egpfIw=";

    mkdir $out
    cp -r opt $out/app
    cp -r usr/share $out/share
    buildPhase = ''
      runHook preBuild

    runHook postInstall
      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
    '';

  dontWrapGApps = true;
    meta = metaCommon;
  };
in
flutter324.buildFlutterApplication {
  inherit version src libgopeed;
  pname = "gopeed";

  sourceRoot = "${src.name}/ui/flutter";

  preFixup = ''
    makeWrapper $out/app/gopeed/gopeed $out/bin/gopeed \
      "''${gappsWrapperArgs[@]}" \
      --prefix PATH : ${lib.makeBinPath [ zenity ]}
  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
  '';

  meta = {
    homepage = "https://gopeed.com";
    description = "Modern download manager that supports all platforms. Built with Golang and Flutter";
  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
  '';

  meta = metaCommon // {
    mainProgram = "gopeed";
    platforms = [ "x86_64-linux" ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    license = with lib.licenses; [ gpl3Plus ];
    maintainers = with lib.maintainers; [ ];
  };
}
+1735 −0

File added.

Preview size limit exceeded, changes collapsed.