obs-studio: use wrapobs and the new plugin layout (#2142)

The packaging in nixpkgs for obs plugins has changed and there's a
wrapOBS function.
The name of the plugins has also changed so the example needed updating
to reflect that.

Related: https://github.com/NixOS/nixpkgs/pull/125308
This commit is contained in:
j-k 2021-06-26 22:29:50 +01:00 committed by GitHub
parent 0ada50fc9c
commit 8eee5f5272
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,21 +6,6 @@ let
cfg = config.programs.obs-studio;
mkPluginEnv = packages:
let
pluginDirs = map (pkg: "${pkg}/share/obs/obs-plugins") packages;
plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
in pkgs.runCommand "obs-studio-plugins" {
preferLocalBuild = true;
allowSubstitutes = false;
} ''
mkdir $out
[[ '${plugins}' ]] || exit 0
for plugin in ${plugins}; do
ln -s "$plugin" $out/
done
'';
in {
meta.maintainers = [ maintainers.adisbladis ];
@ -37,9 +22,16 @@ in {
'';
};
finalPackage = mkOption {
type = types.package;
visible = false;
readOnly = true;
description = "Resulting customized OBS Studio package.";
};
plugins = mkOption {
default = [ ];
example = literalExample "[ pkgs.obs-linuxbrowser ]";
example = literalExample "[ pkgs.obs-studio-plugins.wlrobs ]";
description = "Optional OBS plugins.";
type = types.listOf types.package;
};
@ -47,9 +39,10 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."obs-studio/plugins" =
mkIf (cfg.plugins != [ ]) { source = mkPluginEnv cfg.plugins; };
home.packages = [ cfg.finalPackage ];
programs.obs-studio.finalPackage =
pkgs.wrapOBS.override { obs-studio = cfg.package; } {
plugins = cfg.plugins;
};
};
}