JACK: Difference between revisions
imported>Nix m add Software/Applications subcategory |
imported>Voyd Add tips for running nix-provided jack clients on arch linux |
||
Line 176: | Line 176: | ||
}; | }; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
== Connecting nix JACK clients to Pipewire installed via other package managers == | |||
Pipewire offers a JACK API, but applications installed via nix are not able to connect to it out of the box. | |||
Use the following command to make them work (using qsynth as an example): | |||
<syntaxHighlight lang="bash"> | |||
LD_LIBRARY_PATH="$(nix build nixpkgs#pipewire.jack --print-out-paths)/lib" nix run nixpkgs#qsynth | |||
</syntaxHighlight> | |||
You can also wrap it in a script, for adding this to your home-manager config will allow using `nix-jack nix run nixpkgs#qsynth` | |||
<syntaxHighlight lang="nix"> | |||
home.packages = with pkgs; [ | |||
(writeShellScriptBin "nix-jack" '' | |||
exec /usr/bin/env \ | |||
LD_LIBRARY_PATH=${pipewire.jack}/lib''${LD_LIBRARY_PATH:+:''${LD_LIBRARY_PATH}} \ | |||
"''$@" | |||
'') | |||
] | |||
</syntaxHighlight> | |||
or | |||
<syntaxHighlight lang="nix"> | |||
let | |||
jackWrap = drv: pkgs.symlinkJoin { | |||
name = "${drv.name}-jackwrapped"; | |||
paths = [ drv ]; | |||
buildInputs = [ pkgs.makeWrapper ]; | |||
postBuild = '' | |||
ls "$out/bin" | |||
for b in "$out/bin/"*; do | |||
wrapProgram "$b" \ | |||
--prefix LD_LIBRARY_PATH : "${pkgs.pipewire.jack}/lib" | |||
done | |||
''; | |||
}; | |||
in [ | |||
(jackWrap pkgs.qsynth) | |||
] | |||
</syntaxHighlight> | |||
This is necessary because of the way the pipewire jack interface works. By using a pipewire-provided dynamically linked library, the connection attempt is translated to a pipewire connection inside the client process. Other distributions such as Arch Linux implement this by just placing the .so files in /usr/lib but since nix application don't include that directory we need this approach. | |||
(Tested on Arch Linux in May 2023) | |||
If you know of a way to do this without wrapping each individual package, please add it here. | |||
[[Category:Audio]] | [[Category:Audio]] | ||
[[Category:Applications]] | [[Category:Applications]] |