soulseekqt: fix icons, change unpack method, update homepage, more generic appimage handling
This commit is contained in:
parent
bf83a7cc66
commit
30430c0b40
@ -1,11 +1,13 @@
|
|||||||
{ stdenv, lib, fetchurl, mkDerivation
|
{ stdenv, lib, fetchzip, mkDerivation
|
||||||
, autoPatchelfHook
|
, autoPatchelfHook
|
||||||
, dbus
|
, dbus
|
||||||
, desktop-file-utils
|
, desktop-file-utils
|
||||||
, fontconfig
|
, fontconfig
|
||||||
|
, imagemagick
|
||||||
, libjson
|
, libjson
|
||||||
, pythonPackages
|
|
||||||
, qtmultimedia
|
, qtmultimedia
|
||||||
|
, radare2
|
||||||
|
, jq
|
||||||
, squashfsTools
|
, squashfsTools
|
||||||
, zlib
|
, zlib
|
||||||
}:
|
}:
|
||||||
@ -14,46 +16,51 @@ mkDerivation rec {
|
|||||||
pname = "soulseekqt";
|
pname = "soulseekqt";
|
||||||
version = "2018-1-30";
|
version = "2018-1-30";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchzip {
|
||||||
urls = [
|
url = "https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz";
|
||||||
"https://www.dropbox.com/s/0vi87eef3ooh7iy/SoulseekQt-${version}.tgz"
|
sha256 = "16ncnvv8h33f161mgy7qc0wjvvqahsbwvby65qhgfh9pbbgb4xgg";
|
||||||
"https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz"
|
|
||||||
];
|
|
||||||
sha256 = "0d1cayxr1a4j19bc5a3qp9pg22ggzmd55b6f5av3lc6lvwqqg4w6";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
nativeBuildInputs = [ autoPatchelfHook pythonPackages.binwalk squashfsTools desktop-file-utils ];
|
nativeBuildInputs = [ imagemagick radare2 jq autoPatchelfHook squashfsTools
|
||||||
|
desktop-file-utils ];
|
||||||
buildInputs = [ qtmultimedia stdenv.cc.cc ];
|
buildInputs = [ qtmultimedia stdenv.cc.cc ];
|
||||||
|
|
||||||
# avoid usage of appimage's runner option --appimage-extract
|
# avoid usage of appimage's runner option --appimage-extract
|
||||||
unpackCmd = ''
|
postUnpack = ''
|
||||||
export HOME=$(pwd) # workaround for binwalk
|
cd $sourceRoot
|
||||||
appimage=$(tar xvf $curSrc) && binwalk --quiet \
|
|
||||||
$appimage -D 'squashfs:squashfs:unsquashfs %e'
|
|
||||||
'';
|
|
||||||
|
|
||||||
patchPhase = ''
|
# multiarch offset one-liner using same method as AppImage
|
||||||
cd squashfs-root/
|
offset=$(r2 *.AppImage -nn -Nqc "pfj.elf_header @ 0" |\
|
||||||
binary="$(readlink AppRun)"
|
jq 'map({(.name): .value}) | add | .shoff + (.shnum * .shentsize)')
|
||||||
|
|
||||||
# fixup desktop file
|
unsquashfs -o $offset *.AppImage
|
||||||
desktop-file-edit --set-key Exec --set-value $binary default.desktop
|
sourceRoot=squashfs-root
|
||||||
desktop-file-edit --set-key Comment --set-value "${meta.description}" default.desktop
|
|
||||||
desktop-file-edit --set-key Categories --set-value Network default.desktop
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/{bin,share/applications,share/icons/}
|
|
||||||
cp default.desktop $out/share/applications/$binary.desktop
|
binary="$(readlink AppRun)"
|
||||||
cp soulseek.png $out/share/icons/
|
mv default.desktop $binary.desktop
|
||||||
cp $binary $out/bin/
|
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; {
|
meta = with lib; {
|
||||||
description = "Official Qt SoulSeek client";
|
description = "Official Qt SoulSeek client";
|
||||||
homepage = http://www.soulseekqt.net;
|
homepage = https://www.slsknet.org;
|
||||||
license = licenses.unfree;
|
license = licenses.unfree;
|
||||||
maintainers = [ maintainers.genesis ];
|
maintainers = [ maintainers.genesis ];
|
||||||
platforms = [ "x86_64-linux" ];
|
platforms = [ "x86_64-linux" ];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user