131 lines
3.1 KiB
Nix
131 lines
3.1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchurl
|
|
, appimageTools
|
|
, makeWrapper
|
|
, patchelf
|
|
, webkitgtk_4_1
|
|
, gtk3
|
|
, glib
|
|
, glib-networking
|
|
, libsoup_3
|
|
, dbus
|
|
, pipewire
|
|
, libpulseaudio
|
|
, alsa-lib
|
|
, libGL
|
|
, mesa
|
|
, xdg-utils
|
|
, libxkbcommon
|
|
, wayland
|
|
, xorg
|
|
, pango
|
|
, cairo
|
|
, gdk-pixbuf
|
|
}:
|
|
|
|
let
|
|
pname = "psysonic";
|
|
version = "1.44.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/Psychotoxical/psysonic/releases/download/app-v${version}/Psysonic_${version}_amd64.AppImage";
|
|
hash = "sha256-5dtEgFAA2nQf9cj+M0TThcSk7s+3R3LkgVEzCzfUjWw=";
|
|
};
|
|
|
|
appimageContents = appimageTools.extractType2 { inherit pname version src; };
|
|
|
|
runtimeLibs = lib.makeLibraryPath [
|
|
webkitgtk_4_1
|
|
gtk3
|
|
glib
|
|
glib-networking
|
|
libsoup_3
|
|
dbus
|
|
pipewire
|
|
libpulseaudio
|
|
alsa-lib
|
|
libGL
|
|
mesa
|
|
xdg-utils
|
|
libxkbcommon
|
|
wayland
|
|
xorg.libX11
|
|
xorg.libXext
|
|
xorg.libxcb
|
|
pango
|
|
cairo
|
|
gdk-pixbuf
|
|
];
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
inherit pname version src;
|
|
|
|
dontUnpack = true;
|
|
dontBuild = true;
|
|
dontConfigure = true;
|
|
|
|
nativeBuildInputs = [ makeWrapper patchelf ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin $out/lib/psysonic $out/share
|
|
|
|
# Copy and patch the main binary
|
|
install -Dm755 ${appimageContents}/usr/bin/psysonic $out/lib/psysonic/psysonic
|
|
patchelf \
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
--set-rpath "${runtimeLibs}" \
|
|
$out/lib/psysonic/psysonic
|
|
|
|
# Wrapper script with correct env vars
|
|
makeWrapper $out/lib/psysonic/psysonic $out/bin/psysonic \
|
|
--set GIO_MODULE_DIR "${glib-networking}/lib/gio/modules" \
|
|
--set GIO_EXTRA_MODULES "${glib-networking}/lib/gio/modules" \
|
|
--prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
|
|
--prefix PATH : "${lib.makeBinPath [ xdg-utils dbus ]}"
|
|
|
|
# Icons
|
|
for size in 16 32 48 64 128 256 512; do
|
|
icon="${appimageContents}/usr/share/icons/hicolor/''${size}x''${size}/apps/psysonic.png"
|
|
if [ -f "$icon" ]; then
|
|
install -Dm644 "$icon" $out/share/icons/hicolor/''${size}x''${size}/apps/psysonic.png
|
|
fi
|
|
done
|
|
|
|
# Desktop entry
|
|
if [ -f "${appimageContents}/usr/share/applications/psysonic.desktop" ]; then
|
|
install -Dm644 "${appimageContents}/usr/share/applications/psysonic.desktop" \
|
|
$out/share/applications/psysonic.desktop
|
|
substituteInPlace $out/share/applications/psysonic.desktop \
|
|
--replace-fail 'Exec=psysonic' "Exec=$out/bin/psysonic"
|
|
else
|
|
mkdir -p $out/share/applications
|
|
cat > $out/share/applications/psysonic.desktop << DESKTOP
|
|
[Desktop Entry]
|
|
Name=Psysonic
|
|
Comment=Navidrome client for self-hosted music
|
|
Exec=$out/bin/psysonic
|
|
Icon=psysonic
|
|
Type=Application
|
|
Categories=Audio;Music;
|
|
StartupWMClass=psysonic
|
|
DESKTOP
|
|
fi
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Navidrome desktop client for self-hosted music streaming";
|
|
homepage = "https://github.com/Psychotoxical/psysonic";
|
|
license = licenses.gpl3Only;
|
|
platforms = [ "x86_64-linux" ];
|
|
mainProgram = "psysonic";
|
|
sourceProvenance = [ sourceTypes.binaryNativeCode ];
|
|
};
|
|
}
|