2016-06-11 12:46:02 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2018-03-29 08:59:00 +00:00
|
|
|
dataDir = "/var/lib/squeezelite";
|
2019-02-24 00:28:02 +00:00
|
|
|
cfg = config.services.squeezelite;
|
2016-06-11 12:46:02 +00:00
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.squeezelite= {
|
|
|
|
|
|
|
|
enable = mkEnableOption "Squeezelite, a software Squeezebox emulator";
|
|
|
|
|
|
|
|
extraArguments = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
Additional command line arguments to pass to Squeezelite.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
systemd.services.squeezelite= {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target" "sound.target" ];
|
|
|
|
description = "Software Squeezebox emulator";
|
|
|
|
serviceConfig = {
|
2018-03-29 08:59:00 +00:00
|
|
|
DynamicUser = true;
|
|
|
|
ExecStart = "${pkgs.squeezelite}/bin/squeezelite -N ${dataDir}/player-name ${cfg.extraArguments}";
|
|
|
|
StateDirectory = builtins.baseNameOf dataDir;
|
|
|
|
SupplementaryGroups = "audio";
|
2016-06-11 12:46:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|