mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
nixos/obs-studio: nullable package (#356845)
This commit is contained in:
commit
e1cedaabe5
@ -12,10 +12,13 @@ in
|
|||||||
options.programs.obs-studio = {
|
options.programs.obs-studio = {
|
||||||
enable = lib.mkEnableOption "Free and open source software for video recording and live streaming";
|
enable = lib.mkEnableOption "Free and open source software for video recording and live streaming";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "obs-studio" { example = "obs-studio"; };
|
package = lib.mkPackageOption pkgs "obs-studio" {
|
||||||
|
nullable = true;
|
||||||
|
example = "obs-studio";
|
||||||
|
};
|
||||||
|
|
||||||
finalPackage = lib.mkOption {
|
finalPackage = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.nullOr lib.types.package;
|
||||||
visible = false;
|
visible = false;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = "Resulting customized OBS Studio package.";
|
description = "Resulting customized OBS Studio package.";
|
||||||
@ -39,11 +42,16 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
programs.obs-studio.finalPackage = pkgs.wrapOBS.override { obs-studio = cfg.package; } {
|
assertions = lib.singleton {
|
||||||
plugins = cfg.plugins;
|
assertion = cfg.package == null -> cfg.plugins == [ ];
|
||||||
|
message = "Plugins cannot be set if package is null";
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ cfg.finalPackage ];
|
programs.obs-studio.finalPackage = lib.mapNullable (
|
||||||
|
obs-studio: pkgs.wrapOBS.override { inherit obs-studio; } { plugins = cfg.plugins; }
|
||||||
|
) cfg.package;
|
||||||
|
|
||||||
|
environment.systemPackages = lib.optional (cfg.finalPackage != null) cfg.finalPackage;
|
||||||
|
|
||||||
boot = lib.mkIf cfg.enableVirtualCamera {
|
boot = lib.mkIf cfg.enableVirtualCamera {
|
||||||
kernelModules = [ "v4l2loopback" ];
|
kernelModules = [ "v4l2loopback" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user