stockholm/makefu/2configs/bitwarden.nix

51 lines
1.4 KiB
Nix
Raw Normal View History

2021-04-04 06:43:55 +00:00
{ pkgs, ... }:
let
port = 8812;
in {
2021-12-17 20:11:21 +00:00
services.vaultwarden = {
2021-04-04 06:43:55 +00:00
enable = true;
dbBackend = "postgresql";
config.signups_allowed = false;
config.rocketPort = port;
config.domain = "https://bw.euer.krebsco.de";
#config.databaseUrl = "postgresql://bitwardenuser:${dbPassword}@localhost/bitwarden";
config.databaseUrl = "postgresql:///bitwarden";
config.websocket_enabled = true;
};
2021-12-17 20:11:21 +00:00
systemd.services.vaultwarden.after = [ "postgresql.service" ];
2021-04-04 06:43:55 +00:00
services.postgresql = {
enable = true;
ensureDatabases = [ "bitwarden" ];
2021-12-17 20:11:21 +00:00
ensureUsers = [
{ name = "bitwarden_rs"; ensurePermissions."DATABASE bitwarden" = "ALL PRIVILEGES"; }
{ name = "vaultwarden"; ensurePermissions."DATABASE bitwarden" = "ALL PRIVILEGES"; }
];
2021-04-04 06:43:55 +00:00
};
2022-06-06 19:15:49 +00:00
services.postgresqlBackup = {
enable = true;
databases = [ "bitwarden" ];
2022-06-06 19:15:49 +00:00
};
systemd.services.postgresqlBackup-bitwarden.serviceConfig.SupplementaryGroups = [ "download" ];
2022-06-06 19:15:49 +00:00
2021-04-04 06:43:55 +00:00
services.nginx.virtualHosts."bw.euer.krebsco.de" ={
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:8812";
proxyWebsockets = true;
};
locations."/notifications/hub" = {
proxyPass = "http://localhost:3012";
proxyWebsockets = true;
};
locations."/notifications/hub/negotiate" = {
proxyPass = "http://localhost:8812";
proxyWebsockets = true;
};
};
}