depot/hosts/VEGAS/system.nix

109 lines
2.6 KiB
Nix
Raw Normal View History

2023-08-31 01:55:45 +03:00
{ config, depot, ... }:
{
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
2023-02-24 16:16:15 +02:00
depot.inputs.agenix.nixosModules.age
depot.inputs.mms.module
# Services
2021-12-07 20:51:25 +02:00
./services/api
./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:22:48 +03:00
./services/mail
2022-03-25 22:32:30 +02:00
./services/minecraft
2023-03-04 21:50:51 +02:00
./services/reflex
2021-10-16 21:24:30 +03:00
./services/sso
2021-10-16 21:00:53 +03:00
./services/websites
./services/wireguard-server
depot.nixosModules.hyprspace
depot.nixosModules.nix-builder
depot.nixosModules.backboneBase
];
# TODO: fix users
# ++ (import ../../users "server").groups.admin
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
networking.hostName = "VEGAS";
2023-08-31 01:55:45 +03:00
networking.domain = "backbone.${depot.lib.meta.domain}";
time.timeZone = "Europe/Helsinki";
networking.useDHCP = false;
networking.interfaces.enp0s31f6.useDHCP = true;
i18n.defaultLocale = "en_US.UTF-8";
services.openssh.enable = true;
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"
];
2023-02-24 16:16:15 +02:00
mkRules = ipt: ranges: map (x: "${ipt} -I nixos-fw 1 -d ${x} -o ${depot.reflection.interfaces.primary.link} -j DROP") ranges;
rules4 = mkRules "iptables" privateIp4Ranges;
rules6 = mkRules "ip6tables" privateIp6Ranges;
in builtins.concatStringsSep "\n" (rules4 ++ rules6);
};
2023-09-03 23:40:16 +03:00
zramSwap.enable = true;
zramSwap.algorithm = "zstd";
system.stateVersion = "21.05";
2023-06-06 17:16:16 +03:00
services.openssh.settings.PasswordAuthentication = false;
2022-05-28 22:53:15 +03:00
containers.soda = {
2023-02-24 16:16:15 +02:00
path = depot.nixosConfigurations.soda.config.system.build.toplevel;
2022-05-28 22:53:15 +03:00
privateNetwork = true;
hostBridge = "vmdefault";
2023-08-31 01:55:45 +03:00
localAddress = "${depot.hours.soda.interfaces.primary.addr}/24";
2022-05-28 22:53:15 +03:00
autoStart = true;
bindMounts.sodaDir = {
hostPath = "/srv/storage/www/soda";
mountPoint = "/soda";
isReadOnly = false;
};
};
systemd.services."container@soda".after = [ "libvirtd.service" "sys-devices-virtual-net-vmdefault.device" ];
}