vps/nix/apps/widetom/default.nix
2025-08-04 22:18:54 +02:00

42 lines
1.1 KiB
Nix

{ config, pkgs, lib, my-projects-versions, ... }:
let
widetom = pkgs.rustPlatform.buildRustPackage {
src = pkgs.fetchFromGitHub my-projects-versions.widetom.fetchFromGitHub;
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;
};
systemd.services.widetom = {
description = "widetom, the extremely funny discord bot";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
environment = {
BOT_TOKEN_PATH = config.age.secrets.widetom_bot_token.path;
CONFIG_PATH = config.age.secrets.widetom_config_toml.path;
};
serviceConfig = {
DynamicUser = true;
ExecStart = lib.getExe widetom;
};
};
users.users.widetom = {
group = "widetom";
isSystemUser = true;
};
users.groups.widetom = { };
}