From 4fce4919742487c04cc6c5dd36053af980407e2d Mon Sep 17 00:00:00 2001 From: cucadmuh <49571317+cucadmuh@users.noreply.github.com> Date: Mon, 4 May 2026 03:44:28 +0300 Subject: [PATCH] feat(nix): psysonic-gdk-session, devShell target dir, nixos-install refresh (#447) * feat(nix): psysonic-gdk-session package and local cargo layout - Add psysonic-gdk-session (forceGdkX11=false) to flake packages and apps - Ignore .build-local/ in cleanSource; set CARGO_TARGET_DIR in devShell shellHook - Gitignore: result, .build-local, prod.sh (local helper only) - nixos-install: contributor shell docs use flake devShell only (no shell.nix in tree) * chore(nix): gitignore local dev.sh, shell.nix, prod.sh Document optional local helpers in nixos-install.md; keep flake PR free of non-reproducible shell.nix fetchTarball. * docs(nix): document default vs gdk-session flake packages Explain x11-wrapped default and optional psysonic-gdk-session trade-offs; extend flake description and one-shot run note. * docs: quote flake URLs for zsh in README and nixos-install * docs(changelog): add PR #446 UI bulk ratings and PR #447 Nix flake GDK choice * docs: remove Nix flake block from README; changelog #447 points to nixos-install only --- .gitignore | 8 ++++++++ CHANGELOG.md | 14 ++++++++++++++ flake.nix | 27 ++++++++++++++++++++++++++- nix/psysonic.nix | 29 +++++++++++++++++++---------- nixos-install.md | 27 ++++++++++++++++++++++++--- 5 files changed, 91 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 995e7949..a70292af 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,11 @@ research/ # Nix build output symlink result result-* + +# Local incremental cargo (nix develop; not used by flake — see nix/psysonic.nix cleanSource) +.build-local/ + +# Local Nix helpers (not in repo — optional; use `nix develop` / flake without them) +dev.sh +shell.nix +prod.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index b009c1bb..0270d156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -177,6 +177,20 @@ The filter panel layout was tightened up at the same time: two sub-headings (**M Under the hood, `fetchRandomMixSongsUntilFull` now scales batch size, max-batch ceiling and dup-streak budget with the requested target — so a 150-track mix can finish in a single round-trip on most libraries instead of stalling out at ~120. +### UI — Bulk Entity Ratings, Random Albums Multi-Select, Album New Badge + +**By [@cucadmuh](https://github.com/cucadmuh), PR [#446](https://github.com/Psychotoxical/psysonic/pull/446)** + +Multi-album and multi-artist **context menus** now include a shared star-rating row for the current selection (mixed ratings show empty until you set a value; keyboard navigation supported), with new aria-label strings across locales. **Random Albums** passes the active selection into each **AlbumCard** so the same bulk context menu works from the roll grid. The album **New** badge moves to the **top-right** of the cover and **stacks** with the offline badge so the two no longer overlap. + + +### NixOS — Flake: X11-wrapped default vs session GDK + +**By [@cucadmuh](https://github.com/cucadmuh), PR [#447](https://github.com/Psychotoxical/psysonic/pull/447)** + +The flake exposes two Linux installables: **`psysonic`** / **`default`** pins **`GDK_BACKEND=x11`** for a stable GTK/WebKit stack on mixed Wayland setups; **`psysonic-gdk-session`** drops that override so GDK follows the session (native Wayland where the stack supports it). **[nixos-install.md](nixos-install.md)** documents trade-offs and **zsh-safe** quoting for `nix run 'github:…#…'` URLs. + + ## Fixed - **Settings → Audio no longer blanks the app on macOS** *(Issue [#382](https://github.com/Psychotoxical/psysonic/issues/382), PR [#384](https://github.com/Psychotoxical/psysonic/pull/384), by [@Psychotoxical](https://github.com/Psychotoxical))*: Fixed a macOS-only crash where opening Settings → Audio could turn the whole app into a blank window. The Equalizer canvas now waits until it has valid layout dimensions before drawing, and redraws automatically once the section is visible. diff --git a/flake.nix b/flake.nix index 2f98e43b..f3d4ae4a 100644 --- a/flake.nix +++ b/flake.nix @@ -3,16 +3,19 @@ Psysonic for NixOS / nixpkgs: installable app + dev shell. Packages: - nix build .#psysonic # or .#default — desktop app (.desktop + icon) + nix build .#psysonic # or .#default — desktop app (.desktop + icon); GDK_BACKEND=x11 (default, fewer WebKit surprises) + nix build .#psysonic-gdk-session # same app, no forced GDK x11 — optional; can misbehave on some stacks (see nixos-install.md) nix profile install .#psysonic Run (after build, or from any clone with flake): nix run .#psysonic + nix run .#psysonic-gdk-session nix run github:Psychotoxical/psysonic Development: nix develop # mkShell (Rust/Node/WebKit deps + hooks) nix shell .#devShells.default # same environment without entering subshell semantics + Local cargo output: .build-local/ (gitignored; not copied into flake source tarball) Release pipeline updates `flake.lock` (nixpkgs pin refresh) and `nix/upstream-sources.json` (npmDepsHash) on every `v*` tag push — @@ -71,6 +74,10 @@ ++ gstPlugins; shellHook = '' + _repo="$(git rev-parse --show-toplevel 2>/dev/null || true)" + if [ -n "$_repo" ] && [ -f "$_repo/flake.nix" ]; then + export CARGO_TARGET_DIR="''${CARGO_TARGET_DIR:-$_repo/.build-local/cargo-target}" + fi export LD_LIBRARY_PATH="${pkgs.libayatana-appindicator}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" export GST_PLUGIN_PATH="${gstPluginPath}''${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}" export GIO_EXTRA_MODULES="${pkgs.glib-networking}/lib/gio/modules''${GIO_EXTRA_MODULES:+:$GIO_EXTRA_MODULES}" @@ -92,12 +99,21 @@ src = self; inherit upstreamMeta; }; + + psysonicGdkSessionFor = + system: + nixpkgs.legacyPackages.${system}.callPackage ./nix/psysonic.nix { + src = self; + inherit upstreamMeta; + forceGdkX11 = false; + }; in { devShells = forSystem (system: { default = mkShellFor system; }); packages = forSystem (system: { psysonic = psysonicFor system; + psysonic-gdk-session = psysonicGdkSessionFor system; default = psysonicFor system; }); @@ -105,6 +121,7 @@ system: let p = psysonicFor system; + pGdk = psysonicGdkSessionFor system; in { default = { @@ -115,6 +132,14 @@ mainProgram = "psysonic"; }; }; + psysonic-gdk-session = { + type = "app"; + program = lib.getExe pGdk; + meta = { + inherit (pGdk.meta) description homepage license; + mainProgram = "psysonic"; + }; + }; } ); }; diff --git a/nix/psysonic.nix b/nix/psysonic.nix index ba0a5c85..54520636 100644 --- a/nix/psysonic.nix +++ b/nix/psysonic.nix @@ -35,6 +35,9 @@ gst_all_1, src, upstreamMeta, + # When true (default), wrapProgram sets GDK_BACKEND=x11 for WebKit stability on many setups. + # When false, GDK follows the session (e.g. native Wayland) — often better HiDPI sizing. + forceGdkX11 ? true, }: let @@ -59,7 +62,8 @@ let && !(lib.hasInfix "/target/" f) && !(lib.hasInfix "/.git/" f) && !(lib.hasInfix "/result/" f) - && !(lib.hasInfix "/.flatpak-builder/" f); + && !(lib.hasInfix "/.flatpak-builder/" f) + && !(lib.hasInfix "/.build-local/" f); }; npmDeps = fetchNpmDeps { src = srcClean; @@ -156,15 +160,20 @@ stdenv.mkDerivation (finalAttrs: { }) ]; - postFixup = '' - wrapProgram $out/bin/psysonic \ - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libayatana-appindicator ]}" \ - --prefix GST_PLUGIN_PATH : "${gstPluginPath}" \ - --prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \ - --set GDK_BACKEND x11 \ - --set WEBKIT_DISABLE_COMPOSITING_MODE 1 \ - --set WEBKIT_DISABLE_DMABUF_RENDERER 1 - ''; + postFixup = + let + gdkX11Wrap = lib.optionalString forceGdkX11 '' + --set GDK_BACKEND x11 \ + ''; + in + '' + wrapProgram $out/bin/psysonic \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libayatana-appindicator ]}" \ + --prefix GST_PLUGIN_PATH : "${gstPluginPath}" \ + --prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \ + ${gdkX11Wrap}--set WEBKIT_DISABLE_COMPOSITING_MODE 1 \ + --set WEBKIT_DISABLE_DMABUF_RENDERER 1 + ''; meta = { description = "Desktop music player for Subsonic-compatible servers"; diff --git a/nixos-install.md b/nixos-install.md index b64de569..3492a5ab 100644 --- a/nixos-install.md +++ b/nixos-install.md @@ -85,6 +85,27 @@ environment.systemPackages = with pkgs; [ ]; ``` +### Linux wrapper: default vs gdk-session + +The flake exposes **two** installable packages on Linux. They are the same build; only the **wrapped runtime environment** differs: + +| Flake attribute | Wrapper behaviour | +|----------------|-------------------| +| **`psysonic`** (and **`default`**) | Sets **`GDK_BACKEND=x11`** together with the usual WebKit / GStreamer / AppIndicator paths. This is the **recommended default**: it matches the dev shell assumptions and avoids many WebKitGTK + Wayland edge cases. | +| **`psysonic-gdk-session`** | **Does not** set `GDK_BACKEND`; GTK follows the session (e.g. native Wayland when available). Can improve **HiDPI sizing** on some desktops, but may cause **black window, broken scrolling, or tray quirks** on other GPU/compositor stacks—the same class of issues described under Linux / WebKit in the in-app Help. **Not default** on purpose. | + +Use the alternate package when you understand that trade-off: + +```nix +inputs.psysonic.packages.${system}.psysonic-gdk-session +``` + +Or one-shot (quote the URL in **zsh** — `?` / `#` are special): + +```bash +nix run 'github:Psychotoxical/psysonic#psysonic-gdk-session' -- --help +``` + ### Pinning a revision, branch, or tag - **`main`** (default in the examples above) follows upstream development. @@ -118,10 +139,10 @@ End users who pin **`main`** should run `nix flake update psysonic` (or equivale From any machine with flakes: ```bash -nix run github:Psychotoxical/psysonic +nix run 'github:Psychotoxical/psysonic' ``` -Same package as `nix build` / `packages..default`; uses the flake `apps` output. +Same as `nix build` / `packages..default` (the **x11-wrapped** binary); uses the flake `apps` output. For the session-GDK variant, use `'github:Psychotoxical/psysonic#psysonic-gdk-session'` (see [Linux wrapper](#linux-wrapper-default-vs-gdk-session) above). With a branch pin, keep the **whole** `github:…?ref=…#…` string in **single quotes** under **zsh**. ### Apply configuration @@ -158,7 +179,7 @@ From a **flake-enabled** clone of the repo: The flake **`devShell`** uses the same **`nixpkgs`** input as **`packages.psysonic`** (see **`flake.nix`**). -If you prefer **classic `nix-shell`** without evaluating the flake, the repo also provides **`shell.nix`**: it pulls **`nixos-unstable`** via `fetchTarball`, so the nixpkgs pin may **differ** from **`flake.lock`**; use it only when you understand that tradeoff (comments at the top of `shell.nix` describe local Tauri build commands). +Optional **local-only** helpers (`dev.sh`, `shell.nix`, `prod.sh`) are **gitignored** — not part of the upstream tree; keep your own copies if you use them (e.g. a small `dev.sh` that runs `nix develop` and `npm run tauri:dev`). ## Desktop entry