{ lib, appimageTools, fetchurl, makeDesktopItem, copyDesktopItems, imagemagick, }: let pname = "fladder"; version = "0.10.3"; src = fetchurl { url = "https://github.com/DonutWare/Fladder/releases/download/v${version}/Fladder-Linux-${version}.AppImage"; hash = "sha256-t9/rB7Iv0GI5HJWwBUQwfxISPpbYPeRouS6oD8BKMEY="; }; # Extract the AppImage contents so we can pull out the icon. # Fladder uses appimage-builder → Type 2 (SquashFS) AppImage. appimageContents = appimageTools.extractType2 { inherit pname version src; }; in appimageTools.wrapType2 rec { inherit pname version src; # --------------------------------------------------------------------------- # Extra libraries injected into the FHS environment that wrapType2 creates. # # Why these? # • libmpv – Fladder is a media client; it links against libmpv at # runtime (confirmed by AUR fladder-bin/fladder-git and the # INSTALL.md "libmpv shared library errors" note). # • gtk3 – Flutter on Linux uses GTK3 for window management. # • glib / pango / cairo / harfbuzz / fontconfig # – Transitive GTK3 / Flutter rendering dependencies. # • libGL / mesa-gl-headers # – Flutter's Linux embedder always links libGL even when # the app itself is not "GPU heavy". Needed for the # OpenGL compositor / Impeller. # • xorg.libX11 / libxkbcommon # – X11 window system support; also required under Wayland # (XWayland path). # • wayland – Native Wayland support (Flutter >= 3.13 supports it). # • dbus – System notifications and D-Bus IPC. # • alsa-lib – Audio output via mpv's ALSA back-end. # • libpulseaudio # – Audio output via mpv's PulseAudio / PipeWire-pulse # back-end (preferred over bare ALSA on most desktops). # • python3 – libmpv in nixpkgs is built with vapoursynth support # which dlopen's libpython at runtime. Without this the # binary exits with "cannot open shared object file: # libpython3.x.so.1.0" (upstream issue #724). # --------------------------------------------------------------------------- extraPkgs = pkgs: [ pkgs.mpv pkgs.gtk3 pkgs.glib pkgs.pango pkgs.cairo pkgs.harfbuzz pkgs.fontconfig pkgs.freetype pkgs.libGL pkgs.mesa pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXrender pkgs.libxkbcommon pkgs.wayland pkgs.dbus pkgs.alsa-lib pkgs.libpulseaudio pkgs.python3 # Needed by some AppImageLauncher / appimage-builder runtime stubs pkgs.fuse pkgs.libepoxy pkgs.lz4 ]; # --------------------------------------------------------------------------- # Post-install: wire up the .desktop file and icon. # # appimage-builder places the icon at: # AppDir/usr/share/icons/fladder_icon_desktop.png # and the upstream .desktop ID is nl.jknaapen.fladder. # We install both a correctly-named .desktop file and a hicolor icon so # the app appears in application launchers without extra config. # --------------------------------------------------------------------------- extraInstallCommands = '' # ── Icon ────────────────────────────────────────────────────────────────── install -Dm644 \ ${appimageContents}/usr/share/icons/fladder_icon_desktop.png \ $out/share/icons/hicolor/256x256/apps/fladder.png # ── Desktop file ────────────────────────────────────────────────────────── install -Dm644 \ ${appimageContents}/nl.jknaapen.fladder.desktop \ $out/share/applications/fladder.desktop # Fix the Exec line so it points at the wrapped binary in $out/bin. substituteInPlace $out/share/applications/fladder.desktop \ --replace-fail 'Exec=Fladder' 'Exec=fladder' \ --replace-quiet 'Icon=fladder_icon_desktop' 'Icon=fladder' ''; meta = { description = "Cross-platform Jellyfin frontend built on Flutter"; longDescription = '' Fladder is a feature-rich Jellyfin client that supports streaming, offline sync, trickplay scrubbing, intro/credits skipping, Jellyseerr integration, comic-book reading, and more. It targets Linux, Windows, macOS, Android, iOS, and Web from a single Flutter codebase. ''; homepage = "https://github.com/DonutWare/Fladder"; downloadPage = "https://github.com/DonutWare/Fladder/releases"; changelog = "https://github.com/DonutWare/Fladder/releases/tag/v${version}"; license = lib.licenses.gpl3Only; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; # AppImage is x86_64-only upstream. platforms = [ "x86_64-linux" ]; mainProgram = "fladder"; maintainers = [ ]; # add yourself: lib.maintainers.yourhandle }; }