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
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"
home . packages = with pkgs ; [ easyeffects at-spi2-core ] ;
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 =
" ${ pkgs . easyeffects } / 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 = " ${ pkgs . easyeffects } / b i n / e a s y e f f e c t s - - q u i t " ;
Restart = " o n - f a i l u r e " ;
RestartSec = 5 ;
} ;
} ;
} ;
}