From 2bfec5238869d33e1f9b54f7eb5cbd94b59aa443 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 20 Jun 2019 23:56:06 +0200 Subject: [PATCH] patchwork: 3.11.4 -> 3.14.1 This updates patchwork from 3.11.4 to 3.14.1, and uses the appimageTools machinery to extract the AppImage instead of the wrapper used before. On top of that, we install a .desktop file, so its available from the application menu. --- .../networking/ssb/patchwork/default.nix | 65 ++++++++++--------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/pkgs/applications/networking/ssb/patchwork/default.nix b/pkgs/applications/networking/ssb/patchwork/default.nix index c8b8b5ef333c..40026275a1e3 100644 --- a/pkgs/applications/networking/ssb/patchwork/default.nix +++ b/pkgs/applications/networking/ssb/patchwork/default.nix @@ -1,46 +1,53 @@ -{ - stdenv, - appimage-run, - fetchurl, - runtimeShell, - gsettings-desktop-schemas, - gtk3, - gobject-introspection, - wrapGAppsHook, -}: +{ appimageTools, symlinkJoin, lib, fetchurl, makeDesktopItem }: -stdenv.mkDerivation rec { - # latest version that runs without errors - # https://github.com/ssbc/patchwork/issues/972 - version = "3.11.4"; +let pname = "patchwork"; + version = "3.14.1"; + name = "${pname}-${version}"; src = fetchurl { - url = "https://github.com/ssbc/patchwork/releases/download/v${version}/Patchwork-${version}-linux-x86_64.AppImage"; - sha256 = "1blsprpkvm0ws9b96gb36f0rbf8f5jgmw4x6dsb1kswr4ysf591s"; + url = "https://github.com/ssbc/patchwork/releases/download/v${version}/ssb-${pname}-${version}-x86_64.AppImage"; + sha256 = "01vsldabv9nmbx8kzlgw275zykm72s1dxglnaq4jz5vbysbyn0qd"; }; - nativeBuildInputs = [ wrapGAppsHook ]; - buildInputs = [ appimage-run gtk3 gsettings-desktop-schemas gobject-introspection ]; + binary = appimageTools.wrapType2 { + name = "${pname}"; + inherit src; + }; + # we only use this to extract the icon + appimage-contents = appimageTools.extractType2 { + inherit name src; + }; - unpackPhase = ":"; + desktopItem = makeDesktopItem { + name = "patchwork"; + exec = "${binary}/bin/patchwork"; + icon = "ssb-patchwork.png"; + comment = "Decentralized messaging and sharing app"; + desktopName = "Patchwork"; + genericName = "Patchwork"; + categories = "Network;"; + }; - installPhase = '' - mkdir -p $out/{bin,share} - cp $src $out/share/${pname} - echo "#!${runtimeShell}" > $out/bin/${pname} - echo "${appimage-run}/bin/appimage-run $out/share/${pname}" >> $out/bin/${pname} - chmod +x $out/bin/${pname} $out/share/${pname} - ''; +in + symlinkJoin { + inherit name; + paths = [ binary ]; - meta = with stdenv.lib; { - description = "A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB)."; + postBuild = '' + mkdir -p $out/share/pixmaps/ $out/share/applications + cp ${appimage-contents}/ssb-patchwork.png $out/share/pixmaps + cp ${desktopItem}/share/applications/* $out/share/applications/ + ''; + + meta = with lib; { + description = "A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB)"; longDescription = '' sea-slang for gossip - a scuttlebutt is basically a watercooler on a ship. ''; homepage = https://www.scuttlebutt.nz/; license = licenses.agpl3; - maintainers = with maintainers; [ thedavidmeister ]; + maintainers = with maintainers; [ thedavidmeister ninjatrappeur flokli ]; platforms = [ "x86_64-linux" ]; }; }