2023-08-10 16:43:46 +02:00
|
|
|
{ self, caddy-with-plugins, ... }:
|
2024-02-05 11:46:52 +01:00
|
|
|
{ modulesPath, pkgs, ... }:
|
|
|
|
{
|
2022-01-24 11:14:34 +01:00
|
|
|
imports = [
|
2024-01-02 22:01:55 +01:00
|
|
|
(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
|
|
|
};
|
2023-08-10 16:43:46 +02:00
|
|
|
caddy-proxy = {
|
|
|
|
enable = true;
|
2024-04-16 19:53:46 +02:00
|
|
|
package = caddy-with-plugins.packages.${pkgs.system}.caddy-with-cloudflare;
|
2024-04-10 22:19:33 +02:00
|
|
|
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";
|
|
|
|
}
|
|
|
|
];
|
2023-08-10 16:43:46 +02:00
|
|
|
};
|
2024-01-02 22:01:55 +01:00
|
|
|
tailscale.enable = true;
|
2022-01-24 11:14:34 +01:00
|
|
|
};
|
|
|
|
|
2024-01-02 22:01:55 +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;
|
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
networking = {
|
|
|
|
hostName = "proxy";
|
|
|
|
useDHCP = false;
|
|
|
|
useHostResolvConf = false;
|
|
|
|
networkmanager.enable = false;
|
|
|
|
useNetworkd = true;
|
|
|
|
nftables.enable = true;
|
2023-05-23 17:12:31 +02:00
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
firewall.trustedInterfaces = [ "tailscale0" ];
|
|
|
|
};
|
2023-05-23 17:12:31 +02:00
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
systemd.network = {
|
|
|
|
enable = true;
|
2023-05-23 17:12:31 +02:00
|
|
|
|
2024-01-29 10:27:21 +01:00
|
|
|
wait-online.anyInterface = true;
|
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
networks = {
|
|
|
|
"40-eth0" = {
|
|
|
|
matchConfig = {
|
|
|
|
Name = "eth0";
|
|
|
|
};
|
2022-01-24 11:14:34 +01:00
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
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
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
security = {
|
|
|
|
sudo-rs = {
|
|
|
|
enable = true;
|
|
|
|
execWheelOnly = true;
|
|
|
|
wheelNeedsPassword = false;
|
|
|
|
};
|
|
|
|
sudo.enable = false;
|
|
|
|
};
|
2023-01-31 17:00:01 +01:00
|
|
|
|
2024-06-13 15:11:08 +02: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;
|
2023-08-10 16:43:46 +02:00
|
|
|
sops.secrets = {
|
|
|
|
caddy-env = { };
|
|
|
|
};
|
2022-01-24 11:14:34 +01:00
|
|
|
|
2024-01-02 22:01:55 +01:00
|
|
|
system.stateVersion = "24.05";
|
2022-01-24 11:14:34 +01:00
|
|
|
}
|