1 { config, lib, pkgs, ... }:
4 inherit (lib) mkEnableOption mkIf mkOption optionalString types;
6 dataDir = "/var/lib/squeezelite";
7 cfg = config.services.squeezelite;
8 pkg = if cfg.pulseAudio then pkgs.squeezelite-pulse else pkgs.squeezelite;
9 bin = "${pkg}/bin/${pkg.pname}";
16 options.services.squeezelite = {
17 enable = mkEnableOption "Squeezelite, a software Squeezebox emulator";
19 pulseAudio = mkEnableOption "pulseaudio support";
21 extraArguments = mkOption {
25 Additional command line arguments to pass to Squeezelite.
33 config = mkIf cfg.enable {
34 systemd.services.squeezelite = {
35 wantedBy = [ "multi-user.target" ];
36 after = [ "network.target" "sound.target" ];
37 description = "Software Squeezebox emulator";
40 ExecStart = "${bin} -N ${dataDir}/player-name ${cfg.extraArguments}";
41 StateDirectory = builtins.baseNameOf dataDir;
42 SupplementaryGroups = "audio";