225 lines
4.7 KiB
Nix
225 lines
4.7 KiB
Nix
{ lib, config, pkgs, ... }:
|
|
|
|
let
|
|
hostname = "nostromo.sea.fudo.org";
|
|
host-internal-ip = "10.0.0.1";
|
|
inherit (lib.strings) concatStringsSep;
|
|
|
|
in {
|
|
|
|
boot.kernelModules = [ "kvm-amd" ];
|
|
|
|
boot.loader.grub.enable = true;
|
|
boot.loader.grub.version = 2;
|
|
boot.loader.grub.device = "/dev/sda";
|
|
|
|
hardware.bluetooth.enable = false;
|
|
|
|
imports = [
|
|
../defaults.nix
|
|
../hardware-configuration.nix
|
|
];
|
|
|
|
fudo.common = {
|
|
profile = "server";
|
|
site = "seattle";
|
|
};
|
|
|
|
fudo.local-network = {
|
|
enable = true;
|
|
# See fudo/sites/seattle.nix for general settings
|
|
dns-servers = [ host-internal-ip ];
|
|
gateway = host-internal-ip;
|
|
dhcp-interfaces = [ "intif0" ];
|
|
dns-serve-ips = [ host-internal-ip "127.0.0.1" "127.0.1.1" ];
|
|
# Using a pihole running in docker, see below
|
|
recursive-resolver = "${host-internal-ip} port 5353";
|
|
# recursive-resolver = "1.1.1.1";
|
|
server-ip = host-internal-ip;
|
|
};
|
|
|
|
fudo.slynk = {
|
|
enable = true;
|
|
};
|
|
|
|
networking = {
|
|
hostName = hostname;
|
|
|
|
nameservers = [ host-internal-ip ];
|
|
|
|
# Create a bridge for VMs to use
|
|
macvlans = {
|
|
intif0 = {
|
|
interface = "eno1";
|
|
mode = "bridge";
|
|
};
|
|
};
|
|
|
|
interfaces = {
|
|
eno1.useDHCP = false;
|
|
eno3.useDHCP = false;
|
|
eno4.useDHCP = false;
|
|
enp33s0f0.useDHCP = false;
|
|
enp33s0f1.useDHCP = false;
|
|
enp9s0f0.useDHCP = false;
|
|
enp9s0f1.useDHCP = false;
|
|
|
|
eno2.useDHCP = true;
|
|
|
|
intif0 = {
|
|
useDHCP = false;
|
|
macAddress = "46:54:76:06:f1:10";
|
|
ipv4.addresses = [
|
|
{
|
|
address = host-internal-ip;
|
|
prefixLength = 22;
|
|
}
|
|
{
|
|
address = "10.0.10.2";
|
|
prefixLength = 24;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
|
|
nat = {
|
|
enable = true;
|
|
externalInterface = "eno2";
|
|
internalInterfaces = ["intif0"];
|
|
};
|
|
};
|
|
|
|
fudo = {
|
|
postgresql = {
|
|
enable = true;
|
|
ssl-private-key = "/srv/nostromo/certs/private/privkey.pem";
|
|
ssl-certificate = "/srv/nostromo/certs/cert.pem";
|
|
keytab = "/srv/nostromo/keytabs/postgres.keytab";
|
|
|
|
local-networks = [
|
|
"10.0.0.1/24"
|
|
"127.0.0.1/8"
|
|
];
|
|
};
|
|
|
|
secure-dns-proxy = {
|
|
enable = true;
|
|
port = 3535;
|
|
upstream-dns = [
|
|
"https://cloudflare-dns.com/dns-query"
|
|
# "https://dns.adguard.com/dns-query"
|
|
];
|
|
bootstrap-dns = "1.1.1.1";
|
|
};
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
dnsproxy
|
|
libguestfs-with-appliance
|
|
libvirt
|
|
virtmanager
|
|
];
|
|
|
|
virtualisation = {
|
|
docker = {
|
|
enable = true;
|
|
autoPrune.enable = true;
|
|
enableOnBoot = true;
|
|
};
|
|
|
|
libvirtd = {
|
|
enable = true;
|
|
qemuPackage = pkgs.qemu_kvm;
|
|
onShutdown = "shutdown";
|
|
};
|
|
};
|
|
|
|
docker-containers = {
|
|
pihole = {
|
|
image = "pihole/pihole:4.3.2-1";
|
|
ports = [
|
|
"5353:53/tcp"
|
|
"5353:53/udp"
|
|
"3080:80/tcp"
|
|
];
|
|
environment = {
|
|
ServerIP = host-internal-ip;
|
|
VIRTUAL_HOST = "dns-hole.sea.fudo.org";
|
|
DNS1 = "1.1.1.1";
|
|
DNS2 = "8.8.8.8";
|
|
};
|
|
volumes = [
|
|
"/srv/pihole/etc-pihole/:/etc/pihole/"
|
|
"/srv/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/"
|
|
];
|
|
# TODO: DNS-over-HTTPS via cloudflared
|
|
# extraDockerOptions = [
|
|
# "--dns=1.1.1.1"
|
|
# ];
|
|
};
|
|
};
|
|
|
|
services = {
|
|
dhcpd6.enable = false;
|
|
|
|
# glusterfs = {
|
|
# enable = true;
|
|
# enableGlustereventsd = true;
|
|
# useRpcbind = true;
|
|
# };
|
|
|
|
nginx = {
|
|
enable = true;
|
|
|
|
virtualHosts = {
|
|
"pihole.sea.fudo.org" = {
|
|
serverAliases = [
|
|
"dns-hole.sea.fudo.org"
|
|
"hole.sea.fudo.org"
|
|
];
|
|
|
|
locations."/" = {
|
|
proxyPass = "http://127.0.0.1:3080";
|
|
|
|
extraConfig = ''
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-By $server_addr:$server_port;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
# ceph = {
|
|
# enable = true;
|
|
|
|
# global = {
|
|
# clusterName = "sea-data";
|
|
# clusterNetwork = "10.0.10.0/24";
|
|
# fsid = "d443e192-896d-4102-a60f-f8f0777eb2a3";
|
|
# monHost = "10.0.10.2";
|
|
# monInitialMembers = "mon-1";
|
|
# publicNetwork = "10.0.0.0/22";
|
|
# };
|
|
|
|
# mds = {
|
|
# enable = true;
|
|
# daemons = ["srv-2"];
|
|
# };
|
|
|
|
# mgr = {
|
|
# enable = true;
|
|
# daemons = ["srv-2"];
|
|
# };
|
|
|
|
# mon = {
|
|
# enable = true;
|
|
# daemons = ["srv-2"];
|
|
# };
|
|
# };
|
|
};
|
|
}
|