diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f81efc4b..c4b70cea 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -129,6 +129,8 @@ /modules/services/pasystray.nix @pltanton +/modules/services/pulseeffects.nix @jonringer + /modules/services/random-background.nix @rycee /modules/services/redshift.nix @rycee diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 041c8d47..b9ab2c5d 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1481,6 +1481,14 @@ in A new module is available: 'programs.lf' ''; } + + { + time = "2020-04-26T13:46:28+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.pulseeffects' + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 21db8b37..e44c1097 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -146,6 +146,7 @@ let (loadModule ./services/pasystray.nix { }) (loadModule ./services/picom.nix { }) (loadModule ./services/polybar.nix { }) + (loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/random-background.nix { }) (loadModule ./services/redshift.nix { }) (loadModule ./services/rsibreak.nix { condition = hostPlatform.isLinux; }) diff --git a/modules/services/pulseeffects.nix b/modules/services/pulseeffects.nix new file mode 100644 index 00000000..af6cebe1 --- /dev/null +++ b/modules/services/pulseeffects.nix @@ -0,0 +1,52 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.pulseeffects; + + presetOpts = optionalString (cfg.preset != "") "--load-preset ${cfg.preset}"; + +in { + meta.maintainers = [ maintainers.jonringer ]; + + options.services.pulseeffects = { + enable = mkEnableOption "Pulseeffects daemon"; + + preset = mkOption { + type = types.str; + default = ""; + description = '' + Which preset to use when starting pulseeffects. + Will likely need to launch pulseeffects to initially create preset. + ''; + }; + }; + + config = mkIf cfg.enable { + # running pulseeffects will just attach itself to gapplication service + # at-spi2-core is to minimize journalctl noise of: + # "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files" + home.packages = [ pkgs.pulseeffects pkgs.at-spi2-core ]; + + # Will need to add `services.dbus.packages = with pkgs; [ gnome3.dconf ];` + # to /etc/nixos/configuration.nix for daemon to work correctly + + systemd.user.services.pulseeffects = { + Unit = { + Description = "Pulseeffects daemon"; + Requires = [ "pulseaudio.service" "dbus.service" ]; + After = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = + "${pkgs.pulseeffects}/bin/pulseeffects --gapplication-service ${presetOpts}"; + ExecStop = "${pkgs.pulseeffects}/bin/pulseeffects --quit"; + Restart = "on-failure"; + RestartSec = 5; + }; + }; + }; +}