infrastructure/systems/utsuho/nixos.nix
2024-03-22 16:56:36 -07:00

58 lines
1.3 KiB
Nix

{meta, config, ...}: let
inherit (config.services) nginx;
in {
imports = let
inherit (meta) nixos;
in [
nixos.sops
nixos.base
nixos.reisen-ct
nixos.ipa
nixos.cloudflared
nixos.nginx
nixos.access.unifi
nixos.unifi
];
services.cloudflared = let
inherit (config.services) unifi;
inherit (nginx) virtualHosts defaultHTTPListenPort;
tunnelId = "28bcd3fc-3467-4997-806b-546ba9995028";
localNginx = "http://localhost:${toString defaultHTTPListenPort}";
in {
tunnels.${tunnelId} = {
default = "http_status:404";
credentialsFile = config.sops.secrets.cloudflared-tunnel-utsuho.path;
ingress = {
${virtualHosts.unifi.serverName} = assert unifi.enable; {
service = localNginx;
};
};
};
};
services.nginx = {
virtualHosts = {
unifi.proxied.enable = "cloudflared";
};
};
sops.secrets.cloudflared-tunnel-utsuho = {
owner = config.services.cloudflared.user;
};
sops.defaultSopsFile = ./secrets.yaml;
systemd.network.networks.eth0 = {
name = "eth0";
matchConfig = {
MACAddress = "BC:24:11:C4:66:A6";
Type = "ether";
};
address = ["10.1.1.38/24"];
gateway = ["10.1.1.1"];
DHCP = "no";
};
system.stateVersion = "23.11";
}