diff --git a/nixos/hosts/matrix/default.nix b/nixos/hosts/matrix/default.nix index 9de012b..a217389 100644 --- a/nixos/hosts/matrix/default.nix +++ b/nixos/hosts/matrix/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: { +{ config, ... }: { imports = [ ./hardware-configuration.nix ]; deployment.keys = let diff --git a/nixos/hosts/mineshspc/default.nix b/nixos/hosts/mineshspc/default.nix index de06aae..9c4021c 100644 --- a/nixos/hosts/mineshspc/default.nix +++ b/nixos/hosts/mineshspc/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ pkgs, ... }: let dataDir = "/var/lib/mineshspc"; in { imports = [ ./hardware-configuration.nix ]; diff --git a/nixos/hosts/monitoring/default.nix b/nixos/hosts/monitoring/default.nix index 5820689..c1cb6cb 100644 --- a/nixos/hosts/monitoring/default.nix +++ b/nixos/hosts/monitoring/default.nix @@ -17,98 +17,96 @@ in { enable = true; # Make sure that Prometheus is setup for Synapse. - scrapeConfigs = (mapAttrsToList - (k: v: { - job_name = elemAt (splitString "_" k) 0; - static_configs = [{ targets = [ "${toString v.value}:9002" ]; }]; - }) - (filterAttrs (k: v: lib.hasInfix "_server_internal_ip" k) - terraform-outputs)) ++ [{ - job_name = "synapse"; - scrape_interval = "15s"; - metrics_path = "/_synapse/metrics"; - static_configs = [ - { - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9009" ]; - labels = { - instance = matrixDomain; - job = "master"; - index = "1"; - }; - } - { - # Federation sender 1 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9101" ]; - labels = { - instance = matrixDomain; - job = "federation_sender"; - index = "1"; - }; - } - { - # Federation sender 2 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9106" ]; - labels = { - instance = matrixDomain; - job = "federation_sender"; - index = "2"; - }; - } - { - # Federation reader 1 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9102" ]; - labels = { - instance = matrixDomain; - job = "federation_reader"; - index = "1"; - }; - } - { - # Event persister 1 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9103" ]; - labels = { - instance = matrixDomain; - job = "event_persister"; - index = "1"; - }; - } - { - # Event persister 2 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9107" ]; - labels = { - instance = matrixDomain; - job = "event_persister"; - index = "2"; - }; - } - { - # Synchotron 1 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9104" ]; - labels = { - instance = matrixDomain; - job = "synchotron"; - index = "1"; - }; - } - { - # Media repo 1 - targets = - [ "${terraform-outputs.matrix_server_internal_ip.value}:9105" ]; - labels = { - instance = matrixDomain; - job = "media_repo"; - index = "1"; - }; - } - ]; - }]; + scrapeConfigs = (mapAttrsToList (k: v: { + job_name = elemAt (splitString "_" k) 0; + static_configs = [{ targets = [ "${toString v.value}:9002" ]; }]; + }) (filterAttrs (k: v: lib.hasInfix "_server_internal_ip" k) + terraform-outputs)) ++ [{ + job_name = "synapse"; + scrape_interval = "15s"; + metrics_path = "/_synapse/metrics"; + static_configs = [ + { + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9009" ]; + labels = { + instance = matrixDomain; + job = "master"; + index = "1"; + }; + } + { + # Federation sender 1 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9101" ]; + labels = { + instance = matrixDomain; + job = "federation_sender"; + index = "1"; + }; + } + { + # Federation sender 2 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9106" ]; + labels = { + instance = matrixDomain; + job = "federation_sender"; + index = "2"; + }; + } + { + # Federation reader 1 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9102" ]; + labels = { + instance = matrixDomain; + job = "federation_reader"; + index = "1"; + }; + } + { + # Event persister 1 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9103" ]; + labels = { + instance = matrixDomain; + job = "event_persister"; + index = "1"; + }; + } + { + # Event persister 2 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9107" ]; + labels = { + instance = matrixDomain; + job = "event_persister"; + index = "2"; + }; + } + { + # Synchotron 1 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9104" ]; + labels = { + instance = matrixDomain; + job = "synchotron"; + index = "1"; + }; + } + { + # Media repo 1 + targets = + [ "${terraform-outputs.matrix_server_internal_ip.value}:9105" ]; + labels = { + instance = matrixDomain; + job = "media_repo"; + index = "1"; + }; + } + ]; + }]; }; services.healthcheck = { diff --git a/nixos/modules/services/grafana.nix b/nixos/modules/services/grafana.nix index 663bfb4..a2e25d8 100644 --- a/nixos/modules/services/grafana.nix +++ b/nixos/modules/services/grafana.nix @@ -1,10 +1,9 @@ -{ config, lib, options, pkgs, ... }: +{ config, lib, ... }: with lib; let serverName = "grafana.${config.networking.domain}"; cfg = config.services.grafana; -in -mkIf cfg.enable { +in mkIf cfg.enable { services.grafana.settings = { server.domain = serverName; }; services.nginx = { diff --git a/nixos/modules/services/healthcheck.nix b/nixos/modules/services/healthcheck.nix index f520a55..84f1fb6 100644 --- a/nixos/modules/services/healthcheck.nix +++ b/nixos/modules/services/healthcheck.nix @@ -43,8 +43,7 @@ let }; }; }; -in -{ +in { options.services.healthcheck = { enable = mkEnableOption "the healthcheck ping service."; checkId = mkOption { diff --git a/nixos/modules/services/matrix/linkedin-matrix.nix b/nixos/modules/services/matrix/linkedin-matrix.nix index 7a811ca..4732c4b 100644 --- a/nixos/modules/services/matrix/linkedin-matrix.nix +++ b/nixos/modules/services/matrix/linkedin-matrix.nix @@ -35,7 +35,7 @@ let linkedinMatrixAppserviceConfigYaml = yamlFormat.generate "linkedin-matrix-registration.yaml" - linkedinMatrixAppserviceConfig; + linkedinMatrixAppserviceConfig; linkedinMatrixConfig = { homeserver = { @@ -141,8 +141,7 @@ let linkedinMatrixConfigYaml = yamlFormat.generate "linkedin-config.yaml" linkedinMatrixConfig; -in -{ +in { options = { services.linkedin-matrix = { enable = mkEnableOption diff --git a/nixos/modules/services/matrix/matrix-chessbot.nix b/nixos/modules/services/matrix/matrix-chessbot.nix index c4ebd9d..cdf488c 100644 --- a/nixos/modules/services/matrix/matrix-chessbot.nix +++ b/nixos/modules/services/matrix/matrix-chessbot.nix @@ -12,8 +12,7 @@ let format = pkgs.formats.yaml { }; configYaml = format.generate "matrix-chessbot.config.yaml" matrixChessbotConfig; -in -{ +in { options = { services.matrix-chessbot = { enable = mkEnableOption "matrix-chessbot"; diff --git a/nixos/modules/services/matrix/mautrix-discord.nix b/nixos/modules/services/matrix/mautrix-discord.nix index 2ad9cb4..dbe0242 100644 --- a/nixos/modules/services/matrix/mautrix-discord.nix +++ b/nixos/modules/services/matrix/mautrix-discord.nix @@ -32,7 +32,7 @@ let mautrixDiscordAppserviceConfigYaml = yamlFormat.generate "mautrix-discord-registration.yaml" - mautrixDiscordAppserviceConfig; + mautrixDiscordAppserviceConfig; mautrixDiscordConfig = { homeserver = { @@ -110,8 +110,7 @@ let mautrixDiscordConfigYaml = yamlFormat.generate "mautrix-discord-config.yaml" mautrixDiscordConfig; -in -{ +in { options = { services.mautrix-discord = { enable = mkEnableOption "mautrix-discord, a Discord <-> Matrix bridge."; diff --git a/nixos/modules/services/matrix/mautrix-slack.nix b/nixos/modules/services/matrix/mautrix-slack.nix index cbd0f2f..05ea09b 100644 --- a/nixos/modules/services/matrix/mautrix-slack.nix +++ b/nixos/modules/services/matrix/mautrix-slack.nix @@ -34,7 +34,7 @@ let mautrixSlackAppserviceConfigYaml = yamlFormat.generate "mautrix-slack-registration.yaml" - mautrixSlackAppserviceConfig; + mautrixSlackAppserviceConfig; mautrixSlackConfig = { homeserver = { @@ -120,8 +120,7 @@ let mautrixSlackConfigYaml = yamlFormat.generate "mautrix-slack-config.yaml" mautrixSlackConfig; -in -{ +in { options = { services.mautrix-slack = { enable = mkEnableOption "mautrix-slack, a Slack <-> Matrix bridge."; diff --git a/nixos/modules/services/matrix/meetbot.nix b/nixos/modules/services/matrix/meetbot.nix index 22a16bb..908116a 100644 --- a/nixos/modules/services/matrix/meetbot.nix +++ b/nixos/modules/services/matrix/meetbot.nix @@ -27,8 +27,7 @@ let }; format = pkgs.formats.yaml { }; meetbotConfigFile = format.generate "meetbot.config.yaml" meetbotConfig; -in -{ +in { options = { services.meetbot = { enable = mkEnableOption "Meetbot"; diff --git a/nixos/modules/services/matrix/mjolnir.nix b/nixos/modules/services/matrix/mjolnir.nix index 3b6f688..a481492 100644 --- a/nixos/modules/services/matrix/mjolnir.nix +++ b/nixos/modules/services/matrix/mjolnir.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: with lib; let mjolnirCfg = config.services.mjolnir; in mkIf mjolnirCfg.enable { diff --git a/nixos/modules/services/matrix/msclinkbot.nix b/nixos/modules/services/matrix/msclinkbot.nix index 2368607..beae051 100644 --- a/nixos/modules/services/matrix/msclinkbot.nix +++ b/nixos/modules/services/matrix/msclinkbot.nix @@ -27,8 +27,7 @@ let format = pkgs.formats.yaml { }; mscLinkBotConfigFile = format.generate "msclinkbot.config.yaml" mscLinkBotConfig; -in -{ +in { options = { services.msclinkbot = { enable = mkEnableOption "MSC Link Bot"; diff --git a/nixos/modules/services/matrix/standupbot.nix b/nixos/modules/services/matrix/standupbot.nix index ca4bc71..b674154 100644 --- a/nixos/modules/services/matrix/standupbot.nix +++ b/nixos/modules/services/matrix/standupbot.nix @@ -12,8 +12,7 @@ let format = pkgs.formats.json { }; standupbotConfigJson = format.generate "standupbot.config.json" standupbotConfig; -in -{ +in { options = { services.standupbot = { enable = mkEnableOption "standupbot"; diff --git a/nixos/modules/services/matrix/synapse/cleanup-synapse.nix b/nixos/modules/services/matrix/synapse/cleanup-synapse.nix index b9beae2..83e06bf 100644 --- a/nixos/modules/services/matrix/synapse/cleanup-synapse.nix +++ b/nixos/modules/services/matrix/synapse/cleanup-synapse.nix @@ -105,8 +105,7 @@ let systemctl start matrix-synapse.target ''; -in -{ +in { options.services.cleanup-synapse = { environmentFile = mkOption { type = types.path; diff --git a/nixos/modules/services/matrix/synapse/default.nix b/nixos/modules/services/matrix/synapse/default.nix index a55e615..7dff234 100644 --- a/nixos/modules/services/matrix/synapse/default.nix +++ b/nixos/modules/services/matrix/synapse/default.nix @@ -25,7 +25,7 @@ let sharedConfig = recursiveUpdate (import ./shared-config.nix ({ inherit config lib pkgs; })) - cfg.extraConfig; + cfg.extraConfig; sharedConfigFile = yamlFormat.generate "matrix-synapse-config.yaml" sharedConfig; @@ -64,8 +64,7 @@ let bind_address = ""; port = port; }]; - in - newConfig // { worker_listeners = newWorkerListeners; }; + in newConfig // { worker_listeners = newWorkerListeners; }; federationSender1ConfigFile = yamlFormat.generate "federation-sender-1.yaml" (mkSynapseWorkerConfig 9101 { @@ -144,8 +143,7 @@ let resources = [{ names = [ "media" ]; }]; }]; }); -in -{ +in { imports = [ ./cleanup-synapse.nix ]; options = { diff --git a/nixos/modules/services/matrix/synapse/shared-config.nix b/nixos/modules/services/matrix/synapse/shared-config.nix index 63b8482..31c9694 100644 --- a/nixos/modules/services/matrix/synapse/shared-config.nix +++ b/nixos/modules/services/matrix/synapse/shared-config.nix @@ -30,8 +30,7 @@ let }; disable_existing_loggers = false; }; -in -{ +in { # Experimental features experimental_features = { # Enable support for the suppressing edit notifications. diff --git a/nixos/modules/services/postgresql.nix b/nixos/modules/services/postgresql.nix index 3eacaf5..73f74e2 100644 --- a/nixos/modules/services/postgresql.nix +++ b/nixos/modules/services/postgresql.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: with lib; mkMerge [ (mkIf config.services.postgresql.enable { diff --git a/nixos/modules/services/prometheus.nix b/nixos/modules/services/prometheus.nix index a1f6468..7f1fb60 100644 --- a/nixos/modules/services/prometheus.nix +++ b/nixos/modules/services/prometheus.nix @@ -1,4 +1,3 @@ -{ config, lib, ... }: let promPort = 9002; in { config = { diff --git a/nixos/modules/services/restic.nix b/nixos/modules/services/restic.nix index 473b05e..4f061ce 100644 --- a/nixos/modules/services/restic.nix +++ b/nixos/modules/services/restic.nix @@ -82,8 +82,7 @@ let paths = mapAttrsToList (n: { path, ... }: path) backups; script = resticBackupScript paths (exclude ++ [ ".restic-backup-restored" ]); - in - { + in { description = "Backup ${concatStringsSep ", " paths} to ${resticRepository}"; environment = resticEnvironment; @@ -119,48 +118,45 @@ let ${resticCmd} snapshots || ${resticCmd} init ''; }; -in -{ - options = - let - backupDirOpts = { name, ... }: { - options = { - path = mkOption { - type = types.str; - description = "The path to backup using restic."; - }; +in { + options = let + backupDirOpts = { name, ... }: { + options = { + path = mkOption { + type = types.str; + description = "The path to backup using restic."; }; }; - in - { - services.backup = { - backups = mkOption { - type = with types; attrsOf (submodule backupDirOpts); - description = "List of backup configurations."; - default = { }; - }; + }; + in { + services.backup = { + backups = mkOption { + type = with types; attrsOf (submodule backupDirOpts); + description = "List of backup configurations."; + default = { }; + }; - exclude = mkOption { - type = with types; listOf str; - description = '' - List of patterns to exclude. `.restic-backup-restored` files are - already ignored. - ''; - default = [ ]; - example = [ ".git/*" ]; - }; + exclude = mkOption { + type = with types; listOf str; + description = '' + List of patterns to exclude. `.restic-backup-restored` files are + already ignored. + ''; + default = [ ]; + example = [ ".git/*" ]; + }; - healthcheckId = mkOption { - type = types.str; - description = "Healthcheck ID for this server's backup job."; - }; + healthcheckId = mkOption { + type = types.str; + description = "Healthcheck ID for this server's backup job."; + }; - healthcheckPruneId = mkOption { - type = types.str; - description = "Healthcheck ID for this server's prune job."; - }; + healthcheckPruneId = mkOption { + type = types.str; + description = "Healthcheck ID for this server's prune job."; }; }; + }; config = mkIf (cfg.backups != { }) { systemd.services = { diff --git a/secrets/matrix/appservices/linkedin-matrix.nix b/secrets/matrix/appservices/linkedin-matrix.nix index 79b35f8..a7ad797 100644 Binary files a/secrets/matrix/appservices/linkedin-matrix.nix and b/secrets/matrix/appservices/linkedin-matrix.nix differ diff --git a/secrets/matrix/appservices/mautrix-discord.nix b/secrets/matrix/appservices/mautrix-discord.nix index 1bf6a5f..888294a 100644 Binary files a/secrets/matrix/appservices/mautrix-discord.nix and b/secrets/matrix/appservices/mautrix-discord.nix differ diff --git a/secrets/matrix/appservices/mautrix-signal.nix b/secrets/matrix/appservices/mautrix-signal.nix index 26720dc..f4b2076 100644 Binary files a/secrets/matrix/appservices/mautrix-signal.nix and b/secrets/matrix/appservices/mautrix-signal.nix differ diff --git a/secrets/matrix/appservices/mautrix-slack.nix b/secrets/matrix/appservices/mautrix-slack.nix index 7f5a34e..47ae5c9 100644 Binary files a/secrets/matrix/appservices/mautrix-slack.nix and b/secrets/matrix/appservices/mautrix-slack.nix differ