tsuki/vaultwarden: add vaultwarden, password manager

This commit is contained in:
Oystein Kristoffer Tveit 2023-07-12 01:45:05 +02:00
parent 40e95ce030
commit 25b6f0f3e9
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 38 additions and 0 deletions

View File

@ -24,6 +24,7 @@
./services/pgadmin.nix ./services/pgadmin.nix
./services/plex.nix ./services/plex.nix
./services/postgres.nix ./services/postgres.nix
./services/vaultwarden.nix
./services/vscode-server.nix ./services/vscode-server.nix
]; ];

View File

@ -162,6 +162,7 @@
(proxy ["py"] "http://localhost:${s ports.jupyterhub}" { (proxy ["py"] "http://localhost:${s ports.jupyterhub}" {
locations."/".proxyWebsockets = true; locations."/".proxyWebsockets = true;
}) })
(proxy ["bw"] "http://localhost:${s config.services.vaultwarden.config.ROCKET_PORT}" {})
(proxy ["docs"] "http://localhost:${s config.services.hedgedoc.settings.port}" {}) (proxy ["docs"] "http://localhost:${s config.services.hedgedoc.settings.port}" {})
(proxy ["map"] "http://localhost:${s ports.minecraft.dynmap}" {}) (proxy ["map"] "http://localhost:${s ports.minecraft.dynmap}" {})
(proxy ["yt"] "http://localhost:${s config.services.invidious.port}" {}) (proxy ["yt"] "http://localhost:${s config.services.invidious.port}" {})

View File

@ -0,0 +1,36 @@
{ pkgs, config, ... }:
{
services.vaultwarden = {
enable = true;
dbBackend = "postgresql";
# TODO: Set a database password
environmentFile = pkgs.writeText "vaultwarden.env" ''
DATABASE_URL=postgresql://vaultwarden:@%2Fvar%2Frun%2Fpostgresql/vaultwarden
'';
config = {
DOMAIN = "https://bw.nani.wtf";
SIGNUPS_ALLOWED = false;
ROCKET_ADDRESS = "127.0.0.1";
ROCKET_PORT = 8222;
ROCKET_LOG = "critical";
ROCKET_WORKERS = 1;
};
};
systemd.services.vaultwarden = {
requires = [ "postgresql.service" ];
};
services.postgresql = {
enable = true;
ensureDatabases = [ "vaultwarden" ];
ensureUsers = [
(rec {
name = "vaultwarden";
ensurePermissions = {
"DATABASE \"${name}\"" = "ALL PRIVILEGES";
};
})
];
};
}