2016-09-10 18:23:39 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.ympd;
|
|
|
|
in {
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.ympd = {
|
|
|
|
|
2016-09-12 04:47:08 +02:00
|
|
|
enable = mkEnableOption "ympd, the MPD Web GUI";
|
2016-09-10 18:23:39 +02:00
|
|
|
|
|
|
|
webPort = mkOption {
|
2019-04-12 17:53:50 +02:00
|
|
|
type = types.either types.str types.port; # string for backwards compat
|
2016-09-10 18:23:39 +02:00
|
|
|
default = "8080";
|
|
|
|
description = "The port where ympd's web interface will be available.";
|
|
|
|
example = "ssl://8080:/path/to/ssl-private-key.pem";
|
|
|
|
};
|
|
|
|
|
|
|
|
mpd = {
|
|
|
|
host = mkOption {
|
2019-08-08 22:48:27 +02:00
|
|
|
type = types.str;
|
2016-09-10 18:23:39 +02:00
|
|
|
default = "localhost";
|
|
|
|
description = "The host where MPD is listening.";
|
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = config.services.mpd.network.port;
|
2021-11-26 01:16:05 +01:00
|
|
|
defaultText = literalExpression "config.services.mpd.network.port";
|
2016-09-10 18:23:39 +02:00
|
|
|
description = "The port where MPD is listening.";
|
|
|
|
example = 6600;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
systemd.services.ympd = {
|
|
|
|
description = "Standalone MPD Web GUI written in C";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2019-04-12 17:53:50 +02:00
|
|
|
serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host ${cfg.mpd.host} --port ${toString cfg.mpd.port} --webport ${toString cfg.webPort} --user nobody";
|
2016-09-10 18:23:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|