summaryrefslogtreecommitdiff
path: root/configurations/manwe/default.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-12 22:53:53 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-12 22:53:53 +0300
commit61b94f0dd06cac0f7dcd38cce80f2a7ab8376098 (patch)
treeb703a9fe11eae6c4cae4e4682f02caf0caa171d0 /configurations/manwe/default.nix
2022-08-12
Diffstat (limited to 'configurations/manwe/default.nix')
-rw-r--r--configurations/manwe/default.nix171
1 files changed, 171 insertions, 0 deletions
diff --git a/configurations/manwe/default.nix b/configurations/manwe/default.nix
new file mode 100644
index 0000000..50acacd
--- /dev/null
+++ b/configurations/manwe/default.nix
@@ -0,0 +1,171 @@
+{
+ config,
+ inputs,
+ lib,
+ this,
+ ...
+}:
+with lib; {
+ imports = [
+ ./mailserver.nix
+ ./webserver.nix
+ ];
+
+ secrets.wireguard-private-key-manwe.file = "${inputs.self}/secrets/wireguard-private-key-manwe";
+
+ nixfiles.modules = {
+ nsd = {
+ enable = true;
+ fqdn = "ns1.${config.networking.domain}";
+ };
+ unbound.enable = true;
+
+ wireguard = {
+ privateKeyFile = config.secrets.wireguard-private-key-manwe.path;
+ server.enable = true;
+ };
+
+ acme.enable = true;
+
+ monitoring.enable = true;
+
+ gotify.enable = true;
+ matrix.dendrite = {
+ enable = true;
+ domain = my.domain.azahi;
+ };
+ soju = {
+ enable = true;
+ domain = my.domain.azahi;
+ };
+ };
+
+ services.prometheus = {
+ # TODO Make this generic.
+ scrapeConfigs = with my.configurations;
+ with config.services.prometheus.exporters; [
+ {
+ job_name = "endlessh-go";
+ static_configs = [
+ {
+ targets = with config.nixfiles.modules.endlessh-go; [
+ "${manwe.hostname}:${toString prometheusPort}"
+ "${varda.hostname}:${toString prometheusPort}"
+ "${yavanna.hostname}:${toString prometheusPort}"
+ ];
+ }
+ ];
+ }
+ {
+ job_name = "nginx";
+ static_configs = [
+ {
+ targets = with nginx; [
+ "${manwe.hostname}:${toString port}"
+ "${varda.hostname}:${toString port}"
+ "${yavanna.hostname}:${toString port}"
+ ];
+ }
+ ];
+ }
+ {
+ job_name = "node";
+ static_configs = [
+ {
+ targets = with node; [
+ "${manwe.hostname}:${toString port}"
+ "${varda.hostname}:${toString port}"
+ "${yavanna.hostname}:${toString port}"
+ ];
+ }
+ ];
+ }
+ {
+ job_name = "postgres";
+ static_configs = [
+ {
+ targets = with postgres; [
+ "${manwe.hostname}:${toString port}"
+ "${varda.hostname}:${toString port}"
+ ];
+ }
+ ];
+ }
+ {
+ job_name = "unbound";
+ static_configs = [
+ {
+ targets = with unbound; ["${manwe.hostname}:${toString port}"];
+ }
+ ];
+ }
+ # {
+ # job_name = "wireguard";
+ # static_configs = [{
+ # targets = with wireguard; [
+ # "${manwe.hostname}:${toString port}"
+ # ];
+ # }];
+ # }
+ ];
+ };
+
+ networking = let
+ interface = "eth0";
+ in {
+ interfaces.${interface} = {
+ ipv4.addresses = [
+ {
+ inherit (this.ipv4) address;
+ prefixLength = 22;
+ }
+ ];
+
+ ipv6.addresses = [
+ {
+ inherit (this.ipv6) address;
+ prefixLength = 64;
+ }
+ ];
+ };
+
+ defaultGateway = {
+ inherit interface;
+ address = this.ipv4.gateway;
+ };
+
+ defaultGateway6 = {
+ inherit interface;
+ address = this.ipv6.gateway;
+ };
+
+ nat.externalInterface = interface;
+ };
+
+ boot = {
+ loader.grub = {
+ enable = true;
+ device = "/dev/sda";
+ };
+
+ initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
+ };
+
+ fileSystems = {
+ "/boot" = {
+ device = "/dev/sda1";
+ fsType = "xfs";
+ options = ["noatime"];
+ };
+
+ "/" = {
+ device = "/dev/sda2";
+ fsType = "xfs";
+ options = ["noatime"];
+ };
+ };
+
+ swapDevices = [{device = "/dev/sda3";}];
+
+ system.stateVersion = "22.05";
+}