mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2024-11-16 05:43:10 +01:00
40 lines
968 B
Nix
40 lines
968 B
Nix
{ config, ... }:
|
|
let
|
|
domain = "vault.${config.networking.domain}";
|
|
in
|
|
{
|
|
age.secrets.vaultwarden = {
|
|
file = ../../../../secrets/nuc/vaultwarden.age;
|
|
owner = "vaultwarden";
|
|
};
|
|
services.vaultwarden = {
|
|
enable = true;
|
|
dbBackend = "postgresql";
|
|
environmentFile = config.age.secrets.vaultwarden.path;
|
|
config = {
|
|
domain = "https://${domain}";
|
|
signupsAllowed = false;
|
|
# somehow this works
|
|
databaseUrl = "postgresql://vaultwarden@%2Frun%2Fpostgresql/vaultwarden";
|
|
rocketPort = 8000;
|
|
};
|
|
};
|
|
services.postgresql = {
|
|
enable = true;
|
|
ensureUsers = [
|
|
{
|
|
name = "vaultwarden";
|
|
ensureDBOwnership = true;
|
|
}
|
|
];
|
|
ensureDatabases = [ "vaultwarden" ];
|
|
};
|
|
services.nginx.virtualHosts."${domain}" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
locations."/" = {
|
|
proxyPass = "http://127.0.0.1:${toString config.services.vaultwarden.config.rocketPort}";
|
|
};
|
|
};
|
|
}
|