From cf9c61e67a101de13516ea2ffa5ba104f6e0ec10 Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 27 Apr 2026 18:40:39 -0400 Subject: [PATCH] working version --- .gitignore | 13 +++++ README.md | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++ default.nix | 22 ++++++++ package.nix | 125 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 319 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 default.nix create mode 100644 package.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..baeee44 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Nix build outputs +result +result-* + +# Nix evaluation caches +.direnv/ +.envrc + +# Editor noise +.vscode/ +.idea/ +*.swp +*~ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c702b6 --- /dev/null +++ b/README.md @@ -0,0 +1,159 @@ +# fladder — NixOS package + +Unofficial NixOS package for [Fladder](https://github.com/DonutWare/Fladder), +a cross-platform [Jellyfin](https://jellyfin.org/) client built on Flutter. + +## Files + +| File | Purpose | +|---|---| +| `package.nix` | The derivation (import this into your config or flake) | +| `default.nix` | Convenience wrapper for `nix-build` local testing | + +## Quick start + +```bash +# Build and test locally +nix-build # produces ./result/bin/fladder +./result/bin/fladder +``` + +## Adding to your NixOS configuration + +### Standalone (no flake) + +Copy this repo somewhere (e.g. `~/nixpkgs-overlays/fladder/`) then in +`/etc/nixos/configuration.nix`: + +```nix +{ pkgs, ... }: +let + fladder = pkgs.callPackage /path/to/this/repo/package.nix { }; +in +{ + environment.systemPackages = [ fladder ]; +} +``` + +### As an overlay + +```nix +# In configuration.nix or a separate overlay file: +nixpkgs.overlays = [ + (final: prev: { + fladder = final.callPackage /path/to/this/repo/package.nix { }; + }) +]; + +environment.systemPackages = [ pkgs.fladder ]; +``` + +### With flakes + +```nix +# flake.nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + fladder-pkg.url = "path:/path/to/this/repo"; # or a github: URL + }; + + outputs = { nixpkgs, fladder-pkg, ... }: { + nixosConfigurations.mymachine = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ({ pkgs, ... }: { + environment.systemPackages = [ + fladder-pkg.packages.x86_64-linux.fladder + ]; + }) + ]; + }; + }; +} +``` + +## Package notes + +### AppImage type + +Fladder distributes a **Type 2 (SquashFS)** AppImage built with +[appimage-builder](https://appimage-builder.readthedocs.io/). The derivation +uses `appimageTools.wrapType2`, which: + +1. Extracts the SquashFS filesystem. +2. Patches the ELF interpreter and `RPATH` to point at the Nix store. +3. Wraps the binary in a minimal FHS environment that provides the expected + shared libraries. + +### Runtime dependencies + +The main external shared libraries are: + +| Library | Why needed | +|---|---| +| `libmpv` | Media playback (video/audio streaming) | +| `gtk3` | Flutter Linux window embedder | +| `libGL` / `mesa` | Flutter Impeller / OpenGL compositor | +| `libxkbcommon` | Keyboard input | +| `wayland` | Native Wayland support (Flutter ≥ 3.13) | +| `libpulseaudio` | Audio (mpv PulseAudio / PipeWire-pulse back-end) | +| `python3` | `libmpv` in nixpkgs pulls in `vapoursynth` which `dlopen`s `libpython` | + +The `python3` dependency is subtle but important: without it the app exits +immediately with `libpython3.x.so.1.0: cannot open shared object file` +([upstream issue #724](https://github.com/DonutWare/Fladder/issues/724)). + +### AMD GPU (RX 580) + +The RX 580 uses the open-source `amdgpu` / `radeonsi` Mesa driver stack, +which is included via `pkgs.mesa` in `extraPkgs`. No additional configuration +should be required. If you encounter rendering artefacts, try: + +```nix +# In configuration.nix +hardware.opengl.enable = true; # (or hardware.graphics.enable on 25.05+) +hardware.opengl.driSupport = true; +``` + +### X11 / Wayland + +Fladder runs on both. Flutter will prefer Wayland when `WAYLAND_DISPLAY` is +set; it falls back to X11/XWayland otherwise. No special flags are needed. + +### Updating to a new version + +1. Update `version` in `package.nix`. +2. Update the `hash` field — get the new hash with: + ```bash + nix-prefetch-url --type sha256 \ + https://github.com/DonutWare/Fladder/releases/download/vNEW/Fladder-Linux-NEW.AppImage + # Convert to SRI format: + nix hash to-sri --type sha256 + ``` +3. Run `nix-build` and test. + +## Troubleshooting + +**`libmpv.so: cannot open shared object file`** +: Ensure `pkgs.mpv` is in `extraPkgs`. If you build mpv yourself with custom + options, the `.so` name or version may differ — check with + `nix run nixpkgs#patchelf -- --print-needed result/bin/.fladder-wrapped`. + +**`libpython3.x.so.1.0: cannot open shared object file`** +: The `python3` package in `extraPkgs` should fix this. If it persists, pin + the python version to match the one nixpkgs' mpv was linked against. + +**App window is black / no video** +: Make sure Mesa / OpenGL is enabled in your NixOS config (see AMD GPU section + above). Also try setting `LIBGL_ALWAYS_SOFTWARE=0` to rule out Mesa's + software rasterizer being selected. + +**Wayland: window appears but is blank** +: Try forcing X11 as a workaround: `WAYLAND_DISPLAY="" ./result/bin/fladder`. + This is a known Flutter/Wayland edge case on some compositor versions. + +## License + +The Nix packaging files in this repo are released under the MIT license. +Fladder itself is [GPL-3.0](https://github.com/DonutWare/Fladder/blob/develop/LICENSE). diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..8903b3e --- /dev/null +++ b/default.nix @@ -0,0 +1,22 @@ +# default.nix — local test entry-point +# +# Usage +# ----- +# nix-build # build the package +# nix-build -A fladder # explicit attribute (same result) +# ./result/bin/fladder # run the built binary +# +# To drop into a shell with the package available: +# nix-shell -p "$(nix-build --no-out-link)" +# +# Or with nix shell (flake-agnostic): +# nix shell "$(nix-build --no-out-link)" + +let + # Pin to a recent nixpkgs revision that ships NixOS 25.11 packages. + # Replace with a pinned fetchTarball for fully reproducible builds. + pkgs = import { }; +in +{ + fladder = pkgs.callPackage ./package.nix { }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..46cb00d --- /dev/null +++ b/package.nix @@ -0,0 +1,125 @@ +{ + 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 + }; +}