From ae6da0ecc438ce25d09f0b98fae6b90415ddbf93 Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Fri, 16 Feb 2024 17:41:53 +0100 Subject: [PATCH] made option to set obs autostart behaviour --- systems/common/obs.nix | 31 ++++++++++++++++++++++++------- systems/laptop/default.nix | 4 +++- systems/pc/default.nix | 8 +++++++- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/systems/common/obs.nix b/systems/common/obs.nix index 1397169..c6e3edc 100644 --- a/systems/common/obs.nix +++ b/systems/common/obs.nix @@ -1,15 +1,32 @@ { pkgs, libs, + config, ... -}: { - programs.obs-studio.enable = true; +}: let + cfg = config.services.obs; +in { + options.services.obs = { + autostart = pkgs.lib.mkOption { + type = pkgs.lib.types.bool; + default = false; + }; + }; - xdg.configFile = { - "autostart/obs-autostart.desktop" = libs.mkAutostart { - inherit pkgs; - name = "obs"; - command = "obs --startreplaybuffer"; + config = { + programs.obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [ + obs-source-record + ]; + }; + + xdg.configFile = pkgs.lib.mkIf cfg.autostart { + "autostart/obs-autostart.desktop" = libs.mkAutostart { + inherit pkgs; + name = "obs"; + command = "obs --startreplaybuffer"; + }; }; }; } diff --git a/systems/laptop/default.nix b/systems/laptop/default.nix index 26ce054..57472fa 100644 --- a/systems/laptop/default.nix +++ b/systems/laptop/default.nix @@ -1,4 +1,4 @@ -{...}: { +{pkgs, ...}: { targets.genericLinux.enable = false; programs.bash.shellAliases = { @@ -11,4 +11,6 @@ power-button-action = "hibernate"; }; }; + + services.obs.autostart = false; } diff --git a/systems/pc/default.nix b/systems/pc/default.nix index e2e4504..17b6862 100644 --- a/systems/pc/default.nix +++ b/systems/pc/default.nix @@ -1,4 +1,8 @@ -{...}: { +{ + pkgs, + # options, + ... +}: { targets.genericLinux.enable = false; programs.bash.shellAliases = { @@ -11,4 +15,6 @@ power-button-action = "suspend"; }; }; + + services.obs.autostart = true; }