fixed vaultwarden

This commit is contained in:
Rouven Seifert 2023-01-25 14:24:10 +01:00
parent 6b41537bc2
commit e8d6ca3917
2 changed files with 23 additions and 8 deletions

View file

@ -7,6 +7,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
./modules/networks ./modules/networks
./modules/nextcloud ./modules/nextcloud
./modules/vaultwarden
./modules/nginx ./modules/nginx
../../shared/vim.nix ../../shared/vim.nix
../../shared/sops.nix ../../shared/sops.nix

View file

@ -3,22 +3,36 @@ let
domain = "vault.rfive.de"; domain = "vault.rfive.de";
in in
{ {
config.sops.secrets."vaultwarden/env" = { }; sops.secrets."vaultwarden/env".owner = "vaultwarden";
services.vaultwarden = { services.vaultwarden = {
enable = true; enable = true;
dbBackend = "postgresql"; dbBackend = "postgresql";
environmentFile = config.sops.secrets."vaultwarden/env".path; environmentFile = config.sops.secrets."vaultwarden/env".path;
config = { config = {
domain = domain; domain = "https://${domain}";
signupsAllowed = false; signupsAllowed = false;
# somehow this works
databaseUrl = "postgresql://vaultwarden@%2Frun%2Fpostgresql/vaultwarden";
rocketPort = 8000; rocketPort = 8000;
}; };
services.nginx.virtualHosts."bitwarden.example.com" = { };
services.postgresql = {
enable = true;
ensureUsers = [
{
name = "vaultwarden";
ensurePermissions = {
"DATABASE vaultwarden" = "ALL PRIVILEGES";
};
}
];
ensureDatabases = [ "vaultwarden" ];
};
services.nginx.virtualHosts."${domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.vaultwarden.config.ROCKET_PORT}"; proxyPass = "http://127.0.0.1:${toString config.services.vaultwarden.config.rocketPort}";
};
}; };
}; };
} }