2022-10-17 15:54:48 +03:00
|
|
|
{ aspect, config, hosts, inputs, tools, ... }:
|
2021-10-16 19:34:11 +03:00
|
|
|
|
|
|
|
{
|
|
|
|
imports =
|
|
|
|
[
|
|
|
|
# Hardware
|
|
|
|
./hardware-configuration.nix
|
2021-10-16 23:24:00 +03:00
|
|
|
|
|
|
|
# Plumbing
|
|
|
|
./modules/database
|
2021-10-16 20:39:49 +03:00
|
|
|
./modules/oauth2-proxy
|
2021-10-16 20:29:15 +03:00
|
|
|
./modules/redis
|
2021-10-16 20:29:29 +03:00
|
|
|
./modules/virtualisation
|
2021-10-16 21:17:23 +03:00
|
|
|
inputs.agenix.nixosModules.age
|
2022-03-25 22:32:30 +02:00
|
|
|
inputs.mms.module
|
2021-10-16 21:18:53 +03:00
|
|
|
|
|
|
|
# Services
|
2021-12-07 20:51:25 +02:00
|
|
|
./services/api
|
2023-01-21 23:46:34 +02:00
|
|
|
./services/ark-hosting
|
2021-10-16 21:18:53 +03:00
|
|
|
./services/backbone-routing
|
2021-10-16 20:34:42 +03:00
|
|
|
./services/bitwarden
|
2023-03-04 21:51:26 +02:00
|
|
|
./services/cdn-shield
|
2021-10-16 20:34:13 +03:00
|
|
|
./services/fbi
|
2022-01-31 00:15:08 +02:00
|
|
|
./services/gitlab
|
2021-10-16 20:36:32 +03:00
|
|
|
./services/jokes
|
2021-10-16 21:23:55 +03:00
|
|
|
./services/nextcloud
|
2021-10-16 21:22:48 +03:00
|
|
|
./services/mail
|
2021-10-17 01:11:18 +03:00
|
|
|
./services/matrix
|
2023-03-04 21:49:58 +02:00
|
|
|
./services/meet
|
2022-03-25 22:32:30 +02:00
|
|
|
./services/minecraft
|
2022-05-15 01:34:09 +03:00
|
|
|
./services/monitoring
|
2021-10-16 21:24:13 +03:00
|
|
|
./services/nix/binary-cache.nix
|
2021-10-16 21:24:25 +03:00
|
|
|
./services/nix/nar-serve.nix
|
2021-10-16 20:59:06 +03:00
|
|
|
./services/object-storage
|
2023-03-04 21:50:51 +02:00
|
|
|
./services/reflex
|
2022-05-25 12:11:10 +03:00
|
|
|
./services/searxng
|
2021-10-16 21:24:30 +03:00
|
|
|
./services/sso
|
2022-04-27 23:08:49 +03:00
|
|
|
./services/uptime-kuma
|
2021-11-26 22:49:21 +02:00
|
|
|
./services/vault
|
2021-10-16 21:22:58 +03:00
|
|
|
./services/warehouse
|
2021-10-16 21:00:53 +03:00
|
|
|
./services/websites
|
2022-04-29 00:47:23 +03:00
|
|
|
./services/wireguard-server
|
2022-02-05 20:09:02 +02:00
|
|
|
aspect.modules.hyprspace
|
2022-05-17 00:13:57 +03:00
|
|
|
aspect.modules.nix-builder
|
2021-10-16 19:34:11 +03:00
|
|
|
]
|
|
|
|
# TODO: fix users
|
|
|
|
# ++ (import ../../users "server").groups.admin
|
|
|
|
++ aspect.sets.backbone;
|
|
|
|
|
|
|
|
# Use the GRUB 2 boot loader.
|
|
|
|
boot.loader.grub.enable = true;
|
|
|
|
boot.loader.grub.version = 2;
|
|
|
|
boot.loader.grub.device = "/dev/sda";
|
|
|
|
|
|
|
|
|
|
|
|
networking.hostName = "VEGAS";
|
|
|
|
networking.domain = "backbone.${tools.meta.domain}";
|
|
|
|
|
|
|
|
time.timeZone = "Europe/Helsinki";
|
|
|
|
|
|
|
|
networking.useDHCP = false;
|
|
|
|
networking.interfaces.enp0s31f6.useDHCP = true;
|
|
|
|
|
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
|
|
|
|
services.openssh.enable = true;
|
|
|
|
|
2022-11-17 17:55:21 +02:00
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
|
|
|
extraCommands = let
|
|
|
|
privateIp4Ranges = [
|
|
|
|
"10.0.0.0/8"
|
|
|
|
"100.64.0.0/10"
|
|
|
|
"169.254.0.0/16"
|
|
|
|
"172.16.0.0/12"
|
|
|
|
"192.0.0.0/24"
|
|
|
|
"192.0.2.0/24"
|
|
|
|
"192.168.0.0/16"
|
|
|
|
"198.18.0.0/15"
|
|
|
|
"198.51.100.0/24"
|
|
|
|
"203.0.113.0/24"
|
|
|
|
"240.0.0.0/4"
|
|
|
|
];
|
|
|
|
|
|
|
|
privateIp6Ranges = [
|
|
|
|
"100::/64"
|
|
|
|
"2001:2::/48"
|
|
|
|
"2001:db8::/32"
|
|
|
|
"fc00::/7"
|
|
|
|
"fe80::/10"
|
|
|
|
];
|
|
|
|
|
|
|
|
mkRules = ipt: ranges: map (x: "${ipt} -I nixos-fw 1 -d ${x} -o ${hosts.${config.networking.hostName}.interfaces.primary.link} -j DROP") ranges;
|
|
|
|
|
|
|
|
rules4 = mkRules "iptables" privateIp4Ranges;
|
|
|
|
|
|
|
|
rules6 = mkRules "ip6tables" privateIp6Ranges;
|
|
|
|
in builtins.concatStringsSep "\n" (rules4 ++ rules6);
|
|
|
|
};
|
2021-10-16 19:34:11 +03:00
|
|
|
|
|
|
|
system.stateVersion = "21.05";
|
|
|
|
services.openssh.passwordAuthentication = false;
|
2022-05-28 22:53:15 +03:00
|
|
|
|
|
|
|
containers.soda = {
|
|
|
|
path = inputs.self.nixosConfigurations.soda.config.system.build.toplevel;
|
|
|
|
privateNetwork = true;
|
|
|
|
hostBridge = "vmdefault";
|
|
|
|
localAddress = "${hosts.soda.interfaces.primary.addr}/24";
|
|
|
|
autoStart = true;
|
|
|
|
bindMounts.sodaDir = {
|
|
|
|
hostPath = "/srv/storage/www/soda";
|
|
|
|
mountPoint = "/soda";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2022-06-18 20:48:22 +03:00
|
|
|
systemd.services."container@soda".after = [ "libvirtd.service" "sys-devices-virtual-net-vmdefault.device" ];
|
2021-10-16 19:34:11 +03:00
|
|
|
}
|