fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . services . pulseeffects ; 8 9presetOpts = optionalString ( cfg . preset != "" ) "--load-preset ${ cfg . preset } " ; 10 11in { 12meta . maintainers = [ maintainers . jonringer ]; 13 14options . services . pulseeffects = { 15enable = mkEnableOption '' 16Pulseeffects daemon 17Note, it is necessary to add 18```nix 19programs.dconf.enable = true; 20``` 21to your system configuration for the daemon to work correctly'' ; 22 23package = mkOption { 24type = types . package ; 25default = pkgs . pulseeffects-legacy ; 26defaultText = literalExpression "pkgs.pulseeffects-legacy" ; 27description = "Pulseeffects package to use." ; 28}; 29 30preset = mkOption { 31type = types . str ; 32default = "" ; 33description = '' 34Which preset to use when starting pulseeffects. 35Will likely need to launch pulseeffects to initially create preset. 36'' ; 37}; 38}; 39 40config = mkIf cfg . enable { 41assertions = [ 42( lib . hm . assertions . assertPlatform "services.pulseeffects" pkgs 43lib . platforms . linux ) 44]; 45 46# running pulseeffects will just attach itself to gapplication service 47# at-spi2-core is to minimize journalctl noise of: 48# "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files" 49home . packages = [ cfg . package pkgs . at-spi2-core ]; 50 51systemd . user . services . pulseeffects = { 52Unit = { 53Description = "Pulseeffects daemon" ; 54Requires = [ "dbus.service" ]; 55After = [ "graphical-session-pre.target" ]; 56PartOf = [ "graphical-session.target" "pulseaudio.service" ]; 57}; 58 59Install = { WantedBy = [ "graphical-session.target" ]; }; 60 61Service = { 62ExecStart = 63" ${ cfg . package } /bin/pulseeffects --gapplication-service ${ presetOpts } " ; 64ExecStop = " ${ cfg . package } /bin/pulseeffects --quit" ; 65Restart = "on-failure" ; 66RestartSec = 5 ; 67}; 68}; 69}; 70}