nix/nixos/common/containers/derp.nix

36 lines
1.4 KiB
Nix
Raw Normal View History

2024-08-12 06:19:07 +02:00
{ domainName, ... }: {
2024-03-15 02:28:10 +01:00
services.cron = {
enable = true;
systemCronJobs = [
2024-09-16 05:04:17 +02:00
# TODO Change the server when moving between hosts
''0 0 * * * root mkdir -p /Storage/Data/Docker/sysctl.io/letsencrypt/; rsync -avr --delete root@warsaw-ovh-01:/Storage/Data/Docker/sysctl.io/letsencrypt/ /Storage/Data/Docker/sysctl.io/letsencrypt/''
# ''0 0 * * * root mkdir -p /Storage/Data/Docker/sysctl.io/letsencrypt/; rsync -avr --delete root@framework-server:/Storage/Data/Docker/sysctl.io/letsencrypt/ /Storage/Data/Docker/sysctl.io/letsencrypt/''
2024-03-15 02:28:10 +01:00
];
};
# Containers
2024-03-25 01:46:12 +01:00
virtualisation.oci-containers.containers."derp" = {
2024-03-15 06:17:26 +01:00
image = "docker.io/fredliang/derper";
2024-03-15 02:28:10 +01:00
environment = {
DERP_ADDR = ":1443";
2024-03-15 13:05:55 +01:00
DERP_CERT_DIR = "/app/certs";
DERP_CERT_MODE = "manual";
2024-08-12 06:19:07 +02:00
DERP_DOMAIN = domainName;
2024-03-15 02:28:10 +01:00
DERP_STUN = "true";
2024-03-22 06:12:01 +01:00
DERP_VERIFY_CLIENTS = "true";
2024-08-11 05:41:03 +02:00
DERP_HTTP_PORT = "-1";
2024-03-15 02:28:10 +01:00
};
volumes = [
2024-03-22 06:33:28 +01:00
"/var/run/tailscale/tailscaled.sock:/var/run/tailscale/tailscaled.sock:ro"
2024-08-12 06:19:07 +02:00
"/Storage/Data/Docker/sysctl.io/letsencrypt/external/*.sysctl.io/public.crt:/app/certs/${domainName}.crt:ro"
"/Storage/Data/Docker/sysctl.io/letsencrypt/external/*.sysctl.io/private.key:/app/certs/${domainName}.key:ro"
2024-03-15 02:28:10 +01:00
];
ports = [
"3478:3478/udp"
"1443:1443/tcp"
];
log-driver = "journald";
2024-08-11 04:01:21 +02:00
extraOptions = [ "--network=host" ];
2024-03-15 02:28:10 +01:00
};
}