1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.ympd;
7in {
8
9 ###### interface
10
11 options = {
12
13 services.ympd = {
14
15 enable = mkEnableOption "ympd, the MPD Web GUI";
16
17 webPort = mkOption {
18 type = types.either types.str types.port; # string for backwards compat
19 default = "8080";
20 description = "The port where ympd's web interface will be available.";
21 example = "ssl://8080:/path/to/ssl-private-key.pem";
22 };
23
24 mpd = {
25 host = mkOption {
26 type = types.str;
27 default = "localhost";
28 description = "The host where MPD is listening.";
29 };
30
31 port = mkOption {
32 type = types.int;
33 default = config.services.mpd.network.port;
34 description = "The port where MPD is listening.";
35 example = 6600;
36 };
37 };
38
39 };
40
41 };
42
43
44 ###### implementation
45
46 config = mkIf cfg.enable {
47
48 systemd.services.ympd = {
49 description = "Standalone MPD Web GUI written in C";
50 wantedBy = [ "multi-user.target" ];
51 serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host ${cfg.mpd.host} --port ${toString cfg.mpd.port} --webport ${toString cfg.webPort} --user nobody";
52 };
53
54 };
55
56}