widetom in systemd

This commit is contained in:
nora 2025-08-03 17:03:25 +02:00
parent 0d83cecc9f
commit 1c94ed5f5d
2 changed files with 46 additions and 31 deletions

View file

@ -1,33 +1,47 @@
{ config, ... }: { { config, pkgs, lib, my-projects-versions, ... }:
age.secrets.widetom_bot_token.file = ../../secrets/widetom_bot_token.age; let
age.secrets.widetom_config_toml.file = ../../secrets/widetom_config_toml.age; widetom = pkgs.rustPlatform.buildRustPackage {
src = pkgs.fetchFromGitHub {
owner = "Noratrieb";
repo = "widetom";
rev = my-projects-versions.widetom;
hash = "sha256-lSjlDozwKRLF62jsDaWo+8+rcQdeEgurEnuw00hk3o8=";
};
pname = "widetom";
version = "0.1.0";
cargoHash = "sha256-AWbdPcDc+QOW7U/FYbqlIsg+3MwfggKCTCw1z/ZbSEE=";
meta = {
mainProgram = "widertom";
};
};
in
{
age.secrets.widetom_bot_token = {
file = ../../secrets/widetom_bot_token.age;
owner = config.users.users.widetom.name;
};
age.secrets.widetom_config_toml = {
file = ../../secrets/widetom_config_toml.age;
owner = config.users.users.widetom.name;
};
virtualisation.oci-containers.containers = { systemd.services.widetom = {
/* description = "widetom, the extremely funny discord bot";
container_name: widetom wantedBy = [ "multi-user.target" ];
image: "docker.noratrieb.dev/widetom:33d17387" after = [ "network.target" ];
restart: always
volumes:
- "/apps/widetom:/app/config"
environment:
CONFIG_PATH: /app/config/config.toml
BOT_TOKEN_PATH: /app/config/bot_token
*/
widetom = {
image = "docker.noratrieb.dev/widetom:33d17387";
volumes = [
"${config.age.secrets.widetom_config_toml.path}:/config.toml"
"${config.age.secrets.widetom_bot_token.path}:/token"
];
environment = { environment = {
CONFIG_PATH = "/config.toml"; BOT_TOKEN_PATH = config.age.secrets.widetom_bot_token.path;
BOT_TOKEN_PATH = "/token"; CONFIG_PATH = config.age.secrets.widetom_config_toml.path;
}; };
login = { serviceConfig = {
registry = "docker.noratrieb.dev"; DynamicUser = true;
username = "nils"; ExecStart = lib.getExe widetom;
passwordFile = config.age.secrets.docker_registry_password.path;
}; };
}; };
users.users.widetom = {
group = "widetom";
isSystemUser = true;
}; };
users.groups.widetom = { };
} }

View file

@ -6,5 +6,6 @@
"quotdd": "e922229e1d9e055be35dabd112bafc87a0686548", "quotdd": "e922229e1d9e055be35dabd112bafc87a0686548",
"does-it-build": "81790825173d87f89656f66f12a123bc99e2f6f1", "does-it-build": "81790825173d87f89656f66f12a123bc99e2f6f1",
"upload.files.noratrieb.dev": "0124fa5ba5446cb463fb6b3c4f52e7e6b84e5077", "upload.files.noratrieb.dev": "0124fa5ba5446cb463fb6b3c4f52e7e6b84e5077",
"cluelessh": "5f203d0f5ba2639043bd5bd1c3687c406d6abac1" "cluelessh": "c711cd405da4b7951e554577d09c9576bedf7970",
"widetom": "33d1738799618d72fe2b86896f766cbfea58dc76"
} }