mirror of
https://git.oat.zone/dark-firepit/dotfiles
synced 2024-05-10 10:16:09 +02:00
jmusicbot; bump nixpkgs
This commit is contained in:
parent
8f7b533c01
commit
1fe3e70b17
60
flake.lock
60
flake.lock
|
@ -8,11 +8,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677126346,
|
||||
"narHash": "sha256-4s+PPGC1M07QsPyeye5drc2JLa1lhDnCV3XAsG8+pH4=",
|
||||
"lastModified": 1677969766,
|
||||
"narHash": "sha256-AIp/ZYZMNLDZR/H7iiAlaGpu4lcXsVt9JQpBlf43HRY=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "c2a71c83c70844c5e31db69347e86af080bcdad0",
|
||||
"rev": "03b51fe8e459a946c4b88dcfb6446e45efb2c24e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -51,11 +51,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677230984,
|
||||
"narHash": "sha256-ZylMGL99KwOyIM0M0nfjAY9iJTy3+MVn6RS1S+cU6Os=",
|
||||
"lastModified": 1679283474,
|
||||
"narHash": "sha256-vlJOZZ07XURH8ZZG6Eg/pOuUKhul5bcWkvd+nwrY0Yw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "d1e73fcb8e45abaa402de149c2e678e03388e801",
|
||||
"rev": "794b5765f0dcab8a80d0875d1ee04aad9e220cb8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -170,11 +170,11 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677162463,
|
||||
"narHash": "sha256-wjZbwJvIagJ0i82LYm3eIHNsqwblOjIzAyegA3z9olA=",
|
||||
"lastModified": 1679277046,
|
||||
"narHash": "sha256-5E/Cd1PdYwN0bfR3dyyTQ2Wu5ADK3pg/Z+viAtfaP70=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"rev": "60e37d727def25c87a3fd6c47751c05f6082260f",
|
||||
"rev": "d23bbd1687a5413fb7f2c08b67692d4e64f8efef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -211,11 +211,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676681260,
|
||||
"narHash": "sha256-R2FvbPzgvDSVs0jCUA9CMDIgw4F6exF8cR+y3Yea5jQ=",
|
||||
"lastModified": 1678893556,
|
||||
"narHash": "sha256-FHhBetkV/S7M9BMpbCzUWX/P5E7tGE4mZIpj/2m0K2M=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprpaper",
|
||||
"rev": "2bc88dc8c220db674f458432aec0ac0d9ea6a640",
|
||||
"rev": "61961973cfd10853b32c7f904cdb88f9ab6d84dd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -231,11 +231,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1675424503,
|
||||
"narHash": "sha256-XbWDq5tCUWrb+AmQT9b66OGeYHipLRAukvbl9rzkwYg=",
|
||||
"lastModified": 1678372307,
|
||||
"narHash": "sha256-wb1oXsaM0AkThPJGjn0Ytxt8vbBQG+mg2AGY0uxhUJ0=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprpicker",
|
||||
"rev": "e4c267292a8b983bf84929fdce01cd2b7513518e",
|
||||
"rev": "234c2da51a71941c0cd2ee380f42de365f90dd6f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -292,11 +292,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677203082,
|
||||
"narHash": "sha256-+YOnn59f6CqlLPn8kGZdi1f1xdU6I1r6atEXLTpjnbc=",
|
||||
"lastModified": 1679276580,
|
||||
"narHash": "sha256-3+YDy2BQuIWauD7oHZZDU0uRC2c0cOWdyRZW3ss76VY=",
|
||||
"owner": "Infinidoge",
|
||||
"repo": "nix-minecraft",
|
||||
"rev": "5434654e6f76789884f1db0fb013fe651004f9af",
|
||||
"rev": "710b88f976c522deb1306b0310429b4bef3cff39",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -307,11 +307,11 @@
|
|||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1677232326,
|
||||
"narHash": "sha256-rAk2/80kLvA3yIMmSV86T1B4kNvwCFMSQ1FxXndaUB0=",
|
||||
"lastModified": 1679224149,
|
||||
"narHash": "sha256-TSY37Zv0icF/aijR3/KWGLVBlnKKHlG9QTj7vHbF/UU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "2d44015779cced4eec9df5b8dab238b9f6312cb2",
|
||||
"rev": "a4bc66709604ab78abc575b60baa6d23ae027a59",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -338,11 +338,11 @@
|
|||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1677063315,
|
||||
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
|
||||
"lastModified": 1679172431,
|
||||
"narHash": "sha256-XEh5gIt5otaUbEAPUY5DILUTyWe1goAyeqQtmwaFPyI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "988cc958c57ce4350ec248d2d53087777f9e1949",
|
||||
"rev": "1603d11595a232205f03d46e635d919d1e1ec5b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -369,11 +369,11 @@
|
|||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1677063315,
|
||||
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
|
||||
"lastModified": 1679172431,
|
||||
"narHash": "sha256-XEh5gIt5otaUbEAPUY5DILUTyWe1goAyeqQtmwaFPyI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "988cc958c57ce4350ec248d2d53087777f9e1949",
|
||||
"rev": "1603d11595a232205f03d46e635d919d1e1ec5b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -536,11 +536,11 @@
|
|||
"flake": false,
|
||||
"locked": {
|
||||
"host": "gitlab.freedesktop.org",
|
||||
"lastModified": 1675374853,
|
||||
"narHash": "sha256-BSrjNcddYWhFUMtjGwxiEXw67MYRaIHGvLn19Mvm1NE=",
|
||||
"lastModified": 1677789111,
|
||||
"narHash": "sha256-dWrk+Q3bLdtFe5rkyaAKWCQJCeE/KFNllcu1DvBC38c=",
|
||||
"owner": "wlroots",
|
||||
"repo": "wlroots",
|
||||
"rev": "677a3f2f8847ed2de49dd60868f9d9487a546f58",
|
||||
"rev": "5ae17de23f5fd9bb252a698f3771c840280e2c05",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -164,6 +164,56 @@ in {
|
|||
autoCreatedWorldSize = "large";
|
||||
dataDir = "/var/lib/terraria";
|
||||
};
|
||||
|
||||
jmusicbot = let
|
||||
baseOptions = {
|
||||
owner = 276416332894044160;
|
||||
game = "Listening to your heartbeat :heart";
|
||||
status = "ONLINE";
|
||||
songinstatus = true;
|
||||
|
||||
success = "<:observer:1004408859831586907>";
|
||||
warning = "<:slugclose:1000202980403974144>";
|
||||
error = "🚫!!!!! 🚫🚫🚫 >:((((";
|
||||
loading = "<:handsl:966010145698086993><:handsr:966010145886830692>";
|
||||
searching = "<:scripulous_fingore_point:1012777703323222087><:scripulous_fingore:1012777704455667754>";
|
||||
|
||||
npimages = true;
|
||||
stayinchannel = true;
|
||||
|
||||
aliases = {
|
||||
nowplaying = [ "np" "current" ];
|
||||
play = [ "p" ];
|
||||
queue = [ "list" "q" ];
|
||||
remove = [ "delete" "d" ];
|
||||
skip = [ "s" ];
|
||||
forceskip = [ "fs" ];
|
||||
movetrack = [ "move" "m" ];
|
||||
};
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
instances = {
|
||||
"jomble" = {
|
||||
enable = true;
|
||||
package = pkgs.unstable.jmusicbot;
|
||||
|
||||
options = baseOptions // {
|
||||
token = lib.removeSuffix "\n" (builtins.readFile /etc/jomble_token);
|
||||
prefix = ";";
|
||||
};
|
||||
};
|
||||
"jillo" = {
|
||||
enable = true;
|
||||
package = lib.trace "${pkgs.unstable.jmusicbot.version}" pkgs.unstable.jmusicbot;
|
||||
|
||||
options = baseOptions // {
|
||||
token = lib.removeSuffix "\n" (builtins.readFile /etc/jillo_token);
|
||||
prefix = ":";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,362 @@
|
|||
{ pkgs, lib, config, options, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.services.jmusicbot;
|
||||
in {
|
||||
options.modules.services.jmusicbot = {
|
||||
enable = mkOption {
|
||||
description = ''
|
||||
JMusicBot is a self-hostable Discord music bot. This service lets
|
||||
you host multiple instances of it with seperate configurations.
|
||||
'';
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
instances = mkOption {
|
||||
default = {};
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.jmusicbot;
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
description = ''
|
||||
The JMusicBot config, see here: https://jmusicbot.com/config/
|
||||
'';
|
||||
type = types.submodule {
|
||||
options = {
|
||||
token = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
This sets the token for the bot to log in with
|
||||
This MUST be a bot token (user tokens will not work)
|
||||
If you don't know how to get a bot token, please see the guide here:
|
||||
https://github.com/jagrosh/MusicBot/wiki/Getting-a-Bot-Token
|
||||
'';
|
||||
};
|
||||
|
||||
owner = mkOption {
|
||||
type = types.int;
|
||||
description = ''
|
||||
This sets the owner of the bot
|
||||
This needs to be the owner's ID (a 17-18 digit number)
|
||||
https://github.com/jagrosh/MusicBot/wiki/Finding-Your-User-ID
|
||||
'';
|
||||
default = 0;
|
||||
};
|
||||
|
||||
prefix = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
This sets the prefix for the bot
|
||||
The prefix is used to control the commands
|
||||
If you use !!, the play command will be !!play
|
||||
If you do not set this, the prefix will be a mention of the bot (@Botname play)
|
||||
'';
|
||||
default = "@mention";
|
||||
};
|
||||
|
||||
game = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, it modifies the default game of the bot
|
||||
Set this to NONE to have no game
|
||||
Set this to DEFAULT to use the default game
|
||||
You can make the game "Playing X", "Listening to X", or "Watching X"
|
||||
where X is the title. If you don't include an action, it will use the
|
||||
default of "Playing"
|
||||
'';
|
||||
default = "DEFAULT";
|
||||
};
|
||||
|
||||
status = mkOption {
|
||||
type = types.enum ["ONLINE" "IDLE" "DND" "INVISIBLE"];
|
||||
description = ''
|
||||
If you set this, it will modify the default status of bot
|
||||
Valid values: ONLINE IDLE DND INVISIBLE
|
||||
'';
|
||||
default = "ONLINE";
|
||||
};
|
||||
|
||||
songinstatus = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If you set this to true, the bot will list the title of the song it is currently playing in its
|
||||
"Playing" status. Note that this will ONLY work if the bot is playing music on ONE guild;
|
||||
if the bot is playing on multiple guilds, this will not work.
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
|
||||
altprefix = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, the bot will also use this prefix in addition to
|
||||
the one provided above
|
||||
'';
|
||||
default = "NONE";
|
||||
};
|
||||
|
||||
success = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, the bot will also use this prefix in addition to
|
||||
the one provided above
|
||||
'';
|
||||
default = "🎶";
|
||||
};
|
||||
warning = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, the bot will also use this prefix in addition to
|
||||
the one provided above
|
||||
'';
|
||||
default = "💡";
|
||||
};
|
||||
error = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, the bot will also use this prefix in addition to
|
||||
the one provided above
|
||||
'';
|
||||
default = "🚫";
|
||||
};
|
||||
loading = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, the bot will also use this prefix in addition to
|
||||
the one provided above
|
||||
'';
|
||||
default = "⌚";
|
||||
};
|
||||
searching = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, the bot will also use this prefix in addition to
|
||||
the one provided above
|
||||
'';
|
||||
default = "🔎";
|
||||
};
|
||||
|
||||
help = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
If you set this, you change the word used to view the help.
|
||||
For example, if you set the prefix to !! and the help to cmds, you would type
|
||||
!!cmds to see the help text
|
||||
'';
|
||||
default = "help";
|
||||
};
|
||||
|
||||
npimages = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If you set this, the "nowplaying" command will show youtube thumbnails
|
||||
Note: If you set this to true, the nowplaying boxes will NOT refresh
|
||||
This is because refreshing the boxes causes the image to be reloaded
|
||||
every time it refreshes.
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
|
||||
stayinchannel = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If you set this, the bot will not leave a voice channel after it finishes a queue.
|
||||
Keep in mind that being connected to a voice channel uses additional bandwith,
|
||||
so this option is not recommended if bandwidth is a concern.
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
|
||||
maxtime = mkOption {
|
||||
type = types.int;
|
||||
description = ''
|
||||
This sets the maximum amount of seconds any track loaded can be. If not set or set
|
||||
to any number less than or equal to zero, there is no maximum time length. This time
|
||||
restriction applies to songs loaded from any source.
|
||||
'';
|
||||
default = 0;
|
||||
};
|
||||
|
||||
alonetimeuntilstop = mkOption {
|
||||
type = types.int;
|
||||
description = ''
|
||||
This sets the amount of seconds the bot will stay alone on a voice channel until it
|
||||
automatically leaves the voice channel and clears the queue. If not set or set
|
||||
to any number less than or equal to zero, the bot won't leave when alone.
|
||||
'';
|
||||
default = 0;
|
||||
};
|
||||
|
||||
playlistsfolder = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
This sets an alternative folder to be used as the Playlists folder
|
||||
This can be a relative or absolute path
|
||||
'';
|
||||
default = "Playlists";
|
||||
};
|
||||
|
||||
updatealerts = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
By default, the bot will DM the owner if the bot is running and a new version of the bot
|
||||
becomes available. Set this to false to disable this feature.
|
||||
'';
|
||||
default = true;
|
||||
};
|
||||
|
||||
"lyrics.default" = mkOption {
|
||||
type = types.enum ["A-Z Lyrics" "Genius" "MusicMatch" "LyricsFreak"];
|
||||
description = ''
|
||||
Changing this changes the lyrics provider
|
||||
Currently available providers: "A-Z Lyrics", "Genius", "MusicMatch", "LyricsFreak"
|
||||
At the time of writing, I would recommend sticking with A-Z Lyrics or MusicMatch,
|
||||
as Genius tends to have a lot of non-song results and you might get something
|
||||
completely unrelated to what you want.
|
||||
If you are interested in contributing a provider, please see
|
||||
https://github.com/jagrosh/JLyrics
|
||||
'';
|
||||
default = "A-Z Lyrics";
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.attrsOf (types.listOf types.str);
|
||||
description = ''
|
||||
These settings allow you to configure custom aliases for all commands.
|
||||
Multiple aliases may be given, separated by commas.
|
||||
|
||||
Example 1: Giving command "play" the alias "p":
|
||||
play = [ p ]
|
||||
|
||||
Example 2: Giving command "search" the aliases "yts" and "find":
|
||||
search = [ yts, find ]
|
||||
'';
|
||||
default = {
|
||||
settings = [ "status" ];
|
||||
lyrics = [];
|
||||
nowplaying = [ "np" "current" ];
|
||||
play = [];
|
||||
playlists = [ "pls" ];
|
||||
queue = [ "list" ];
|
||||
remove = [ "delete" ];
|
||||
scsearch = [];
|
||||
search = [ "ytsearch" ];
|
||||
shuffle = [];
|
||||
skip = [ "voteskip" ];
|
||||
prefix = [ "setprefix" ];
|
||||
setdj = [];
|
||||
settc = [];
|
||||
setvc = [];
|
||||
forceremove = [ "forcedelete" "modremove" "moddelete" ];
|
||||
forceskip = [ "modskip" ];
|
||||
movetrack = [ "move" ];
|
||||
pause = [];
|
||||
playnext = [];
|
||||
repeat = [];
|
||||
skipto = [ "jumpto" ];
|
||||
stop = [];
|
||||
volume = [ "vol" ];
|
||||
};
|
||||
};
|
||||
|
||||
eval = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If you set this to true, it will enable the eval command for the bot owner. This command
|
||||
allows the bot owner to run arbitrary code from the bot's account.
|
||||
|
||||
WARNING:
|
||||
This command can be extremely dangerous. If you don't know what you're doing, you could
|
||||
cause horrific problems on your Discord server or on whatever computer this bot is running
|
||||
on. Never run this command unless you are completely positive what you are running.
|
||||
|
||||
DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT THIS DOES OR HOW TO USE IT
|
||||
IF SOMEONE ASKS YOU TO ENABLE THIS, THERE IS AN 11/10 CHANCE THEY ARE TRYING TO SCAM YOU
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
dataDir = "/var/lib/jmusicbot";
|
||||
|
||||
# nabbed from https://github.com/NixOS/nixpkgs/blob/61d8fdca02b4647be8d38a94c6f53a7cf072d717/nixos/modules/services/networking/jitsi-videobridge.nix#L11
|
||||
toHOCON = x: if isAttrs x && x ? __hocon_envvar then ("\${" + x.__hocon_envvar + "}")
|
||||
else if isAttrs x then "{${ concatStringsSep "," (mapAttrsToList (k: v: ''"${k}":${toHOCON v}'') x) }}"
|
||||
else if isList x then "[${ concatMapStringsSep "," toHOCON x }]"
|
||||
else builtins.toJSON x;
|
||||
in mkIf cfg.enable {
|
||||
users.users.jmusicbot = {
|
||||
group = "jmusicbot";
|
||||
home = dataDir;
|
||||
createHome = true;
|
||||
isSystemUser = true;
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
};
|
||||
|
||||
users.groups.jmusicbot = {};
|
||||
|
||||
system.activationScripts.jmusicbot-data-dir.text = ''
|
||||
mkdir -p ${dataDir}
|
||||
chown jmusicbot:jmusicbot ${dataDir}
|
||||
chmod -R 775 ${dataDir}
|
||||
'';
|
||||
|
||||
systemd.services = mapAttrs'
|
||||
(name: conf:
|
||||
let
|
||||
stateDir = "${dataDir}/${name}/";
|
||||
configFile = builtins.toFile "config.txt" (toHOCON conf.options);
|
||||
in {
|
||||
name = "jmusicbot-${name}";
|
||||
value = {
|
||||
enable = conf.enable;
|
||||
|
||||
# referencing https://jmusicbot.com/running-as-a-service/
|
||||
|
||||
description = "JMusicBot instance ${name}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
requires = [ "network.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = pkgs.writeScript "jmusicbot-start-${name}" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
|
||||
umask u=rwx,g=rwx,o=rx
|
||||
cd ${stateDir}
|
||||
${getExe conf.package} -Dconfig=${configFile}
|
||||
'';
|
||||
Restart = "always";
|
||||
RestartSec = 20;
|
||||
User = "jmusicbot";
|
||||
};
|
||||
|
||||
preStart = ''
|
||||
umask u=rwx,g=rwx,o=rx
|
||||
mkdir -p ${stateDir}
|
||||
cd ${stateDir}
|
||||
ln -sf ${configFile} config.txt
|
||||
'';
|
||||
};
|
||||
}
|
||||
) cfg.instances;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue