1 { config, lib, pkgs, ... }:
6 cfg = config.services.ympd;
15 enable = mkEnableOption "ympd, the MPD Web GUI";
18 type = types.either types.str types.port; # string for backwards compat
20 description = "The port where ympd's web interface will be available.";
21 example = "ssl://8080:/path/to/ssl-private-key.pem";
27 default = "localhost";
28 description = "The host where MPD is listening.";
33 default = config.services.mpd.network.port;
34 defaultText = literalExpression "config.services.mpd.network.port";
35 description = "The port where MPD is listening.";
47 config = mkIf cfg.enable {
49 systemd.services.ympd = {
50 description = "Standalone MPD Web GUI written in C";
52 wantedBy = [ "multi-user.target" ];
53 wants = [ "network-online.target" ];
54 after = [ "network-online.target" ];
58 ${pkgs.ympd}/bin/ympd \
59 --host ${cfg.mpd.host} \
60 --port ${toString cfg.mpd.port} \
61 --webport ${toString cfg.webPort}
65 NoNewPrivileges = true;
67 ProtectProc = "invisible";
68 ProtectSystem = "strict";
69 ProtectHome = "tmpfs";
72 PrivateDevices = true;
75 ProtectHostname = true;
77 ProtectKernelTunables = true;
78 ProtectKernelModules = true;
79 ProtectKernelLogs = true;
80 ProtectControlGroups = true;
82 RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
83 RestrictRealtime = true;
84 RestrictSUIDSGID = true;