8 cfg = config.services.jmusicbot;
12 services.jmusicbot = {
13 enable = lib.mkEnableOption "jmusicbot, a Discord music bot that's easy to set up and run yourself";
15 package = lib.mkPackageOption pkgs "jmusicbot" { };
17 stateDir = lib.mkOption {
18 type = lib.types.path;
20 The directory where config.txt and serversettings.json is saved.
21 If left as the default value this directory will automatically be created before JMusicBot starts, otherwise the sysadmin is responsible for ensuring the directory exists with appropriate ownership and permissions.
22 Untouched by the value of this option config.txt needs to be placed manually into this directory.
24 default = "/var/lib/jmusicbot/";
29 config = lib.mkIf cfg.enable {
30 systemd.services.jmusicbot = {
31 wantedBy = [ "multi-user.target" ];
32 wants = [ "network-online.target" ];
33 after = [ "network-online.target" ];
34 description = "Discord music bot that's easy to set up and run yourself!";
35 serviceConfig = lib.mkMerge [
37 ExecStart = "${cfg.package}/bin/JMusicBot";
38 WorkingDirectory = cfg.stateDir;
43 (lib.mkIf (cfg.stateDir == "/var/lib/jmusicbot") { StateDirectory = "jmusicbot"; })
48 meta.maintainers = [ ];