2021-08-11 17:21:43 +02: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 = {
2023-07-02 01:45:18 +02:00
enable = mkEnableOption ''
2021-08-11 17:21:43 +02:00
Easyeffects daemon .
Note , it is necessary to add
2023-07-01 01:30:13 +02:00
` ` ` nix
2021-09-23 22:28:53 +02:00
programs . dconf . enable = true ;
2023-07-01 01:30:13 +02:00
` ` `
2023-07-02 01:45:18 +02:00
to your system configuration for the daemon to work correctly'' ;
2021-08-11 17:21:43 +02:00
2023-01-06 05:49:20 +01: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 " ;
2023-07-02 01:45:18 +02:00
description = " T h e ` e a s y e f f e c t s ` p a c k a g e t o u s e . " ;
2023-01-06 05:49:20 +01:00
} ;
2021-08-11 17:21:43 +02:00
preset = mkOption {
type = types . str ;
default = " " ;
2023-07-02 01:45:18 +02:00
description = ''
2021-08-11 17:21:43 +02:00
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 05:49:20 +01:00
home . packages = with pkgs ; [ cfg . package at-spi2-core ] ;
2021-08-11 17:21:43 +02: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 05:49:20 +01: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 17:21:43 +02:00
Restart = " o n - f a i l u r e " ;
RestartSec = 5 ;
} ;
} ;
} ;
}