nixos-config/machines/proxy/configuration.nix

140 lines
3 KiB
Nix
Raw Normal View History

{ self, caddy-with-plugins, ... }:
2024-02-05 11:46:52 +01:00
{ modulesPath, pkgs, ... }:
{
2022-01-24 11:14:34 +01:00
imports = [
(modulesPath + "/virtualisation/lxc-container.nix")
2022-01-24 11:14:34 +01:00
../../users/root
../../users/erwin
];
eboskma = {
2023-05-10 15:13:50 +02:00
users.erwin = {
enable = true;
server = true;
};
2022-08-07 11:24:24 +02:00
nix-common = {
enable = true;
2022-08-14 16:38:25 +02:00
remote-builders = true;
2022-08-07 11:24:24 +02:00
};
caddy-proxy = {
enable = true;
package = caddy-with-plugins.packages.${pkgs.system}.caddy-with-cloudflare;
proxyHosts = [
{
externalHostname = "home.datarift.nl";
proxyAddress = "homeassistant.barn-beaver.ts.net:8123";
external = true;
}
{
externalHostname = "frigate.datarift.nl";
proxyAddress = "frigate.barn-beaver.ts.net:5000";
}
{
externalHostname = "minio.datarift.nl";
proxyAddress = "minio.barn-beaver.ts.net:9000";
external = true;
}
{
externalHostname = "minio-admin.datarift.nl";
proxyAddress = "minio.barn-beaver.ts.net:9001";
}
{
externalHostname = "saga.datarift.nl";
proxyAddress = "saga.barn-beaver.ts.net:3000";
}
{
externalHostname = "unifi.datarift.nl";
proxyAddress = "unifi.barn-beaver.ts.net:8443";
}
];
};
tailscale.enable = true;
2022-01-24 11:14:34 +01:00
};
boot = {
isContainer = true;
kernel.sysctl = {
"net.core.rmem_max" = 2500000;
"net.core.wmem_max" = 2500000;
};
};
2022-01-24 11:14:34 +01:00
time.timeZone = "Europe/Amsterdam";
system.configurationRevision = self.inputs.nixpkgs.lib.mkIf (self ? rev) self.rev;
networking = {
hostName = "proxy";
useDHCP = false;
useHostResolvConf = false;
networkmanager.enable = false;
useNetworkd = true;
nftables.enable = true;
2023-05-23 17:12:31 +02:00
firewall.trustedInterfaces = [ "tailscale0" ];
};
2023-05-23 17:12:31 +02:00
systemd = {
services.logrotate-checkconf.enable = false;
2023-05-23 17:12:31 +02:00
network = {
enable = true;
wait-online.anyInterface = true;
2022-01-24 11:14:34 +01:00
networks = {
"40-eth0" = {
matchConfig = {
Name = "eth0";
};
networkConfig = {
Address = "10.0.0.251/24";
Gateway = "10.0.0.1";
DNS = "10.0.0.206";
DHCP = "no";
};
};
};
};
};
2022-01-24 11:14:34 +01:00
security = {
sudo-rs = {
enable = true;
execWheelOnly = true;
wheelNeedsPassword = false;
};
sudo.enable = false;
};
2023-01-31 17:00:01 +01:00
services = {
caddy = {
virtualHosts = {
"garfield.datarift.nl" =
let
webRoot = pkgs.writeTextDir "index.html" (builtins.readFile ./index.html);
in
{
extraConfig = ''
root * ${webRoot}
rewrite * /index.html
file_server
tls {
dns cloudflare {env.CF_API_TOKEN}
resolvers 1.1.1.1
}
'';
};
};
};
};
2022-01-24 11:14:34 +01:00
sops.defaultSopsFile = ./secrets.yaml;
sops.secrets = {
caddy-env = { };
};
2022-01-24 11:14:34 +01:00
system.stateVersion = "24.05";
2022-01-24 11:14:34 +01:00
}