nixos-config/hosts/procul.nix

321 lines
7.0 KiB
Nix
Raw Normal View History

2020-06-22 13:29:33 -07:00
{ config, pkgs, lib, ... }:
with lib;
let
hostname = "procul";
2020-06-25 20:38:50 -07:00
domain = "informis.land";
2020-06-22 13:29:33 -07:00
mail-hostname = hostname;
host_ipv4 = "172.86.179.18";
2020-06-25 20:38:50 -07:00
host-fqdn = "${hostname}.${domain}";
2020-06-22 13:29:33 -07:00
all-hostnames = [];
acme-private-key = hostname: "/var/lib/acme/${hostname}/key.pem";
acme-certificate = hostname: "/var/lib/acme/${hostname}/fullchain.pem";
acme-ca = "/etc/nixos/static/letsencryptauthorityx3.pem";
fudo-ca = "/etc/nixos/static/fudo_ca.pem";
in {
boot.loader.grub = {
enable = true;
version = 2;
device = "/dev/sdb";
};
imports = [
../hardware-configuration.nix
../defaults.nix
2020-06-25 20:38:50 -07:00
../informis/users.nix
];
2020-06-22 13:29:33 -07:00
networking = {
hostName = hostname;
2020-06-25 20:38:50 -07:00
# provided by secure-dns-proxy
nameservers = [ "127.0.0.1" ];
2020-06-22 13:29:33 -07:00
dhcpcd.enable = false;
useDHCP = false;
# TODO: fix IPv6
enableIPv6 = true;
# Create a bridge for VMs to use
macvlans = {
extif0 = {
interface = "enp0s25";
mode = "bridge";
};
};
2020-07-23 22:38:48 -07:00
# For WireGuard
nat = {
enable = true;
externalInterface = "extif0";
internalInterfaces = [ "wgtun0" ];
};
2020-06-22 13:29:33 -07:00
interfaces = {
extif0 = {
# result of:
# echo $FQDN-extif|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'
macAddress = "02:e2:b7:db:e8:af";
ipv4.addresses = [
{
address = host_ipv4;
prefixLength = 29;
}
];
};
};
};
hardware.bluetooth.enable = false;
2020-06-25 20:38:50 -07:00
users = {
users = {
gituser = {
isSystemUser = true;
group = "nogroup";
};
};
};
fudo = {
common = {
# Sets some server-common settings. See /etc/nixos/fudo/profiles/...
profile = "server";
# Sets some common site-specific settings: gateway, monitoring, etc. See /etc/nixos/fudo/sites/...
site = "joes";
domain = domain;
admin-email = "admin@${domain}";
local-networks = [
"172.86.179.16/29"
"208.81.1.128/28"
"208.81.3.112/28"
"172.17.0.0/16"
"127.0.0.0/8"
];
};
2020-11-19 14:16:04 -08:00
client.dns = {
enable = true;
ipv4 = true;
ipv6 = true;
user = "fudo-client";
external-interface = "extif0";
password-file = "/srv/client/secure/client.passwd";
};
2020-06-25 20:38:50 -07:00
# Not all users need access to procul; don't allow LDAP-user access.
authentication.enable = false;
auth.kdc = {
enable = true;
database-path = "/var/heimdal/heimdal";
realm = "INFORMIS.LAND";
mkey-file = "/srv/heimdal/secure/m-key";
acl-file = "/etc/heimdal/kdc.acl";
bind-addresses = [
host_ipv4
"127.0.0.1"
"127.0.1.1"
];
};
2020-07-23 22:38:48 -07:00
system.tmpOnTmpfs = false;
2020-06-25 20:38:50 -07:00
secure-dns-proxy = {
enable = true;
upstream-dns = [ "https://cloudflare-dns.com/dns-query" ];
bootstrap-dns = "1.1.1.1";
listen-ips = [ "127.0.0.1" ];
port = 53;
};
dns = {
enable = true;
dns-hosts = {
"ns1.informis.land" = "172.86.179.18";
"ns2.informis.land" = "172.86.179.18";
};
listen-ips = [host_ipv4];
domains = {
"informis.land" = import ../informis/informis.land.nix {
inherit host_ipv4 config;
};
};
};
mail-server = {
enable = true;
debug = true;
domain = domain;
hostname = "${host-fqdn}";
monitoring = false;
mail-user = "mailuser";
mail-user-id = 525;
mail-group = "mailgroup";
clamav.enable = true;
dkim.signing = true;
dovecot = {
ssl-certificate = acme-certificate "imap.${domain}";
ssl-private-key = acme-private-key "imap.${domain}";
};
postfix = {
ssl-certificate = acme-certificate "smtp.${domain}";
ssl-private-key = acme-private-key "smtp.${domain}";
};
# This should NOT include the primary domain
local-domains = [
host-fqdn
"smtp.${domain}"
];
mail-directory = "/srv/mailserver/mail";
state-directory = "/srv/mailserver/state";
trusted-networks = [
"172.86.179.16/29"
"127.0.0.0/16"
];
alias-users = {
root = ["niten"];
postmaster = ["niten"];
hostmaster = ["niten"];
webmaster = ["niten"];
system = ["niten"];
admin = ["niten"];
dmarc-report = ["niten"];
};
};
postgresql = {
enable = true;
ssl-certificate = (acme-certificate host-fqdn);
ssl-private-key = (acme-private-key host-fqdn);
keytab = "/srv/postgres/secure/postgres.keytab";
local-networks = [
"172.86.179.16/29"
"127.0.0.0/16"
];
users = {
gituser = {
2020-11-19 14:16:04 -08:00
password-file = "/srv/git/secure/db.passwd";
2020-06-25 20:38:50 -07:00
databases = {
2020-11-19 14:16:04 -08:00
git = {
access = "CONNECT";
entity-access = {
"ALL TABLES IN SCHEMA public" = "SELECT,INSERT,UPDATE,DELETE";
"ALL SEQUENCES IN SCHEMA public" = "SELECT, UPDATE";
};
};
2020-06-25 20:38:50 -07:00
};
};
};
databases = {
2020-11-19 14:16:04 -08:00
git = {
users = ["niten"];
};
2020-06-25 20:38:50 -07:00
};
};
git = {
enable = true;
hostname = "git.informis.land";
site-name = "informis git";
user = "gituser";
repository-dir = /srv/git/repo;
state-dir = /srv/git/state;
database = {
user = "gituser";
password-file = /srv/git/secure/db.passwd;
hostname = "127.0.0.1";
name = "git";
};
};
acme = {
enable = true;
admin-address = "admin@${domain}";
hostnames = [
"informis.land"
2020-06-25 20:38:50 -07:00
"imap.informis.land"
"smtp.informis.land"
"gemini.informis.land"
2020-06-25 20:38:50 -07:00
];
};
};
security.acme.certs.${host-fqdn}.email = "admin@${domain}";
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedTlsSettings = true;
virtualHosts = {
"${host-fqdn}" = {
enableACME = true;
forceSSL = true;
};
};
};
2020-07-23 22:38:48 -07:00
fudo.vpn = {
2020-11-19 11:05:24 -08:00
# fer some fuckin reason this sets the default gw to the vpn interface
enable = false;
network = "10.100.0.0/16";
server-ip = host_ipv4;
2020-07-23 22:38:48 -07:00
private-key-file = "/srv/wireguard/secure/secret.key";
peers = {
2020-11-19 11:05:24 -08:00
peter = "/srv/wireguard/clients/peter.key";
ken = "/srv/wireguard/clients/ken.key";
helen = "/srv/wireguard/clients/helen.key";
2020-07-23 22:38:48 -07:00
};
};
informis.cl-gemini = {
enable = true;
server-ip = host_ipv4;
2020-07-16 13:46:52 -07:00
document-root = "/srv/gemini/root";
ssl-private-key = "/srv/gemini/private/key.pem";
ssl-certificate = "/srv/gemini/private/cert.pem";
slynk-port = 4005;
2020-07-16 13:46:52 -07:00
textfiles-archive = "/srv/gemini/textfiles";
feeds = {
viator = {
title = "viator's phlog";
path = "/home/viator/gemini-public/feed/";
url = "gemini://informis.land/user/viator/feed/";
};
};
};
2020-06-22 13:29:33 -07:00
}