Merge pull request #117847 from SuperSandro2000/jmusicbot
This commit is contained in:
commit
e039d12c85
|
@ -233,6 +233,7 @@
|
|||
./services/audio/alsa.nix
|
||||
./services/audio/jack.nix
|
||||
./services/audio/icecast.nix
|
||||
./services/audio/jmusicbot.nix
|
||||
./services/audio/liquidsoap.nix
|
||||
./services/audio/mpd.nix
|
||||
./services/audio/mpdscribble.nix
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.jmusicbot;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.jmusicbot = {
|
||||
enable = mkEnableOption "jmusicbot, a Discord music bot that's easy to set up and run yourself";
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
description = ''
|
||||
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" ];
|
||||
after = [ "network-online.target" ];
|
||||
description = "Discord music bot that's easy to set up and run yourself!";
|
||||
serviceConfig = mkMerge [{
|
||||
ExecStart = "${pkgs.jmusicbot}/bin/JMusicBot";
|
||||
WorkingDirectory = cfg.stateDir;
|
||||
Restart = "always";
|
||||
RestartSec = 20;
|
||||
DynamicUser = true;
|
||||
}
|
||||
(mkIf (cfg.stateDir == "/var/lib/jmusicbot") { StateDirectory = "jmusicbot"; })];
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ SuperSandro2000 ];
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{ stdenv, lib, fetchurl, makeWrapper, jre }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "JMusicBot";
|
||||
version = "0.3.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/jagrosh/MusicBot/releases/download/${version}/JMusicBot-${version}.jar";
|
||||
sha256 = "sha256-++/ot9k74pkN9Wl7IEjiMIv/q5zklIEdU6uFjam0tmU=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
cp $src $out/lib/JMusicBot
|
||||
|
||||
makeWrapper ${jre}/bin/java $out/bin/JMusicBot \
|
||||
--add-flags "-Xmx1G -Dnogui=true -jar $out/lib/JMusicBot"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Discord music bot that's easy to set up and run yourself";
|
||||
homepage = "https://github.com/jagrosh/MusicBot";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ SuperSandro2000 ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
|
@ -23078,6 +23078,8 @@ in
|
|||
jdk = callPackage ../development/compilers/jetbrains-jdk { };
|
||||
});
|
||||
|
||||
jmusicbot = callPackage ../applications/audio/jmusicbot { };
|
||||
|
||||
libquvi = callPackage ../applications/video/quvi/library.nix { };
|
||||
|
||||
librespot = callPackage ../applications/audio/librespot {
|
||||
|
|
Loading…
Reference in New Issue