Merge pull request #75392 from bignaux/soulseekqt

soulseekqt: fix icons, change unpack method, update homepage, more generic appimage handling
gstqt5
Florian Klink 2020-03-11 16:24:13 -07:00 committed by GitHub
commit a3dde62658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 39 deletions

View File

@ -1,59 +1,57 @@
{ stdenv, lib, fetchurl, mkDerivation
{ stdenv, lib, fetchzip, mkDerivation
, appimageTools
, autoPatchelfHook
, dbus
, desktop-file-utils
, fontconfig
, libjson
, pythonPackages
, imagemagick
, qtmultimedia
, squashfsTools
, zlib
}:
mkDerivation rec {
pname = "soulseekqt";
version = "2018-1-30";
name="${pname}-${version}";
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";
};
appextracted = appimageTools.extractType2 {
inherit name;
src="${src}/SoulseekQt-2018-1-30-64bit.AppImage";
};
dontBuild = true;
nativeBuildInputs = [ autoPatchelfHook pythonPackages.binwalk squashfsTools desktop-file-utils ];
dontConfigure = true;
nativeBuildInputs = [ imagemagick autoPatchelfHook 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'
'';
patchPhase = ''
cd squashfs-root/
binary="$(readlink AppRun)"
# 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
'';
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/
'';
# directory in /nix/store so readonly
cd $appextracted
binary="$(readlink AppRun)"
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 default.desktop
mv $out/share/applications/default.desktop $out/share/applications/SoulseekQt.desktop
#TODO: write generic code to read icon path from $binary.desktop
icon="$(readlink .DirIcon)"
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" $icon $out/share/icons/hicolor/"$size"x"$size"/apps/$icon
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" ];