fix(nix): fix ALSA mismatch, add GStreamer plugins, and repair UI environment (#787)

- Update `flake.lock` to synchronize `alsa-lib` and `glibc` versions, resolving a runtime `dlopen` crash when loading the PipeWire plugin.
  - Add `gstreamer`, `gst-plugins-base`, `good`, `bad`, and `ugly` to both `buildInputs` (package) and `devShell` to support WebKitGTK audio/video playback (resolving missing `appsink`/`autoaudiosink`).
  - Set `GST_PLUGIN_SYSTEM_PATH_1_0` in both environments so GStreamer can locate the plugins at runtime.
  - Manually set `XDG_DATA_DIRS` in `devShell` to include `gsettings-desktop-schemas` and `gtk3` schemas, fixing UI scaling, theming, and missing asset issues during development.

Co-authored-by: Thinh Vu <phuocthinhvu@gmail.com>
This commit is contained in:
Phuoc Thinh Vu 2026-02-11 20:34:03 +07:00 committed by GitHub
parent 43bc2373ef
commit 336ccffcc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 12 deletions

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1767892417,
"narHash": "sha256-dhhvQY67aboBk8b0/u0XB6vwHdgbROZT3fJAjyNh5Ww=",
"lastModified": 1770562336,
"narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
"rev": "d6c71932130818840fc8fe9509cf50be8c64634f",
"type": "github"
},
"original": {

View file

@ -11,7 +11,10 @@
nixpkgs,
}:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Read version from Cargo.toml
cargoToml = builtins.fromTOML (builtins.readFile ./src-tauri/Cargo.toml);
@ -132,13 +135,20 @@
onnxruntime
libayatana-appindicator
libevdev
xorg.libX11
xorg.libXtst
libx11
libxtst
gtk-layer-shell
openssl
vulkan-loader
vulkan-headers
shaderc
# Required for WebKitGTK audio/video
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
];
env = {
@ -146,15 +156,29 @@
BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.llvmPackages.libclang.lib}/lib/clang/${lib.getVersion pkgs.llvmPackages.libclang}/include -isystem ${pkgs.glibc.dev}/include";
ORT_LIB_LOCATION = "${pkgs.onnxruntime}/lib";
OPENSSL_NO_VENDOR = "1";
# Tell Gstreamer where to find plugins
GST_PLUGIN_SYSTEM_PATH_1_0 = "${pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (
with pkgs.gst_all_1;
[
gstreamer
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
]
)}";
};
preFixup = ''
gappsWrapperArgs+=(
--set WEBKIT_DISABLE_DMABUF_RENDERER 1
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
pkgs.vulkan-loader
pkgs.onnxruntime
]}"
--prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [
pkgs.vulkan-loader
pkgs.onnxruntime
]
}"
)
'';
@ -163,7 +187,7 @@
homepage = "https://github.com/cjpais/Handy";
license = lib.licenses.mit;
mainProgram = "handy";
platforms = [ "x86_64-linux" ];
platforms = supportedSystems;
};
};
@ -175,7 +199,9 @@
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs {
inherit system;
};
in
{
default = pkgs.mkShell {
@ -211,6 +237,19 @@
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath [ pkgs.libappindicator ]}";
GST_PLUGIN_SYSTEM_PATH_1_0 = "${pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (
with pkgs.gst_all_1;
[
gstreamer
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
]
)}";
# Same as wrapGAppsHook4
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:${pkgs.hicolor-icon-theme}/share";
shellHook = ''
echo "Handy development environment"