forked from mirrors/nixpkgs
c5e6fb193b
If the user asks for a plugin that does come with their own binaries or other
files to be included in their OBS installation, it should include those files. A
good example is obs-vkcapture which /requires/ system-wide files to have any use
whatsoever.
Plugins' paths were removed from the wrapper in step with preventing OBS from
loading plugins twice but wasn't actually required because the env variables
already point at the one and only location for plugins. The plugins' share dirs
don't get put in the system-wide share by default on NixOS but I decided to
remove the directory anyways for clarity.
Partially reverts 593d64f975
Co-authored-by: Pedro Lara Campos <pedro.laracampos@gmail.com>
42 lines
1.2 KiB
Nix
42 lines
1.2 KiB
Nix
{ lib, obs-studio, symlinkJoin, makeWrapper }:
|
|
|
|
{ plugins ? [] }:
|
|
|
|
symlinkJoin {
|
|
name = "wrapped-${obs-studio.name}";
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
paths = [ obs-studio ] ++ plugins;
|
|
|
|
postBuild = with lib;
|
|
let
|
|
# Some plugins needs extra environment, see obs-gstreamer for an example.
|
|
pluginArguments =
|
|
lists.concatMap (plugin: plugin.obsWrapperArguments or []) plugins;
|
|
|
|
pluginsJoined = symlinkJoin {
|
|
name = "obs-studio-plugins";
|
|
paths = plugins;
|
|
};
|
|
|
|
wrapCommandLine = [
|
|
"wrapProgram"
|
|
"$out/bin/obs"
|
|
''--set OBS_PLUGINS_PATH "${pluginsJoined}/lib/obs-plugins"''
|
|
''--set OBS_PLUGINS_DATA_PATH "${pluginsJoined}/share/obs/obs-plugins"''
|
|
] ++ pluginArguments;
|
|
in ''
|
|
${concatStringsSep " " wrapCommandLine}
|
|
|
|
# Remove unused obs-plugins dir to not cause confusion
|
|
rm -r $out/share/obs/obs-plugins
|
|
# Leave some breadcrumbs
|
|
echo 'Plugins are at ${pluginsJoined}/share/obs/obs-plugins' > $out/share/obs/obs-plugins-README
|
|
'';
|
|
|
|
inherit (obs-studio) meta;
|
|
passthru = obs-studio.passthru // {
|
|
passthru.unwrapped = obs-studio;
|
|
};
|
|
}
|