mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-31 01:04:25 +00:00
6c5ab28fce
This was done by generating a truly hilarious configuration: rg 'services\.[^.]+\.enable\t' opts-tags | cut -f1 > allonconfig.nix The following were not tested due to other evaluation errors. They should probably be manually audited. services.amule services.castopod services.ceph services.chatgpt-retrieval-plugin services.clamsmtp services.clight services.dante services.dex services.discourse services.dwm-status services.engelsystem services.foundationdb services.frigate services.frp services.grocy services.guacamole-client services.hedgedoc services.home-assistant services.honk services.imaginary services.jitsi-meet services.kerberos_server services.limesurvey services.mastodon services.mediawiki services.mobilizon services.moodle services.mosquitto services.nextcloud services.nullmailer services.patroni services.pfix-srsd services.pgpkeyserver-lite services.postfixadmin services.roundcube services.schleuder services.self-deploy services.slskd services.spacecookie services.statsd services.step-ca services.sympa services.tsmBackup services.vdirsyncer services.vikunja services.yandex-disk services.zabbixWeb
45 lines
1.5 KiB
Nix
45 lines
1.5 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
let
|
|
cfg = config.services.jmusicbot;
|
|
in
|
|
{
|
|
options = {
|
|
services.jmusicbot = {
|
|
enable = mkEnableOption (lib.mdDoc "jmusicbot, a Discord music bot that's easy to set up and run yourself");
|
|
|
|
package = mkPackageOption pkgs "jmusicbot" { };
|
|
|
|
stateDir = mkOption {
|
|
type = types.path;
|
|
description = lib.mdDoc ''
|
|
The directory where config.txt and serversettings.json is saved.
|
|
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.
|
|
Untouched by the value of this option config.txt needs to be placed manually into this directory.
|
|
'';
|
|
default = "/var/lib/jmusicbot/";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.jmusicbot = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "network-online.target" ];
|
|
after = [ "network-online.target" ];
|
|
description = "Discord music bot that's easy to set up and run yourself!";
|
|
serviceConfig = mkMerge [{
|
|
ExecStart = "${cfg.package}/bin/JMusicBot";
|
|
WorkingDirectory = cfg.stateDir;
|
|
Restart = "always";
|
|
RestartSec = 20;
|
|
DynamicUser = true;
|
|
}
|
|
(mkIf (cfg.stateDir == "/var/lib/jmusicbot") { StateDirectory = "jmusicbot"; })];
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ ];
|
|
}
|