at 17.09-beta 1.2 kB view raw
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.string; 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.string; 27 default = "localhost"; 28 description = "The host where MPD is listening."; 29 example = "localhost"; 30 }; 31 32 port = mkOption { 33 type = types.int; 34 default = config.services.mpd.network.port; 35 description = "The port where MPD is listening."; 36 example = 6600; 37 }; 38 }; 39 40 }; 41 42 }; 43 44 45 ###### implementation 46 47 config = mkIf cfg.enable { 48 49 systemd.services.ympd = { 50 description = "Standalone MPD Web GUI written in C"; 51 wantedBy = [ "multi-user.target" ]; 52 serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host ${cfg.mpd.host} --port ${toString cfg.mpd.port} --webport ${cfg.webPort} --user nobody"; 53 }; 54 55 }; 56 57}