mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-08-10 13:54:38 -05:00
feat: refactored abstractions
This commit is contained in:
parent
f3897c1e0c
commit
2e0ba5f89e
23 changed files with 324 additions and 310 deletions
|
@ -5,12 +5,11 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.people.user.${user0}) domain email;
|
||||
inherit (flake.config.system.device) server wildcard;
|
||||
inherit (flake.config.service.instance.mastodon) paths name sops ssl;
|
||||
host = domain.url1;
|
||||
localhost = wildcard.ip.address0;
|
||||
inherit (flake.config.system.device) server;
|
||||
inherit (flake.config.service.instance) mastodon web;
|
||||
service = mastodon;
|
||||
host = web.domains.url1;
|
||||
localhost = web.localhost.address0;
|
||||
in {
|
||||
# If you need to start fresh for some reason, run these to create the new Admin account:
|
||||
# sudo -u mastodon mastodon-tootctl accounts create nick --email=nick@localhost --confirmed --role=Owner
|
||||
|
@ -46,9 +45,9 @@ in {
|
|||
automaticMigrations = true;
|
||||
database = {
|
||||
createLocally = true;
|
||||
name = name;
|
||||
name = service.name;
|
||||
host = "/run/postgresql";
|
||||
user = name;
|
||||
user = service.name;
|
||||
passwordFile = config.sops.secrets.mastodon-database.path;
|
||||
};
|
||||
extraConfig = {
|
||||
|
@ -92,11 +91,11 @@ in {
|
|||
smtp = {
|
||||
authenticate = true;
|
||||
createLocally = false;
|
||||
fromAddress = "The Nutrivore <${email.address2}>";
|
||||
fromAddress = "The Nutrivore <${service.email.address0}>";
|
||||
host = "smtp.protonmail.ch";
|
||||
passwordFile = config.sops.secrets.mastodon-smtp.path;
|
||||
port = 587;
|
||||
user = email.address2;
|
||||
user = service.email.address0;
|
||||
};
|
||||
};
|
||||
caddy = {
|
||||
|
@ -121,7 +120,7 @@ in {
|
|||
reverse_proxy * unix//run/mastodon-web/web.socket
|
||||
}
|
||||
|
||||
tls ${ssl.cert} ${ssl.key}
|
||||
tls ${service.ssl.cert} ${service.ssl.key}
|
||||
|
||||
handle_errors {
|
||||
root * ${pkgs.mastodon}/public
|
||||
|
@ -149,34 +148,34 @@ in {
|
|||
sops = let
|
||||
sopsSecrets = ["smtp" "database" "redis"];
|
||||
sopsPath = secret: {
|
||||
path = "${sops.path0}/${name}-${secret}";
|
||||
owner = name;
|
||||
path = "${service.sops.path0}/${service.name}-${secret}";
|
||||
owner = service.name;
|
||||
mode = "600";
|
||||
};
|
||||
in {
|
||||
secrets = builtins.listToAttrs (
|
||||
map
|
||||
(secret: {
|
||||
name = "${name}-${secret}";
|
||||
name = "${service.name}-${secret}";
|
||||
value = sopsPath secret;
|
||||
})
|
||||
sopsSecrets
|
||||
);
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/${name}" = {
|
||||
device = paths.path0;
|
||||
fileSystems."/var/lib/${service.name}" = {
|
||||
device = service.paths.path0;
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
depends = [server.storage0.mount];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"Z ${paths.path0} 0755 ${name} ${name} -"
|
||||
"Z ${sops.path0} 0755 ${name} ${name} -"
|
||||
"Z ${service.paths.path0} 0755 ${service.name} ${service.name} -"
|
||||
"Z ${service.sops.path0} 0755 ${service.name} ${service.name} -"
|
||||
];
|
||||
|
||||
users.users.${name}.extraGroups = ["postgres"];
|
||||
users.users.${service.name}.extraGroups = ["postgres"];
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue