2020-10-12 00:22:58 +00:00
{ config , lib , pkgs , . . . }:
with lib ;
let
cfg = config . services . pulseeffects ;
presetOpts = optionalString ( cfg . preset != " " ) " - - l o a d - p r e s e t ${ cfg . preset } " ;
in {
meta . maintainers = [ maintainers . jonringer ] ;
options . services . pulseeffects = {
2021-11-04 16:42:44 +00:00
enable = mkEnableOption ''
Pulseeffects daemon
Note , it is necessary to add
< programlisting language = " n i x " >
programs . dconf . enable = true ;
< /programlisting >
to your system configuration for the daemon to work correctly'' ;
2020-10-12 00:22:58 +00:00
2021-07-02 22:36:30 +00:00
package = mkOption {
type = types . package ;
2021-11-04 16:42:44 +00:00
default = pkgs . pulseeffects-legacy ;
defaultText = literalExpression " p k g s . p u l s e e f f e c t s - l e g a c y " ;
2021-07-02 22:36:30 +00:00
description = " P u l s e e f f e c t s p a c k a g e t o u s e . " ;
} ;
2020-10-12 00:22:58 +00:00
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 {
2021-11-04 16:42:44 +00:00
assertions = [
( lib . hm . assertions . assertPlatform " s e r v i c e s . p u l s e e f f e c t s " pkgs
lib . platforms . linux )
] ;
2020-10-12 00:22:58 +00:00
# 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"
2021-07-02 22:36:30 +00:00
home . packages = [ cfg . package pkgs . at-spi2-core ] ;
2020-10-12 00:22:58 +00:00
systemd . user . services . pulseeffects = {
Unit = {
Description = " P u l s e e f f e c t s d a e m o n " ;
Requires = [ " d b u s . s e r v i c e " ] ;
After = [ " g r a p h i c a l - s e s s i o n - p r e . t a r g e t " ] ;
PartOf = [ " g r a p h i c a l - s e s s i o n . t a r g e t " " p u l s e a u d i o . s e r v i c e " ] ;
} ;
Install = { WantedBy = [ " g r a p h i c a l - s e s s i o n . t a r g e t " ] ; } ;
Service = {
ExecStart =
2021-07-02 22:36:30 +00:00
" ${ cfg . package } / b i n / p u l s e e f f e c t s - - g a p p l i c a t i o n - s e r v i c e ${ presetOpts } " ;
ExecStop = " ${ cfg . package } / b i n / p u l s e e f f e c t s - - q u i t " ;
2020-10-12 00:22:58 +00:00
Restart = " o n - f a i l u r e " ;
RestartSec = 5 ;
} ;
} ;
} ;
}