nixos-config/hosts/nostromo.nix

225 lines
4.7 KiB
Nix
Raw Normal View History

2020-02-03 20:51:49 -08:00
{ lib, config, pkgs, ... }:
2019-12-25 15:20:36 -08:00
let
hostname = "nostromo";
2020-06-07 19:11:58 -07:00
host-internal-ip = "10.0.0.1";
2020-02-03 20:51:49 -08:00
inherit (lib.strings) concatStringsSep;
2019-12-25 15:20:36 -08:00
in {
boot.kernelModules = [ "kvm-amd" ];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
2020-06-07 19:11:58 -07:00
boot.loader.grub.device = "/dev/sda";
2019-12-25 15:20:36 -08:00
2020-02-18 10:58:47 -08:00
hardware.bluetooth.enable = false;
2019-12-25 15:20:36 -08:00
imports = [
../defaults.nix
../hardware-configuration.nix
];
2020-02-18 10:58:47 -08:00
fudo.common = {
profile = "server";
site = "seattle";
};
2020-06-07 19:11:58 -07:00
fudo.local-network = {
enable = true;
# See fudo/sites/seattle.nix for general settings
dns-servers = [ host-internal-ip ];
2020-06-20 15:36:00 -07:00
gateway = host-internal-ip;
2020-06-07 19:11:58 -07:00
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;
};
2020-06-20 15:36:00 -07:00
fudo.slynk = {
enable = true;
};
2019-12-25 15:20:36 -08:00
networking = {
hostName = hostname;
2020-06-07 19:11:58 -07:00
nameservers = [ host-internal-ip ];
2019-12-25 15:20:36 -08:00
# Create a bridge for VMs to use
2020-06-07 19:11:58 -07:00
macvlans = {
intif0 = {
interface = "eno1";
mode = "bridge";
};
2019-12-25 15:20:36 -08:00
};
interfaces = {
2020-06-07 19:11:58 -07:00
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;
2019-12-25 15:20:36 -08:00
macAddress = "46:54:76:06:f1:10";
ipv4.addresses = [
{
2020-06-07 19:11:58 -07:00
address = host-internal-ip;
2020-02-03 20:51:49 -08:00
prefixLength = 22;
}
{
address = "10.0.10.2";
prefixLength = 24;
2019-12-25 15:20:36 -08:00
}
];
};
2020-06-07 19:11:58 -07:00
};
nat = {
enable = true;
externalInterface = "eno2";
internalInterfaces = ["intif0"];
2019-12-25 15:20:36 -08:00
};
};
2020-02-18 10:58:47 -08:00
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"
];
};
2020-06-07 19:11:58 -07:00
2020-06-22 11:10:36 -07:00
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";
};
2020-02-18 10:58:47 -08:00
};
2019-12-25 15:20:36 -08:00
environment.systemPackages = with pkgs; [
2020-06-20 15:36:00 -07:00
dnsproxy
2019-12-25 15:20:36 -08:00
libguestfs-with-appliance
libvirt
virtmanager
];
2020-06-07 19:11:58 -07:00
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
2020-06-20 15:36:00 -07:00
# extraDockerOptions = [
# "--dns=1.1.1.1"
# ];
2020-06-07 19:11:58 -07:00
};
2019-12-25 15:20:36 -08:00
};
2020-02-03 20:51:49 -08:00
services = {
2020-06-07 19:11:58 -07:00
dhcpd6.enable = false;
2020-02-03 20:51:49 -08:00
# glusterfs = {
# enable = true;
# enableGlustereventsd = true;
# useRpcbind = true;
# };
2020-06-07 19:11:58 -07:00
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;
'';
};
};
};
};
2020-06-20 15:36:00 -07:00
# ceph = {
# enable = true;
2020-02-03 20:51:49 -08:00
2020-06-20 15:36:00 -07:00
# 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"];
# };
# };
2020-02-03 20:51:49 -08:00
};
2019-12-25 15:20:36 -08:00
}