mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-17 02:25:12 -05:00
feat: init
This commit is contained in:
commit
c19ea940bd
320 changed files with 23845 additions and 0 deletions
102
nixos/modules/services/castopod.nix
Executable file
102
nixos/modules/services/castopod.nix
Executable file
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
flake,
|
||||
config,
|
||||
...
|
||||
}: 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.castopod) paths ports subdomain name sops ssl;
|
||||
inherit (flake.config.service.instance) nginx;
|
||||
localhost = wildcard.ip.address0;
|
||||
host = "${subdomain}.${domain.url1}";
|
||||
in {
|
||||
services = {
|
||||
castopod = {
|
||||
enable = true;
|
||||
localDomain = host;
|
||||
configureNginx = false;
|
||||
environmentFile = config.sops.secrets."${name}-smtp".path;
|
||||
maxUploadSize = "1024M";
|
||||
database = {
|
||||
createLocally = true;
|
||||
# passwordFile = config.sops.secrets."${name}-database".path;
|
||||
};
|
||||
poolSettings = {
|
||||
pm = "dynamic";
|
||||
"pm.max_children" = "32";
|
||||
"pm.max_requests" = "500";
|
||||
"pm.max_spare_servers" = "4";
|
||||
"pm.min_spare_servers" = "2";
|
||||
"pm.start_servers" = "2";
|
||||
};
|
||||
settings = {
|
||||
"email.fromEmail" = email.address6;
|
||||
"email.protocol" = "smtp";
|
||||
"email.SMTPHost" = localhost;
|
||||
"email.SMTPPort" = 587;
|
||||
"email.SMTPUser" = "smtp.protonmail.ch";
|
||||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"${host}" = {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
caddy = {
|
||||
virtualHosts = {
|
||||
"${host}" = {
|
||||
extraConfig = ''
|
||||
reverse_proxy ${localhost}:${toString ports.port0}
|
||||
|
||||
tls ${ssl.cert} ${ssl.key}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sops = let
|
||||
sopsSecrets = ["smtp" "database"];
|
||||
sopsPath = secret: {
|
||||
path = "${sops.path0}/${name}-${secret}";
|
||||
owner = name;
|
||||
mode = "600";
|
||||
};
|
||||
in {
|
||||
secrets = builtins.listToAttrs (
|
||||
map
|
||||
(secret: {
|
||||
name = "${name}-${secret}";
|
||||
value = sopsPath secret;
|
||||
})
|
||||
sopsSecrets
|
||||
);
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/${name}" = {
|
||||
device = paths.path0;
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
depends = [server.storage0.mount];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"Z ${paths.path0} 755 ${name} ${name} -"
|
||||
"Z ${sops.path0} 755 ${name} ${name} -"
|
||||
];
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [
|
||||
ports.port0
|
||||
nginx.ports.port0
|
||||
];
|
||||
};
|
||||
};
|
||||
users.groups.nginx = {};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue