2024-06-12 21:42:01 +02:00
|
|
|
{ self, ... }:
|
2024-06-13 15:11:08 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
2024-12-03 20:02:13 +01:00
|
|
|
config,
|
2024-06-13 15:11:08 +02:00
|
|
|
modulesPath,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2022-10-05 19:21:46 +02:00
|
|
|
{
|
2022-09-07 22:59:08 +02:00
|
|
|
imports = [
|
2023-04-09 22:01:32 +02:00
|
|
|
"${modulesPath}/profiles/qemu-guest.nix"
|
2023-01-17 23:55:24 +01:00
|
|
|
|
2022-09-07 22:59:08 +02:00
|
|
|
../../users/root
|
|
|
|
../../users/erwin
|
2024-04-24 13:58:04 +02:00
|
|
|
|
|
|
|
./caddy
|
2022-09-07 22:59:08 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
eboskma = {
|
2023-04-09 22:01:32 +02:00
|
|
|
users.erwin = {
|
|
|
|
enable = true;
|
|
|
|
server = true;
|
|
|
|
};
|
|
|
|
headscale = {
|
2023-07-04 20:31:56 +02:00
|
|
|
enable = false;
|
2023-04-09 22:01:32 +02:00
|
|
|
baseDomain = "asgard.datarift.nl";
|
|
|
|
serverUrl = "https://heimdall.datarift.nl";
|
|
|
|
};
|
2023-06-01 16:59:19 +02:00
|
|
|
keycloak.enable = true;
|
2022-09-07 22:59:08 +02:00
|
|
|
nix-common = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2022-10-05 19:21:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
2023-04-09 22:01:32 +02:00
|
|
|
hostName = "heimdall";
|
|
|
|
domain = "datarift.nl";
|
|
|
|
|
|
|
|
usePredictableInterfaceNames = lib.mkForce false;
|
2024-03-07 16:35:16 +01:00
|
|
|
useDHCP = false;
|
|
|
|
networkmanager.enable = false;
|
|
|
|
useNetworkd = true;
|
|
|
|
firewall.trustedInterfaces = [ "tailscale0" ];
|
|
|
|
};
|
|
|
|
|
2024-12-03 20:02:13 +01:00
|
|
|
systemd = {
|
|
|
|
network = {
|
|
|
|
enable = true;
|
2024-03-07 16:35:16 +01:00
|
|
|
|
2024-12-03 20:02:13 +01:00
|
|
|
networks = {
|
|
|
|
"40-eth0" = {
|
|
|
|
matchConfig = {
|
|
|
|
Name = "eth0";
|
|
|
|
};
|
2024-03-07 16:35:16 +01:00
|
|
|
|
2024-12-03 20:02:13 +01:00
|
|
|
networkConfig = {
|
|
|
|
Address = [
|
|
|
|
"159.69.211.175/32"
|
|
|
|
"2a01:4f8:1c1e:5fb2::1/64"
|
|
|
|
"fe80::9400:2ff:fe12:a2eb/64"
|
|
|
|
];
|
|
|
|
DHCP = "no";
|
|
|
|
Gateway = [
|
|
|
|
"172.31.1.1"
|
|
|
|
"fe80::1"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
routes = [
|
|
|
|
{
|
|
|
|
Destination = "172.31.1.1/32";
|
|
|
|
Scope = "link";
|
|
|
|
Protocol = "static";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
Destination = "fe80::1/128";
|
|
|
|
Scope = "link";
|
|
|
|
Protocol = "static";
|
|
|
|
}
|
2024-03-07 16:35:16 +01:00
|
|
|
];
|
|
|
|
};
|
2022-09-07 22:59:08 +02:00
|
|
|
};
|
2023-04-09 22:01:32 +02:00
|
|
|
};
|
2024-12-03 20:02:13 +01:00
|
|
|
|
|
|
|
services.caddy.serviceConfig.EnvironmentFile = [ config.sops.secrets.caddy-env.path ];
|
2023-04-09 22:01:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
### Hetzner stuff
|
|
|
|
boot = {
|
2023-05-05 19:47:12 +02:00
|
|
|
tmp.cleanOnBoot = true;
|
2023-04-09 22:01:32 +02:00
|
|
|
loader.grub.device = "/dev/sda";
|
|
|
|
initrd = {
|
2024-02-05 11:46:52 +01:00
|
|
|
availableKernelModules = [
|
|
|
|
"ata_piix"
|
|
|
|
"uhci_hcd"
|
|
|
|
"xen_blkfront"
|
|
|
|
"vmw_pvscsi"
|
|
|
|
];
|
2023-04-09 22:01:32 +02:00
|
|
|
kernelModules = [ "nvme" ];
|
2022-09-07 22:59:08 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
fileSystems."/" = {
|
|
|
|
device = "/dev/sda1";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
2023-04-09 22:01:32 +02:00
|
|
|
|
|
|
|
zramSwap.enable = true;
|
|
|
|
### END Hetzner stuff
|
2022-09-07 22:59:08 +02:00
|
|
|
|
|
|
|
time.timeZone = "Europe/Amsterdam";
|
|
|
|
|
|
|
|
system.configurationRevision = self.inputs.nixpkgs.lib.mkIf (self ? rev) self.rev;
|
|
|
|
|
2023-09-13 14:50:03 +02:00
|
|
|
services = {
|
|
|
|
udev.extraRules = ''
|
|
|
|
ATTR{address}=="96:00:02:12:a2:eb", NAME="eth0"
|
|
|
|
'';
|
|
|
|
|
|
|
|
openssh = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
};
|
2023-04-10 23:27:31 +02:00
|
|
|
};
|
2023-10-23 08:10:12 +02:00
|
|
|
tailscale = {
|
|
|
|
enable = true;
|
|
|
|
permitCertUid = "caddy";
|
|
|
|
};
|
2024-06-13 15:11:08 +02:00
|
|
|
|
|
|
|
caddy = {
|
2024-12-03 20:02:13 +01:00
|
|
|
package = pkgs.caddy.withPlugins {
|
|
|
|
plugins = [ "github.com/caddy-dns/cloudflare@89f16b99c18ef49c8bb470a82f895bce01cbaece" ];
|
|
|
|
hash = "sha256-Aqu2st8blQr/Ekia2KrH1AP/2BVZIN4jOJpdLc1Rr4g=";
|
|
|
|
};
|
|
|
|
|
2024-06-13 15:11:08 +02:00
|
|
|
virtualHosts = {
|
|
|
|
"garfield.datarift.nl" =
|
|
|
|
let
|
|
|
|
webRoot = pkgs.writeTextDir "index.html" (builtins.readFile ../proxy/index.html);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
extraConfig = ''
|
|
|
|
root * ${webRoot}
|
|
|
|
rewrite * /index.html
|
|
|
|
file_server
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-06-02 10:25:19 +02:00
|
|
|
};
|
|
|
|
|
2024-03-07 16:35:29 +01:00
|
|
|
security = {
|
|
|
|
sudo-rs = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
sudo.enable = false;
|
|
|
|
|
|
|
|
apparmor = {
|
|
|
|
enable = true;
|
|
|
|
killUnconfinedConfinables = true;
|
|
|
|
};
|
|
|
|
protectKernelImage = true;
|
2023-04-10 23:27:31 +02:00
|
|
|
};
|
|
|
|
|
2023-06-01 16:59:19 +02:00
|
|
|
sops.defaultSopsFile = ./secrets.yaml;
|
|
|
|
sops.secrets = {
|
|
|
|
keycloak-db-password = { };
|
2024-04-16 19:52:25 +02:00
|
|
|
caddy-env = { };
|
2023-06-01 16:59:19 +02:00
|
|
|
};
|
2022-09-07 22:59:08 +02:00
|
|
|
|
2023-04-09 22:01:32 +02:00
|
|
|
system.stateVersion = "23.05";
|
2022-09-07 22:59:08 +02:00
|
|
|
}
|