summaryrefslogtreecommitdiffstats
path: root/hosts/poweredge-pro/vaultwarden.nix
blob: df2b81b835866f638921a433f0ea191f9293d772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
	# Secrets
	sops.secrets.vaultwarden-env = { sopsFile = ./resources/secrets/vaultwarden.yaml; key = "environment"; };

	# Container
	containers.vaultwarden = {
		autoStart = true;
		privateNetwork = true;
		hostBridge = "br-lan0";
		localMacAddress = "02:00:00:00:77:17";
		ephemeral = true;

		bindMounts = {
			"/var/lib/vaultwarden" = {
				hostPath = "/nix/persist/vaultwarden";
				isReadOnly = false;
			};
			"/run/secrets/vaultwarden.env" = {
				hostPath = "/run/secrets/vaultwarden-env";
				isReadOnly = true;
			};
		};

		config = { ... }: {
			networking.interfaces.eth0.useDHCP = true;
			networking.firewall.allowedTCPPorts = [ 8000 ];  # Vaultwarden

			services.vaultwarden = {
				enable = true;
				environmentFile = "/run/secrets/vaultwarden.env";
				config.ROCKET_ADDRESS = "0.0.0.0";
			};

			system.stateVersion = "26.05";
		};
	};
}