2021-08-11 15:21:43 +00:00
{ config , lib , pkgs , . . . }:
with lib ;
let
cfg = config . services . easyeffects ;
presetOpts = optionalString ( cfg . preset != " " ) " - - l o a d - p r e s e t ${ cfg . preset } " ;
in {
meta . maintainers = [ maintainers . fufexan ] ;
options . services . easyeffects = {
enable = mkEnableOption ''
Easyeffects daemon .
Note , it is necessary to add
< programlisting language = " n i x " >
2021-09-23 20:28:53 +00:00
programs . dconf . enable = true ;
2021-08-11 15:21:43 +00:00
< /programlisting >
2021-09-23 20:28:53 +00:00
to your system configuration for the daemon to work correctly'' ;
2021-08-11 15:21:43 +00:00
2023-01-06 04:49:20 +00:00
package = mkOption {
type = types . package ;
default = pkgs . easyeffects ;
defaultText = literalExpression " p k g s . e a s y e f f e c t s " ;
description = " T h e < l i t e r a l > e a s y e f f e c t s < / l i t e r a l > p a c k a g e t o u s e . " ;
} ;
2021-08-11 15:21:43 +00:00
preset = mkOption {
type = types . str ;
default = " " ;
description = ''
Which preset to use when starting easyeffects .
Will likely need to launch easyeffects to initially create preset .
'' ;
} ;
} ;
config = mkIf cfg . enable {
assertions = [
( hm . assertions . assertPlatform " s e r v i c e s . e a s y e f f e c t s " pkgs platforms . linux )
] ;
# running easyeffects 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"
2023-01-06 04:49:20 +00:00
home . packages = with pkgs ; [ cfg . package at-spi2-core ] ;
2021-08-11 15:21:43 +00:00
systemd . user . services . easyeffects = {
Unit = {
Description = " E a s y 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 i p e w i r e . 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 =
2023-01-06 04:49:20 +00:00
" ${ cfg . package } / b i n / e a s y 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 / e a s y e f f e c t s - - q u i t " ;
2021-08-11 15:21:43 +00:00
Restart = " o n - f a i l u r e " ;
RestartSec = 5 ;
} ;
} ;
} ;
}