Working on dc bot for server
This commit is contained in:
parent
ffdbf2fc95
commit
215a8d138a
4 changed files with 59 additions and 1 deletions
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -110,6 +110,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dcbot": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1739659068,
|
||||||
|
"narHash": "sha256-MLl4wWl5mcOpz17lWDfPypSPH9jc5vKKifvfl00mkMQ=",
|
||||||
|
"owner": "jsw08",
|
||||||
|
"repo": "dcbot",
|
||||||
|
"rev": "6c7e4dd0dc9bd580a67e1f00ba0b6e05f7a85bf5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "jsw08",
|
||||||
|
"repo": "dcbot",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"firefox-gnome-theme": {
|
"firefox-gnome-theme": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -714,6 +730,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
|
"dcbot": "dcbot",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"hm": "hm",
|
"hm": "hm",
|
||||||
"nixcord": "nixcord",
|
"nixcord": "nixcord",
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@
|
||||||
|
|
||||||
nixcord.url = "github:kaylorben/nixcord";
|
nixcord.url = "github:kaylorben/nixcord";
|
||||||
somcli.url = "github:jsw08/somcli";
|
somcli.url = "github:jsw08/somcli";
|
||||||
|
dcbot = {
|
||||||
|
url = "github:jsw08/dcbot";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
agenix.url = "github:ryantm/agenix";
|
agenix.url = "github:ryantm/agenix";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
37
system/server/bot.nix
Normal file
37
system/server/bot.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
deno = lib.getExe pkgs.deno;
|
||||||
|
|
||||||
|
mainDir = "/var/lib/dcbot/";
|
||||||
|
programDir = mainDir + "program";
|
||||||
|
dataDir = mainDir + "data";
|
||||||
|
|
||||||
|
config = pkgs.writeText ".env" ''
|
||||||
|
config
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
systemd.services.dcbot = {
|
||||||
|
enable = true;
|
||||||
|
after = ["network.target"];
|
||||||
|
wantedBy = ["default.target"];
|
||||||
|
description = "Jsw's slaafje, discord bot.";
|
||||||
|
|
||||||
|
preStart = ''
|
||||||
|
mkdir -p "${programDir}" "${dataDir}/"
|
||||||
|
|
||||||
|
cp -r ${inputs.dcbot}/* "${programDir}/"
|
||||||
|
cp -r "${config}" "${programDir}/.env"
|
||||||
|
|
||||||
|
cd "${programDir}"
|
||||||
|
${deno} i
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
StateDirectory = "dcbot";
|
||||||
|
ExecStart = "${deno} run -A ${programDir}/src/main.ts";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: {
|
||||||
imports = [./caddy.nix ./transfer-sh.nix ./seafile.nix];
|
imports = [./caddy.nix ./transfer-sh.nix ./seafile.nix ./bot.nix];
|
||||||
options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option.
|
options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue