at 22.05-pre 991 B view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 dataDir = "/var/lib/squeezelite"; 7 cfg = config.services.squeezelite; 8 9in { 10 11 ###### interface 12 13 options = { 14 15 services.squeezelite= { 16 17 enable = mkEnableOption "Squeezelite, a software Squeezebox emulator"; 18 19 extraArguments = mkOption { 20 default = ""; 21 type = types.str; 22 description = '' 23 Additional command line arguments to pass to Squeezelite. 24 ''; 25 }; 26 27 }; 28 29 }; 30 31 32 ###### implementation 33 34 config = mkIf cfg.enable { 35 36 systemd.services.squeezelite= { 37 wantedBy = [ "multi-user.target" ]; 38 after = [ "network.target" "sound.target" ]; 39 description = "Software Squeezebox emulator"; 40 serviceConfig = { 41 DynamicUser = true; 42 ExecStart = "${pkgs.squeezelite}/bin/squeezelite -N ${dataDir}/player-name ${cfg.extraArguments}"; 43 StateDirectory = builtins.baseNameOf dataDir; 44 SupplementaryGroups = "audio"; 45 }; 46 }; 47 48 }; 49 50}