From 952839b93f834417f6c2a2f6c1a74e255cfdcf79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Wed, 25 Jun 2025 01:20:17 +0200 Subject: [PATCH] System Gen77 @ 2025-06-25-01:20:16 by jonas@monolith --- modules/hardware/sound.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/hardware/sound.nix b/modules/hardware/sound.nix index 8ef66a7..4efca20 100644 --- a/modules/hardware/sound.nix +++ b/modules/hardware/sound.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, ... }: let cfg = config.hive.sound; @@ -17,6 +18,11 @@ in { default = false; description = "Enable Noisetorch for noise cancellation."; }; + noisetorch-threshold = lib.mkOption { + type = lib.types.int; + default = -1; + description = "Set the noise cancellation threshold for Noisetorch."; + }; }; }; config = lib.mkIf cfg.enable { @@ -36,5 +42,17 @@ in { #media-session.enable = true; }; programs.noisetorch.enable = cfg.noisetorch; + systemd.user.services.noisetorch-autoload = lib.mkIf cfg.noisetorch { + description = "Automatically load Noisetorch on user login"; + after = ["pipewire.service"]; + requires = ["pipewire.service"]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.noisetorch}/bin/noisetorch -l -t ${toString cfg.noisetorch-threshold}"; + ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u"; + RemainAfterExit = true; + }; + wantedBy = ["default.target"]; + }; }; }