diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/linde.nix | 104 | ||||
-rw-r--r-- | system/mba.nix | 1 | ||||
-rwxr-xr-x | system/nanopi.nix | 5 | ||||
-rw-r--r-- | system/prefect.nix | 4 | ||||
-rw-r--r-- | system/settings/dev.nix | 3 |
5 files changed, 97 insertions, 20 deletions
diff --git a/system/linde.nix b/system/linde.nix index 2ae0b714..c0af9144 100644 --- a/system/linde.nix +++ b/system/linde.nix @@ -13,8 +13,10 @@ let net-gw = "172.31.1.1"; net-ip6 = "2a01:4f8:c012:23a4::1"; net-rdnsip = "2a01:4f8:c012:23a4::53"; + net-acmeip = "2a01:4f8:c012:23a4::715"; net-mask6 = "64"; net-gw6 = "fe80::1"; + domain = "alanpearce.eu"; ts-domain = "hydra-pinecone.ts.net"; golink = (builtins.getFlake (toString <golink>)).nixosModules.default; in @@ -22,6 +24,7 @@ in imports = [ <personal/modules/nixos/laminar.nix> + <personal/modules/nixos/goatcounter.nix> <home-manager/nixos> <agenix/modules/age.nix> <searchix/nix/modules> @@ -155,6 +158,7 @@ in networking = { hostName = hostname; + inherit domain; useDHCP = false; dhcpcd.enable = false; nameservers = [ @@ -167,6 +171,7 @@ in ${net-ip4} = [ "${hostname}.alanpearce.eu" hostname ]; ${net-ip6} = [ "${hostname}.alanpearce.eu" hostname ]; ${net-rdnsip} = [ "dns" ]; + ${net-acmeip} = [ "acme" ]; }; firewall = { enable = true; @@ -224,6 +229,7 @@ in address = [ "${net-ip6}/${net-mask6}" "${net-rdnsip}/${net-mask6}" + "${net-acmeip}/${net-mask6}" ]; addresses = [{ Address = "${net-ip4}/${net-mask4}"; @@ -344,6 +350,19 @@ in # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.05"; # Did you read the comment? + services.goatcounter = { + enable = true; + listenAddress = "localhost"; + port = 8082; + package = (import <personal> { inherit pkgs; }).goatcounter; + settings = { + tls = "proxy"; + websocket = true; + automigrate = true; + smtp = "smtp://localhost:25"; + }; + }; + services.powerdns = let inherit (lib.lists) flatten; @@ -445,6 +464,24 @@ in }; }; + services.postfix = + let + localUser = "alan"; + forwardingAddress = "alan@alanpearce.eu"; + in + { + enable = true; + destination = [ ]; + domain = config.networking.domain; + virtual = '' + @${config.networking.hostName}.${config.networking.domain} ${localUser} + ${localUser} ${forwardingAddress} + ''; + config = { + inet_interfaces = "loopback-only"; + }; + }; + services.kresd = { enable = true; # package = pkgs.knot-resolver.override { extraFeatures = true; }; @@ -580,11 +617,37 @@ in }; }; + services.acme-dns = { + enable = true; + settings = + let + me = "acme.${domain}"; + in + { + general = { + listen = "[${net-acmeip}]:53"; + protocol = "both6"; + domain = me; + nsname = me; + nsadmin = builtins.replaceStrings [ "@" ] [ "." ] config.security.acme.defaults.email; + records = [ + "${me}. AAAA ${net-acmeip}" + "${me}. NS ${me}." + ]; + }; + api = { + ip = "[${net-acmeip}]"; + tls = "letsencrypt"; + port = 443; + notification-email = config.security.acme.defaults.email; + }; + }; + }; + security.acme = { defaults = { email = "alan@alanpearce.eu"; - dnsProvider = "pdns"; - dnsResolver = "1.1.1.1:53"; + dnsProvider = "acme-dns"; credentialsFile = config.age.secrets.acme.path; reloadServices = [ "caddy" ]; validMinDays = 32; @@ -597,6 +660,9 @@ in reloadServices = map (x: "kresd@${toString x}") (range 1 config.services.kresd.instances); group = "knot-resolver"; }; + certs."stats.alanpearce.eu" = { + extraDomainNames = [ "*.stats.alanpearce.eu" ]; + }; }; users.groups.acme.members = [ "caddy" @@ -716,6 +782,7 @@ in ns = config.services.nix-serve; in { + useACMEHost = "alanpearce.eu"; extraConfig = '' reverse_proxy ${ns.bindAddress}:${toString ns.port} ''; @@ -725,10 +792,31 @@ in srv = config.services.laminar; in { + useACMEHost = "alanpearce.eu"; extraConfig = '' reverse_proxy ${srv.settings.bindHTTP} ''; }; + "stats.alanpearce.eu" = + let + srv = config.services.goatcounter; + in + { + useACMEHost = "stats.alanpearce.eu"; + serverAliases = [ "*.stats.alanpearce.eu" ]; + extraConfig = '' + reverse_proxy ${srv.listenAddress}:${toString srv.port} + ''; + }; + "go.alanpearce.eu" = { + useACMEHost = "alanpearce.eu"; + extraConfig = '' + encode zstd gzip + ${security-headers {}} + root * /srv/http/go + file_server + ''; + }; }; }; systemd.services.caddy.serviceConfig = { @@ -926,17 +1014,17 @@ in { script-src = [ (baseURL + "/static/") - "https://gc.zgo.at" + "https://searchix.stats.alanpearce.eu" "https://js-de.sentry-cdn.com" "https://browser.sentry-cdn.com" ]; img-src = [ self - "https://gc.zgo.at" + "https://searchix.stats.alanpearce.eu" ]; connect-src = [ self - "https://searchix.goatcounter.com/count" + "https://searchix.stats.alanpearce.eu/count" "*.sentry.io" ]; worker-src = [ @@ -947,8 +1035,8 @@ in <script async src="https://js-de.sentry-cdn.com/d735e99613a86e1625fb85d0e8e762de.min.js" crossorigin="anonymous"></script> - <script data-goatcounter="https://searchix.goatcounter.com/count" - async src="//gc.zgo.at/count.v4.js" + <script data-goatcounter="https://searchix.stats.alanpearce.eu/count" + async src="//searchix.stats.alanpearce.eu/count.v4.js" crossorigin="anonymous" integrity="sha384-nRw6qfbWyJha9LhsOtSb2YJDyZdKvvCFh0fJYlkquSFjUxp9FVNugbfy8q1jdxI+"></script> ''; @@ -997,7 +1085,7 @@ in enable = true; path = with pkgs; [ bash - stdenv + coreutils git cached-nix-shell nix diff --git a/system/mba.nix b/system/mba.nix index c29f6833..cc8c81da 100644 --- a/system/mba.nix +++ b/system/mba.nix @@ -1,7 +1,6 @@ { ... }: { imports = [ ./settings/darwin.nix - ./settings/programs/base.nix ./settings/dev.nix ./settings/programs/shell.nix <personal/modules/darwin/caddy> diff --git a/system/nanopi.nix b/system/nanopi.nix index 3c49ec8f..1e7411fa 100755 --- a/system/nanopi.nix +++ b/system/nanopi.nix @@ -523,10 +523,6 @@ in # ]; bind-interfaces = true; - # if this is false, a remote query for nanopi returns 127.0.0.2, because that's in /etc/hosts - no-hosts = false; - expand-hosts = true; - dnssec = true; trust-anchor = ".,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D"; @@ -611,7 +607,6 @@ in services.caddy = { enable = true; globalConfig = '' - auto_https disable_redirects pki { ca home { name "Home CA" diff --git a/system/prefect.nix b/system/prefect.nix index 980e35ff..e145c304 100644 --- a/system/prefect.nix +++ b/system/prefect.nix @@ -151,6 +151,7 @@ }; hosts = { "fd7a:115c:a1e0::53" = [ "tailscale" "ts" ]; + "::1" = [ "alanpearce.test" "alanpearce.localhost" ]; }; nftables = { @@ -194,9 +195,6 @@ -----END CERTIFICATE----- '' ]; - networking.hosts = { - "127.0.0.80" = [ "alanpearce.test" "alanpearce.localhost" ]; - }; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; nix.settings.trusted-users = [ "root" "nixremote" ]; diff --git a/system/settings/dev.nix b/system/settings/dev.nix index 7d2e6193..b1817914 100644 --- a/system/settings/dev.nix +++ b/system/settings/dev.nix @@ -1,9 +1,6 @@ { ... }: { services.caddy = { enable = true; - globalConfig = '' - auto_https disable_redirects - ''; virtualHosts = let local_tls = '' |