feat: added discord bot

This commit is contained in:
silver 2023-08-28 18:01:34 +01:00
commit be4ab47ad8
6 changed files with 210 additions and 46 deletions

39
applications/discord.nix Normal file
View file

@ -0,0 +1,39 @@
{ config, pkgs, lib, inputs, ... }:
with lib;
let
cfg = config.services.discord_bot;
in {
imports = [
inputs.skynet_discord_bot.nixosModule."x86_64-linux"
];
options.services.discord_bot = {
enable = mkEnableOption "Skynet LDAP backend server";
};
config = mkIf cfg.enable {
#backups = [ "/etc/silver_ul_ical/database.db" ];
age.secrets.discord_token.file = ../secrets/discord/token.age;
age.secrets.discord_ldap.file = ../secrets/discord/ldap.age;
services.skynet_discord_bot = {
enable = true;
env = {
discord = config.age.secrets.discord_token.path;
ldap = config.age.secrets.discord_ldap.path;
};
discord = {
server = "689189992417067052";
role = {
past = "689192357727436926";
current = "887072218004197418";
};
};
};
};
}

View file

@ -174,6 +174,24 @@
"inputs": {
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1692351612,
"narHash": "sha256-KTGonidcdaLadRnv9KFgwSMh1ZbXoR/OBmPjeNMhFwU=",
"owner": "nix-community",
"repo": "naersk",
"rev": "78789c30d64dea2396c9da516bbcc8db3a475207",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"naersk_2": {
"inputs": {
"nixpkgs": "nixpkgs_7"
},
"locked": {
"lastModified": 1686572087,
"narHash": "sha256-jXTut7ZSYqLEgm/nTk7TuVL2ExahTip605bLINklAnQ=",
@ -234,6 +252,34 @@
"type": "indirect"
}
},
"nixpkgs_10": {
"locked": {
"lastModified": 1689935543,
"narHash": "sha256-6GQ9ib4dA/r1leC5VUpsBo0BmDvNxLjKrX1iyL+h8mc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e43e2448161c0a2c4928abec4e16eae1516571bc",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_11": {
"locked": {
"lastModified": 1690026219,
"narHash": "sha256-oOduRk/kzQxOBknZXTLSEYd7tk+GoKvr8wV6Ab+t4AU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f465da166263bc0d4b39dfd4ca28b777c92d4b73",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1676300157,
@ -281,6 +327,35 @@
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1693060755,
"narHash": "sha256-KNsbfqewEziFJEpPR0qvVz4rx0x6QXxw1CcunRhlFdk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c66ccfa00c643751da2fd9290e096ceaa30493fc",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1693087214,
"narHash": "sha256-Kn1SSqRfPpqcI1MDy82JXrPT1WI8c03TA2F0xu6kS+4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f155f0cf4ea43c4e3c8918d2d327d44777b6cad4",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.05",
"type": "indirect"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1687011986,
"narHash": "sha256-ZNSi/wBw12d7LO8YcZ4aehIlPp4lgSkKbrHaoF80IKI=",
@ -294,7 +369,7 @@
"type": "indirect"
}
},
"nixpkgs_6": {
"nixpkgs_8": {
"locked": {
"lastModified": 1686921029,
"narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=",
@ -309,7 +384,7 @@
"type": "indirect"
}
},
"nixpkgs_7": {
"nixpkgs_9": {
"locked": {
"lastModified": 1687274257,
"narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
@ -323,34 +398,6 @@
"type": "indirect"
}
},
"nixpkgs_8": {
"locked": {
"lastModified": 1689935543,
"narHash": "sha256-6GQ9ib4dA/r1leC5VUpsBo0BmDvNxLjKrX1iyL+h8mc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e43e2448161c0a2c4928abec4e16eae1516571bc",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1690026219,
"narHash": "sha256-oOduRk/kzQxOBknZXTLSEYd7tk+GoKvr8wV6Ab+t4AU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f465da166263bc0d4b39dfd4ca28b777c92d4b73",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"agenix": "agenix",
@ -358,6 +405,7 @@
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_3",
"simple-nixos-mailserver": "simple-nixos-mailserver",
"skynet_discord_bot": "skynet_discord_bot",
"skynet_ldap_backend": "skynet_ldap_backend",
"skynet_ldap_frontend": "skynet_ldap_frontend",
"skynet_website": "skynet_website",
@ -387,12 +435,34 @@
"type": "gitlab"
}
},
"skynet_ldap_backend": {
"skynet_discord_bot": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs_6",
"utils": "utils_2"
},
"locked": {
"host": "gitlab.skynet.ie",
"lastModified": 1693175435,
"narHash": "sha256-OWvMD6k/IXCAU5m7gOS25Uw3wdXey/yu4CX/AmSNKAU=",
"owner": "compsoc1%2Fskynet",
"repo": "discord-bot",
"rev": "e6f3b5f15857183777cd545d4366c3b51c5e3a02",
"type": "gitlab"
},
"original": {
"host": "gitlab.skynet.ie",
"owner": "compsoc1%2Fskynet",
"repo": "discord-bot",
"type": "gitlab"
}
},
"skynet_ldap_backend": {
"inputs": {
"naersk": "naersk_2",
"nixpkgs": "nixpkgs_8",
"utils": "utils_3"
},
"locked": {
"host": "gitlab.skynet.ie",
"lastModified": 1693168330,
@ -411,8 +481,8 @@
},
"skynet_ldap_frontend": {
"inputs": {
"nixpkgs": "nixpkgs_7",
"utils": "utils_3"
"nixpkgs": "nixpkgs_9",
"utils": "utils_4"
},
"locked": {
"host": "gitlab.skynet.ie",
@ -432,8 +502,8 @@
},
"skynet_website": {
"inputs": {
"nixpkgs": "nixpkgs_8",
"utils": "utils_4"
"nixpkgs": "nixpkgs_10",
"utils": "utils_5"
},
"locked": {
"host": "gitlab.skynet.ie",
@ -453,8 +523,8 @@
},
"skynet_website_2016": {
"inputs": {
"nixpkgs": "nixpkgs_9",
"utils": "utils_5"
"nixpkgs": "nixpkgs_11",
"utils": "utils_6"
},
"locked": {
"host": "gitlab.skynet.ie",
@ -547,6 +617,21 @@
"type": "github"
}
},
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1605370193,
@ -567,11 +652,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"type": "github"
},
"original": {
@ -585,11 +670,11 @@
"systems": "systems_3"
},
"locked": {
"lastModified": 1687171271,
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
@ -603,11 +688,11 @@
"systems": "systems_4"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"lastModified": 1687171271,
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
"type": "github"
},
"original": {
@ -633,6 +718,24 @@
"repo": "flake-utils",
"type": "github"
}
},
"utils_6": {
"inputs": {
"systems": "systems_6"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -21,6 +21,8 @@
skynet_website.url = "gitlab:compsoc1%2Fskynet%2Fwebsite/2023?host=gitlab.skynet.ie";
skynet_website_2016.url = "gitlab:compsoc1%2Fskynet%2Fwebsite/2016?host=gitlab.skynet.ie";
skynet_discord_bot.url = "gitlab:compsoc1%2Fskynet/discord-bot?host=gitlab.skynet.ie";
};
nixConfig.bash-prompt-suffix = "[Skynet Dev] ";

View file

@ -22,6 +22,7 @@ let
in {
imports = [
../applications/ldap/server.nix
../applications/discord.nix
];
deployment = {
@ -52,4 +53,8 @@ in {
name = name;
};
};
services.discord_bot = {
enable = true;
};
}

14
secrets/discord/token.age Normal file
View file

@ -0,0 +1,14 @@
age-encryption.org/v1
-> ssh-ed25519 V1pwNA wF/IvDrcLFTxYAauDal7+Gz1V++n67HYmojv+NS2wwY
2JlEICPHzgXGSLT7t36htE46YZ0fJsdjrT6NnCFVLLc
-> ssh-ed25519 rIwlvw tk13mY+KwEys50YTX9bbEv4324BXpWh+3G1y6MrQrRY
sOc+kY1qqtT99TbbxPFuMIpcn72may5fERhCWgV7RDU
-> ssh-ed25519 q8eJgg YJpV/03pvcZdQjQBecnP4LZUG+2Qiz1/3COTmNBNOXw
7qRtCRYSaXzcx5xZ/I9xAdsKz9QRaObpFQdRkLDi9lQ
-> ssh-ed25519 IzAMqA 5odTY81LRr8ZMmFbAB8K5xgaWBr/50xdDNPJ/n1URG8
pYpYgKxnWQ4xXgudtS43yp+X/wf0pLiMgASsrT6QCRE
-> P`-grease >u}h_O$
aRLumKxsQDFmx3TQTp4UVJU4RdB3DdiikrHSKX44AVH3gk41CZXFPc7EiCcafONw
2yXUhseX6EdlUz+JfNuU5fTOfck
--- BlNT3gxZ877Ln8DVUtidwmekRUIKOjaU4lbJYd/NGFQ
ŽµYðš« ÒO z÷D&— á¦^Ò\ n€bqöïG´†6»•dU¡¸)Çæq|æ €˜[<‡<>ðã_y ÚÍ5Å|<íÝXU ©\K<><4B>ß_þä—ýt²M0ô@CÚÇ'ØÙ[å«ɈYNJßn

View file

@ -121,4 +121,5 @@ in
# discord bot and discord
"discord/ldap.age".publicKeys = users ++ ldap ++ discord;
"discord/token.age".publicKeys = users ++ discord;
}