home-manager/modules/programs/obs-studio.nix

56 lines
1.3 KiB
Nix
Raw Normal View History

2018-09-26 05:55:51 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.obs-studio;
mkPluginEnv = packages:
let
pluginDirs = map (pkg: "${pkg}/share/obs/obs-plugins") packages;
plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
2020-02-02 00:39:17 +01:00
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 {
2018-09-26 05:55:51 +02:00
meta.maintainers = [ maintainers.adisbladis ];
options = {
programs.obs-studio = {
enable = mkEnableOption "obs-studio";
package = mkOption {
type = types.package;
default = pkgs.obs-studio;
defaultText = literalExample "pkgs.obs-studio";
description = ''
OBS Studio package to install.
'';
};
2018-09-26 05:55:51 +02:00
plugins = mkOption {
2020-02-02 00:39:17 +01:00
default = [ ];
2018-09-26 05:55:51 +02:00
example = literalExample "[ pkgs.obs-linuxbrowser ]";
description = "Optional OBS plugins.";
type = types.listOf types.package;
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
2018-09-26 05:55:51 +02:00
2020-02-02 00:39:17 +01:00
xdg.configFile."obs-studio/plugins" =
mkIf (cfg.plugins != [ ]) { source = mkPluginEnv cfg.plugins; };
2018-09-26 05:55:51 +02:00
};
}