1 { pkgs, lib, config, utils, ... }:
6 cfg = config.services.gmediarender;
9 options.services.gmediarender = {
10 enable = mkEnableOption "the gmediarender DLNA renderer";
12 audioDevice = mkOption {
13 type = types.nullOr types.str;
16 The audio device to use.
20 audioSink = mkOption {
21 type = types.nullOr types.str;
24 The audio sink to use.
28 friendlyName = mkOption {
29 type = types.nullOr types.str;
32 A "friendly name" for identifying the endpoint.
36 initialVolume = mkOption {
37 type = types.nullOr types.int;
40 A default volume attenuation (in dB) for the endpoint.
44 package = mkPackageOption pkgs "gmediarender" {
45 default = "gmrender-resurrect";
49 type = types.nullOr types.port;
51 description = "Port that will be used to accept client connections.";
55 type = types.nullOr types.str;
58 A UUID for uniquely identifying the endpoint. If you have
59 multiple renderers on your network, you MUST set this.
64 config = mkIf cfg.enable {
66 services.gmediarender = {
67 wants = [ "network-online.target" ];
68 after = [ "network-online.target" ];
69 wantedBy = [ "multi-user.target" ];
70 description = "gmediarender server daemon";
72 XDG_CACHE_HOME = "%t/gmediarender";
76 User = "gmediarender";
77 Group = "gmediarender";
78 SupplementaryGroups = [ "audio" ];
80 "${cfg.package}/bin/gmediarender " +
81 optionalString (cfg.audioDevice != null) ("--gstout-audiodevice=${utils.escapeSystemdExecArg cfg.audioDevice} ") +
82 optionalString (cfg.audioSink != null) ("--gstout-audiosink=${utils.escapeSystemdExecArg cfg.audioSink} ") +
83 optionalString (cfg.friendlyName != null) ("--friendly-name=${utils.escapeSystemdExecArg cfg.friendlyName} ") +
84 optionalString (cfg.initialVolume != 0) ("--initial-volume=${toString cfg.initialVolume} ") +
85 optionalString (cfg.port != null) ("--port=${toString cfg.port} ") +
86 optionalString (cfg.uuid != null) ("--uuid=${utils.escapeSystemdExecArg cfg.uuid} ");
88 RuntimeDirectory = "gmediarender";
91 CapabilityBoundingSet = "";
92 LockPersonality = true;
93 MemoryDenyWriteExecute = true;
94 NoNewPrivileges = true;
95 # PrivateDevices = true;
100 ProtectControlGroups = true;
102 ProtectHostname = true;
103 ProtectKernelLogs = true;
104 ProtectKernelModules = true;
105 ProtectKernelTunables = true;
106 ProtectProc = "invisible";
107 RestrictNamespaces = true;
108 RestrictRealtime = true;
109 RestrictSUIDSGID = true;
110 SystemCallArchitectures = "native";
111 SystemCallFilter = [ "@system-service" "~@privileged" ];