nixos-config/configs/nixos/plover/default.nix

140 lines
3.5 KiB
Nix
Raw Permalink Normal View History

2024-12-18 07:24:24 +00:00
{ config, lib, pkgs, foodogsquaredLib, foodogsquaredUtils
, foodogsquaredModulesPath, ... }:
2022-11-23 05:27:01 +00:00
{
imports = [
# The users for this host.
2024-06-18 13:56:32 +00:00
(foodogsquaredUtils.getUser "nixos" "admin")
(foodogsquaredUtils.getUser "nixos" "plover")
"${foodogsquaredModulesPath}/profiles/hardened.nix"
"${foodogsquaredModulesPath}/profiles/hetzner-cloud-cx22.nix"
2023-01-12 13:22:55 +00:00
./disko.nix
./modules
2022-11-23 05:27:01 +00:00
];
boot.supportedFilesystems = [ "btrfs" ];
# Host-specific modules structuring.
hosts.plover.services = {
networking = {
enable = true;
macAddress = "96:00:03:c3:99:93";
};
backup.enable = true;
database.enable = true;
firewall.enable = true;
idm.enable = true;
monitoring.enable = true;
reverse-proxy.enable = true;
fail2ban.enable = true;
grafana.enable = true;
# All of the self-hosted applications belong in here.
gitea.enable = true;
vaultwarden.enable = true;
};
2024-12-18 07:24:24 +00:00
# Overriding the kernel version for ourselves.
boot.kernelPackages = lib.mkOverride 500 pkgs.linuxKernel.packages.linux_6_11_hardened;
# We're using our own VPN configuration for this one.
suites.vpn.personal.enable = true;
2024-10-02 13:18:16 +00:00
services.tailscale.useRoutingFeatures = "server";
2024-12-18 07:24:24 +00:00
services.tailscaleAuth.enable = true;
# Post installation script to be executed manually by the provisioner.
system.build.postInstallationScript = pkgs.writeShellApplication {
name = "post-installation-script";
2024-12-18 07:24:24 +00:00
runtimeInputs = with pkgs; [ openssh ];
text = ''
sopsPrivateKey="''${1:-"key.txt"}"
sopsKeyfileDir="$(dirname ${lib.escapeShellArg config.sops.age.keyFile})"
mkdir -p "$sopsKeyfileDir" && mv "$sopsPrivateKey" "$sopsKeyfileDir"
'';
};
state.network = rec {
2024-12-18 07:24:24 +00:00
ipv4 = "135.181.26.192";
ipv6 = "2a01:4f9:c010:8db4::1";
interfaces = {
lan = {
ifname = "enp7s0";
ipv4 = "10.0.0.2";
ipv6 = "fe80::8400:ff:fef7:864";
ipv4Gateway = "10.0.0.1";
ipv6Gateway = "fe80::1";
};
wan = {
ifname = "enp1s0";
inherit ipv4 ipv6;
ipv4Gateway = "172.31.1.1";
ipv6Gateway = "fe80::1";
};
};
secondaryNameservers = [
# ns1.first-ns.de
"213.239.242.238"
"2a01:4f8:0:a101::a:1"
# robotns2.second-ns.de
"213.133.100.103"
"2a01:4f8:0:1::5ddc:2"
# robotns3.second-ns.com
"193.47.99.3"
"2001:67c:192c::add:a3"
];
};
state.paths = {
dataDir = "/var/lib";
cacheDir = "/var/cache";
logDir = "/var/log";
runtimeDir = "/run";
};
# Offline SSH!?!
programs.mosh.enable = true;
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets/secrets.yaml {
"ssh-key" = { };
"lego/env" = { };
2023-07-05 03:38:58 +00:00
};
2022-11-23 05:27:01 +00:00
2023-01-12 13:22:55 +00:00
# All of the keys required to deploy the secrets.
2022-11-23 05:27:01 +00:00
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
suites.server = {
2022-12-02 04:33:51 +00:00
enable = true;
cleanup.enable = true;
};
2023-01-12 13:22:55 +00:00
# DNS-related settings. We're settling by configuring the ACME setup with a
# self-hosted DNS server.
security.acme.defaults = {
email = "admin+acme@foodogsquared.one";
dnsProvider = "hetzner";
2024-12-18 07:24:24 +00:00
environmentFile =
config.sops.secrets."lego/env".path or "/var/lib/secrets/acme.env";
enableDebugLogs = true;
2022-12-03 00:09:26 +00:00
};
# Enable generating new DH params.
security.dhparams.enable = true;
# !!! The keys should be rotated at an interval here.
services.openssh.hostKeys = lib.singleton {
path = config.sops.secrets."ssh-key".path;
2022-12-02 04:33:51 +00:00
type = "ed25519";
};
2022-12-02 04:33:51 +00:00
system.stateVersion = "24.11";
2022-11-23 05:27:01 +00:00
}