diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2026-01-25 14:13:52 +0100 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2026-01-25 14:13:52 +0100 |
| commit | 77b23ce8e86b24e6aed30fadced85d6a2d7dd0a7 (patch) | |
| tree | 4b22f93535f03f4bf93f181533c4b3f507ee88ca /hosts/omega-relay | |
| parent | 645e86a443d3f74cc8f9c95cb433cbefed5263cb (diff) | |
Nix fmt
Diffstat (limited to '')
| -rw-r--r-- | hosts/omega-relay/default.nix | 141 | ||||
| -rw-r--r-- | hosts/omega-relay/disko.nix | 79 | ||||
| -rw-r--r-- | hosts/omega-relay/firewall.nix | 9 | ||||
| -rw-r--r-- | hosts/omega-relay/vm.nix | 34 |
4 files changed, 141 insertions, 122 deletions
diff --git a/hosts/omega-relay/default.nix b/hosts/omega-relay/default.nix index 4154e2c..17af116 100644 --- a/hosts/omega-relay/default.nix +++ b/hosts/omega-relay/default.nix @@ -1,22 +1,27 @@ -{ pkgs, lib, config, ...}: { +{ + pkgs, + lib, + config, + ... +}: +{ imports = [ - ./firewall.nix - ./disko.nix - ./vm.nix - ../../services/mysql.nix - ../../services/email.nix - ../../services/vaultwarden.nix - ../../services/uptimekuma.nix - ../../services/freshrss.nix - ../../services/wakapi.nix + ./firewall.nix + ./disko.nix + ./vm.nix + ../../services/mysql.nix + ../../services/email.nix + ../../services/vaultwarden.nix + ../../services/uptimekuma.nix + ../../services/freshrss.nix + ../../services/wakapi.nix ]; - addons = { - desktop.hyprland.enable = lib.mkForce false; - # desktop.cosmic.enable = lib.mkForce false; - desktop.xfce.enable = lib.mkForce false; - + desktop.hyprland.enable = lib.mkForce false; + # desktop.cosmic.enable = lib.mkForce false; + desktop.xfce.enable = lib.mkForce false; + gpg.enable = true; }; boot.loader.grub = { @@ -27,66 +32,73 @@ environment.systemPackages = with pkgs; [ lynx chawan - ]; + ]; - wilkuu.services = let - isVM = config.addons.virtualisation.isTestVM; - in { - stalwart = { - enable = true; - domain = if isVM then "mail.omega-relay.local" else "mail.wilkuu.xyz"; - doACME = !isVM; - }; + wilkuu.services = + let + isVM = config.addons.virtualisation.isTestVM; + in + { + stalwart = { + enable = true; + domain = if isVM then "mail.omega-relay.local" else "mail.wilkuu.xyz"; + doACME = !isVM; + }; - vaultwarden = { - enable = true; - signupWhitelist = ["wilkuu.xyz" "omega-relay.local"]; - backupDir = "/srv/data/vaultwarden"; - domain = if isVM then "vaultwarden.omega-relay.local" else "vaultwarden.wilkuu.xyz"; - doACME = !isVM; - }; - uptimekuma = { - enable = true; - domain = if isVM then "uptime.omega-relay.local" else "uptime.wilkuu.xyz"; - dataDir = "/srv/data/uptimekuma"; - doACME = !isVM; - }; - freshrss = { - enable = true; - domain = if isVM then "rss.omega-relay.local" else "rss.wilkuu.xyz"; - doACME = !isVM; - }; - wakapi = { - enable = true; - domain = if isVM then "wakapi.omega-relay.local" else "wakapi.wilkuu.xyz"; - doACME = !isVM; + vaultwarden = { + enable = true; + signupWhitelist = [ + "wilkuu.xyz" + "omega-relay.local" + ]; + backupDir = "/srv/data/vaultwarden"; + domain = if isVM then "vaultwarden.omega-relay.local" else "vaultwarden.wilkuu.xyz"; + doACME = !isVM; + }; + uptimekuma = { + enable = true; + domain = if isVM then "uptime.omega-relay.local" else "uptime.wilkuu.xyz"; + dataDir = "/srv/data/uptimekuma"; + doACME = !isVM; + }; + freshrss = { + enable = true; + domain = if isVM then "rss.omega-relay.local" else "rss.wilkuu.xyz"; + doACME = !isVM; + }; + wakapi = { + enable = true; + domain = if isVM then "wakapi.omega-relay.local" else "wakapi.wilkuu.xyz"; + doACME = !isVM; + }; }; - }; # TODO: Make a nginx module security.acme = lib.mkIf (!config.addons.virtualisation.isTestVM) { acceptTerms = true; defaults.email = "jakub@wilkuu.xyz"; }; - services.nginx = let - isVM = config.addons.virtualisation.isTestVM; - domain = if isVM then "omega-relay.local" else "wilkuu.xyz"; - in { - enable = true; - virtualHosts."${domain}" = { - enableACME = !isVM; - addSSL = !isVM; - locations."/" = { - root = "/srv/www/wilkuu.xyz/"; - index = "index.html"; - tryFiles = "$uri $uri/ =404"; - }; + services.nginx = + let + isVM = config.addons.virtualisation.isTestVM; + domain = if isVM then "omega-relay.local" else "wilkuu.xyz"; + in + { + enable = true; + virtualHosts."${domain}" = { + enableACME = !isVM; + addSSL = !isVM; + locations."/" = { + root = "/srv/www/wilkuu.xyz/"; + index = "index.html"; + tryFiles = "$uri $uri/ =404"; + }; + }; }; - }; - networking.hostName = "omega-relay"; + networking.hostName = "omega-relay"; services.resolved = { - enable = true; + enable = true; dnsovertls = "opportunistic"; }; @@ -104,7 +116,4 @@ }; }; - - - } diff --git a/hosts/omega-relay/disko.nix b/hosts/omega-relay/disko.nix index 9694e2a..307f6de 100644 --- a/hosts/omega-relay/disko.nix +++ b/hosts/omega-relay/disko.nix @@ -1,52 +1,53 @@ -{pkgs, config, lib, ...}: { +{ config, lib, ... }: +{ config = lib.mkIf (!config.addons.virtualisation.isTestVM) ({ - services.btrfs.autoScrub = { - enable = true; - interval = "weekly"; - }; + services.btrfs.autoScrub = { + enable = true; + interval = "weekly"; + }; - boot.loader.grub.device = "/dev/sda"; - # Workaround - boot.loader.grub.devices = lib.mkForce ["/dev/sda"]; - boot.loader.efi.canTouchEfiVariables = false; + boot.loader.grub.device = "/dev/sda"; + # Workaround + boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; + boot.loader.efi.canTouchEfiVariables = false; - # TODO: Mount points + # TODO: Mount points - # Disko for formatting - disko.devices = { - disk = { - main-disk = { - device = "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - BOOT = { - type = "EF02"; - size = "1M"; - }; - ESP = { - type = "EF00"; - size = "128M"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; + # Disko for formatting + disko.devices = { + disk = { + main-disk = { + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + BOOT = { + type = "EF02"; + size = "1M"; + }; + ESP = { + type = "EF00"; + size = "128M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "btrfs"; - mountpoint = "/"; - }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "btrfs"; + mountpoint = "/"; }; }; }; }; }; }; + }; }); } diff --git a/hosts/omega-relay/firewall.nix b/hosts/omega-relay/firewall.nix index 6311337..360e7da 100644 --- a/hosts/omega-relay/firewall.nix +++ b/hosts/omega-relay/firewall.nix @@ -1,7 +1,14 @@ { ... }: let baseTCP = [ - 20 22 25 80 143 443 993 465 + 20 + 22 + 25 + 80 + 143 + 443 + 993 + 465 ]; baseUDP = [ 16555 # Wireguard diff --git a/hosts/omega-relay/vm.nix b/hosts/omega-relay/vm.nix index 06310f9..6672949 100644 --- a/hosts/omega-relay/vm.nix +++ b/hosts/omega-relay/vm.nix @@ -1,20 +1,22 @@ -{lib, config,...}: let - forward = proto: gport: hport: { - from = "host"; - proto = proto; - host = { - port = hport; +{ ... }: +let + forward = proto: gport: hport: { + from = "host"; + proto = proto; + host = { + port = hport; # address = "10.0.69.1"; }; - guest = { - port = gport; + guest = { + port = gport; # address = "10.0.69.2"; }; }; -in { - # TODO: Make this into a more global module. +in +{ + # TODO: Make this into a more global module. virtualisation.vmVariant = { - addons.virtualisation.isTestVM = true; + addons.virtualisation.isTestVM = true; addons.virtualisation.guest = true; fileSystems."/" = { device = "none"; @@ -25,14 +27,14 @@ in { "mode=755" ]; }; - virtualisation = { + virtualisation = { forwardPorts = [ - (forward "tcp" 80 9080) + (forward "tcp" 80 9080) (forward "tcp" 443 9443) (forward "tcp" 143 9143) - (forward "tcp" 25 9025) - (forward "tcp" 22 9022) - ]; + (forward "tcp" 25 9025) + (forward "tcp" 22 9022) + ]; memorySize = 2048; # Use 2048MiB memory. cores = 3; graphics = false; |
