From 30430c0b409c01267d747dfc8ec94a25237ef101 Mon Sep 17 00:00:00 2001 From: Bignaux Ronan Date: Mon, 9 Dec 2019 21:28:44 +0100 Subject: soulseekqt: fix icons, change unpack method, update homepage, more generic appimage handling --- .../networking/p2p/soulseekqt/default.nix | 61 ++++++++++++---------- 1 file changed, 34 insertions(+), 27 deletions(-) (limited to 'pkgs/applications/networking/p2p') diff --git a/pkgs/applications/networking/p2p/soulseekqt/default.nix b/pkgs/applications/networking/p2p/soulseekqt/default.nix index b52320c96814..be9d59caeb25 100644 --- a/pkgs/applications/networking/p2p/soulseekqt/default.nix +++ b/pkgs/applications/networking/p2p/soulseekqt/default.nix @@ -1,11 +1,13 @@ -{ stdenv, lib, fetchurl, mkDerivation +{ stdenv, lib, fetchzip, mkDerivation , autoPatchelfHook , dbus , desktop-file-utils , fontconfig +, imagemagick , libjson -, pythonPackages , qtmultimedia +, radare2 +, jq , squashfsTools , zlib }: @@ -14,46 +16,51 @@ mkDerivation rec { pname = "soulseekqt"; version = "2018-1-30"; - src = fetchurl { - urls = [ - "https://www.dropbox.com/s/0vi87eef3ooh7iy/SoulseekQt-${version}.tgz" - "https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz" - ]; - sha256 = "0d1cayxr1a4j19bc5a3qp9pg22ggzmd55b6f5av3lc6lvwqqg4w6"; + src = fetchzip { + url = "https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz"; + sha256 = "16ncnvv8h33f161mgy7qc0wjvvqahsbwvby65qhgfh9pbbgb4xgg"; }; dontBuild = true; - nativeBuildInputs = [ autoPatchelfHook pythonPackages.binwalk squashfsTools desktop-file-utils ]; + nativeBuildInputs = [ imagemagick radare2 jq autoPatchelfHook squashfsTools + desktop-file-utils ]; buildInputs = [ qtmultimedia stdenv.cc.cc ]; # avoid usage of appimage's runner option --appimage-extract - unpackCmd = '' - export HOME=$(pwd) # workaround for binwalk - appimage=$(tar xvf $curSrc) && binwalk --quiet \ - $appimage -D 'squashfs:squashfs:unsquashfs %e' - ''; + postUnpack = '' + cd $sourceRoot - patchPhase = '' - cd squashfs-root/ - binary="$(readlink AppRun)" + # multiarch offset one-liner using same method as AppImage + offset=$(r2 *.AppImage -nn -Nqc "pfj.elf_header @ 0" |\ + jq 'map({(.name): .value}) | add | .shoff + (.shnum * .shentsize)') - # fixup desktop file - desktop-file-edit --set-key Exec --set-value $binary default.desktop - desktop-file-edit --set-key Comment --set-value "${meta.description}" default.desktop - desktop-file-edit --set-key Categories --set-value Network default.desktop + unsquashfs -o $offset *.AppImage + sourceRoot=squashfs-root ''; installPhase = '' - mkdir -p $out/{bin,share/applications,share/icons/} - cp default.desktop $out/share/applications/$binary.desktop - cp soulseek.png $out/share/icons/ - cp $binary $out/bin/ - ''; + + binary="$(readlink AppRun)" + mv default.desktop $binary.desktop + install -Dm755 $binary -t $out/bin + + # fixup and install desktop file + desktop-file-install --dir $out/share/applications \ + --set-key Exec --set-value $binary \ + --set-key Comment --set-value "${meta.description}" \ + --set-key Categories --set-value Network $binary.desktop + + #TODO: write generic code to read icon path from $binary.desktop + for size in 16 32 48 64 72 96 128 192 256 512 1024; do + mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps + convert -resize "$size"x"$size" ./soulseek.png $out/share/icons/hicolor/"$size"x"$size"/apps/soulseek.png + done + ''; meta = with lib; { description = "Official Qt SoulSeek client"; - homepage = http://www.soulseekqt.net; + homepage = https://www.slsknet.org; license = licenses.unfree; maintainers = [ maintainers.genesis ]; platforms = [ "x86_64-linux" ]; -- cgit 1.4.1