dicebot
This commit is contained in:
parent
46f7149f95
commit
879cad57e1
4 changed files with 108 additions and 1 deletions
62
services/dicebot.nix
Normal file
62
services/dicebot.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{ config, dicebot, ... }:
|
||||
|
||||
let
|
||||
dicebotPkg = dicebot.packages.x86_64-linux.default;
|
||||
in
|
||||
{
|
||||
sops.secrets."dicebot/password" = {
|
||||
sopsFile = ./secrets/dicebot.yaml;
|
||||
};
|
||||
|
||||
# Assemble the env file from the sops-decrypted password. systemd reads
|
||||
# EnvironmentFile at start time, so the secret never touches /nix/store.
|
||||
sops.templates."dicebot.env" = {
|
||||
content = ''
|
||||
DICEBOT_PASSWORD=${config.sops.placeholder."dicebot/password"}
|
||||
'';
|
||||
owner = "dicebot";
|
||||
};
|
||||
|
||||
users.users.dicebot = {
|
||||
isSystemUser = true;
|
||||
group = "dicebot";
|
||||
home = "/var/lib/dicebot";
|
||||
};
|
||||
users.groups.dicebot = { };
|
||||
|
||||
systemd.services.dicebot = {
|
||||
description = "Matrix dice-rolling bot";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
environment = {
|
||||
DICEBOT_HOMESERVER = "http://10.10.0.2:8008";
|
||||
DICEBOT_USERNAME = "@dicebot:ellie.town";
|
||||
DICEBOT_ALLOW_LIST = "@.*:ellie\\.town";
|
||||
DICEBOT_STATE_DIR = "/var/lib/dicebot";
|
||||
RUST_LOG = "info,headjack=info";
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${dicebotPkg}/bin/dicebot";
|
||||
EnvironmentFile = config.sops.templates."dicebot.env".path;
|
||||
User = "dicebot";
|
||||
Group = "dicebot";
|
||||
StateDirectory = "dicebot";
|
||||
StateDirectoryMode = "0700";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "10s";
|
||||
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
PrivateTmp = true;
|
||||
NoNewPrivileges = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectControlGroups = true;
|
||||
RestrictSUIDSGID = true;
|
||||
LockPersonality = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
17
services/secrets/dicebot.yaml
Normal file
17
services/secrets/dicebot.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
dicebot:
|
||||
password: ENC[AES256_GCM,data:hZvsxbxTUaHk6UFQlhvJuvvfkVcvCmx9Iw==,iv:lXSag76kLJ3l7uvv0zPBhXG090FsBzMGdJCBeTh4TX8=,tag:1kpYwiy1UHgaP0a0yq4MJA==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- recipient: age126v48dgev6pu3uhe7dtpdhax2yes2ff9u42ke2k2h97e90z8d4psedau7u
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpOHpZOGhhSzFDVzdMS09h
|
||||
UnJXR3didFVsUHBqd1lzMExJYmdTVEJCdlRjCitBQVRBMmtkVFFZRFN2dlVlUG9h
|
||||
ZXg5RGkyRnQ4aTg2djVab0RHdnBwV3cKLS0tIEJLUkZva3Q5aGtNTURJOHhwbnZ5
|
||||
UHFPejQ0QWZkV0N6RUVna0FjU3pLdEUKJAsgu2KwPICpDz75yHALUkOykMs+DGQf
|
||||
+BG37m/berZhD+iXldSG7c2uIzQfK9SLYDmaxn+tuqdkXa5OfFuPEQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2026-04-20T05:14:16Z"
|
||||
mac: ENC[AES256_GCM,data:1I8HbOnlO6DeQsuhKff+LGV5CCdisFMynsludXB3zHCG4MMpjZf7uhMsVbPLANtBCzz5pgU6lthcoA7oBAlNrGEyoRN0P6W7lrQerMrUDs9acFX1BHZt5+i9Y3FtXxKwCxAgbPhRFRUBYWLRYS8WDMWxQ+5Te27ETWrkF9XP+4k=,iv:XunfIVyxIyiLgvuc2faQnriuqVVIjdjjdmYd9AalwAU=,tag:cgJMMP35XMdTlC+fVW7L2A==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.12.1
|
||||
Loading…
Add table
Add a link
Reference in a new issue