2023-11-07 13:38:59 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2024-05-30 13:59:20 +00:00
|
|
|
name = "vaultwarden";
|
|
|
|
cfg = config.services.skynet."${name}";
|
2023-11-07 13:38:59 +00:00
|
|
|
|
|
|
|
domain_sub = "pw";
|
|
|
|
domain = "${domain_sub}.skynet.ie";
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
];
|
|
|
|
|
2024-05-30 13:59:20 +00:00
|
|
|
options.services.skynet."${name}" = {
|
2024-05-30 16:55:29 +00:00
|
|
|
enable = mkEnableOption "Skynet VaultWarden server";
|
2023-11-07 13:38:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
#backups = [ "/etc/silver_ul_ical/database.db" ];
|
|
|
|
|
|
|
|
# Website config
|
2024-05-30 12:34:59 +00:00
|
|
|
services.skynet.acme.domains = [
|
2023-11-07 13:38:59 +00:00
|
|
|
domain
|
|
|
|
];
|
|
|
|
|
2024-05-30 12:25:52 +00:00
|
|
|
services.skynet.dns.records = [
|
2023-11-07 13:38:59 +00:00
|
|
|
{
|
|
|
|
record = domain_sub;
|
|
|
|
r_type = "CNAME";
|
2024-05-30 16:55:29 +00:00
|
|
|
value = config.services.skynet.host.name;
|
2023-11-07 13:38:59 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2024-01-31 15:43:18 +00:00
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"${domain}" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString config.services.vaultwarden.config.ROCKET_PORT}";
|
|
|
|
};
|
2023-11-07 13:38:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# has ADMIN_TOKEN and SMTP_PASSWORD
|
|
|
|
age.secrets.bitwarden_details.file = ../../secrets/bitwarden/details.age;
|
|
|
|
|
|
|
|
services.vaultwarden = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
environmentFile = config.age.secrets.bitwarden_details.path;
|
|
|
|
config = {
|
|
|
|
DOMAIN = "https://${domain}";
|
|
|
|
SENDS_ALLOWED = true;
|
|
|
|
SIGNUPS_ALLOWED = false;
|
|
|
|
|
|
|
|
INVITATION_ORG_NAME = "Skyhold";
|
|
|
|
|
|
|
|
ORG_GROUPS_ENABLED = true;
|
|
|
|
|
|
|
|
USE_SENDMAIL = false;
|
|
|
|
|
|
|
|
SMTP_HOST = "mail.skynet.ie";
|
|
|
|
SMTP_FROM = "vaultwarden@skynet.ie";
|
|
|
|
SMTP_FROM_NAME = "Skynet Bitwarden server";
|
|
|
|
SMTP_SECURITY = "starttls";
|
|
|
|
SMTP_PORT = 587;
|
|
|
|
|
|
|
|
SMTP_USERNAME = "vaultwarden@skynet.ie";
|
|
|
|
SMTP_AUTH_MECHANISM = "Login";
|
|
|
|
SMTP_EMBED_IMAGES = true;
|
|
|
|
|
|
|
|
ROCKET_ADDRESS = "127.0.0.1";
|
|
|
|
ROCKET_PORT = 8222;
|
|
|
|
|
|
|
|
ROCKET_LOG = "critical";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|