nix-config/containers/vaultwarden/default.nix

35 lines
763 B
Nix
Raw Permalink Normal View History

2024-11-23 15:45:19 -05:00
{ lib, ... }:
2024-11-10 17:54:08 -05:00
let
domain = "crypt.tdback.net";
port = "11001";
2024-11-23 15:45:19 -05:00
directory = "/opt/vaultwarden";
2024-11-10 17:54:08 -05:00
in
{
2024-11-23 15:45:19 -05:00
systemd.tmpfiles.rules =
map (x: "d ${x} 0755 share share - -") (lib.lists.singleton directory);
2024-11-10 17:54:08 -05:00
virtualisation.oci-containers.containers.vaultwarden = {
image = "vaultwarden/server:latest";
autoStart = true;
ports = [
"${port}:80"
];
volumes = [
2024-11-23 15:45:19 -05:00
"${directory}/data:/data"
2024-11-10 17:54:08 -05:00
];
environment = {
DOMAIN = domain;
WEBSOCKET_ENABLED = "true";
SIGNUPS_ALLOWED = "false";
SHOW_PASSWORD_HINT = "false";
};
};
2024-11-23 15:45:19 -05:00
services.caddy.virtualHosts.${domain}.extraConfig = ''
2024-11-10 17:54:08 -05:00
encode zstd gzip
reverse_proxy http://localhost:${port} {
header_up X-Real-IP {remote_host}
}
'';
}