summaryrefslogtreecommitdiff
path: root/hosts/poweredge-pro/embedtube.nix
blob: 12d375ecbbbffa5dc0d0202eca7822ac2068015f (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
38
39
40
41
42
43
{ config, pkgs, inputs, ... }: {
	# Secrets
	sops.secrets.embedtube-api-key = { sopsFile = ./resources/secrets/embedtube.yaml; key = "api-key"; };

	# Container
	containers.embedtube = {
		autoStart = true;
		privateNetwork = true;
		ephemeral = true;
		hostBridge = "br-lan1";
		localMacAddress = "02:00:00:00:77:14";

		bindMounts."/run/secrets/api-key" = {
			hostPath = config.sops.secrets.embedtube-api-key.path;
			isReadOnly = true;
		};

		config = { lib, pkg, config, ... }: {
			# Import EmbedTube flake input
			imports = [ inputs.embedtube.nixosModules.default ];

			# Network
			networking.interfaces.eth0.useDHCP = true;
			networking.firewall.allowedTCPPorts = [ 80 ];  # Caddy (private + public)

			# EmbedTube
			services.embedtube = {
				enable = true;
				apiKeyFile = "/run/secrets/api-key";
			};

			# Reverse proxy
			services.caddy = {
				enable = true;
				virtualHosts.":80".extraConfig = ''
					reverse_proxy localhost:8080
				'';
			};

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