!qol(restructure): heavy restructure
This commit is contained in:
68
modules/obs/home.nix
Normal file
68
modules/obs/home.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.modules.obs;
|
||||
in
|
||||
{
|
||||
options.modules.obs = {
|
||||
enable = lib.mkEnableOption "obs";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
obs-studio = {
|
||||
enable = true;
|
||||
package = (
|
||||
pkgs.obs-studio.override {
|
||||
cudaSupport = true;
|
||||
}
|
||||
);
|
||||
plugins = with pkgs.obs-studio-plugins; [
|
||||
obs-pipewire-audio-capture
|
||||
obs-vkcapture
|
||||
];
|
||||
};
|
||||
};
|
||||
systemd.user.services.pw-discordaudio-virtual-device = {
|
||||
Install = {
|
||||
WantedBy = [ "hyprland-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.writeShellScript "discord_audio_virt_device" ''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
pw-loopback -m '[ FL FR]' --capture-props='media.class=Audio/Sink node.name=DiscordSink' -n DiscordSink
|
||||
''}";
|
||||
};
|
||||
};
|
||||
systemd.user.services.pw-gameaudio-virtual-device = {
|
||||
Install = {
|
||||
WantedBy = [ "hyprland-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.writeShellScript "game_audio_virt_device" ''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
pw-loopback -m '[ FL FR]' --capture-props='media.class=Audio/Sink node.name=GameAudioSink' -n GameAudioSink
|
||||
''}";
|
||||
};
|
||||
};
|
||||
systemd.user.services.obs-autostart = lib.mkIf cfg.enable {
|
||||
Unit = {
|
||||
Description = "OBS daemon";
|
||||
After = [ "hyprland-session.target" ];
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
Service = {
|
||||
# wait for hyprland to start
|
||||
ExecStart = "${config.programs.obs-studio.finalPackage}/bin/obs --startreplaybuffer";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user