From 9529791832533f774fbc85607b14cb81378f57d4 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 29 Jan 2024 10:14:43 -0700 Subject: [PATCH] treewide: format everything and remove unused bindings Signed-off-by: Sumner Evans --- nixos/hosts/matrix/default.nix | 2 +- nixos/hosts/mineshspc/default.nix | 2 +- nixos/hosts/monitoring/default.nix | 182 +++++++++--------- nixos/modules/services/grafana.nix | 5 +- nixos/modules/services/healthcheck.nix | 3 +- .../services/matrix/linkedin-matrix.nix | 5 +- .../services/matrix/matrix-chessbot.nix | 3 +- .../services/matrix/mautrix-discord.nix | 5 +- .../modules/services/matrix/mautrix-slack.nix | 5 +- nixos/modules/services/matrix/meetbot.nix | 3 +- nixos/modules/services/matrix/mjolnir.nix | 2 +- nixos/modules/services/matrix/msclinkbot.nix | 3 +- nixos/modules/services/matrix/standupbot.nix | 3 +- .../matrix/synapse/cleanup-synapse.nix | 3 +- .../services/matrix/synapse/default.nix | 8 +- .../services/matrix/synapse/shared-config.nix | 3 +- nixos/modules/services/postgresql.nix | 2 +- nixos/modules/services/prometheus.nix | 1 - nixos/modules/services/restic.nix | 70 ++++--- .../matrix/appservices/linkedin-matrix.nix | Bin 274 -> 282 bytes .../matrix/appservices/mautrix-discord.nix | Bin 274 -> 282 bytes secrets/matrix/appservices/mautrix-signal.nix | Bin 274 -> 282 bytes secrets/matrix/appservices/mautrix-slack.nix | Bin 274 -> 282 bytes 23 files changed, 145 insertions(+), 165 deletions(-) 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 79b35f841f7560b94d13d6183faaf777c38c0411..a7ad7972c30277478960fa11e3cb790dcb34f3ed 100644 GIT binary patch literal 282 zcmV+#0pg(Oz8fsQUxona8v1cM~Oq;*L9pbFNqt~;(LaS^=Vu_xT zOI=FZ)Jbc$qVbvL#P*#(pe~y~hMFeK)S_eve$<4bopeuYuPrY|}I?&tNgaD8M1Hq)$ literal 274 zcmV+t0qy<(M@dveQdv+`0J?-7(Lpu@?3y*hFFwe$KPO<3<7CAfP`<3v9i7lSslD)y zMFw{0B_OlyK$|TH{b3G zfQt^Q1i+n>Cg%uk5(QotFFP(w1(?LVy8`|F_X(Kmx1<_{994}Zs%M`d$tb+sasM0U z!rbWK8i}NVvSHjhn08|D{F*l*7MZQscHLRVyLAjb&O1|#L&===1#bQ;qCQISN>fnE zvp-x;Hj~rbxkPmnu}-RTghMXZpMU3N9lOVS>ttM>e-XI^+Yj)%fpQ1H3Gnzng9cOf Y8pw2C6w!qG$e(T|B>r*1^NS4EB8DP}JOBUy diff --git a/secrets/matrix/appservices/mautrix-discord.nix b/secrets/matrix/appservices/mautrix-discord.nix index 1bf6a5f8af41a26b4d0d56505e9ec0b2b72bcf97..888294a7bf0dc2d67c75298db42e43c542c408b8 100644 GIT binary patch literal 282 zcmV+#0p#TdLf|_&sIVYFA)(|fKf&j gjhb8NTMrJi{)1wHOX4@%upk&yeW4y)qEHFltn)d68UO$Q literal 274 zcmV+t0qy<(M@dveQdv+`0QQ<4ml6#M+Q)%5CT4e^YR9ZagJ!sGWpgNvqO*4Q%aWM~8kB{e~z%LeMz9cU%ij$w@iDJO=UUTOtd^pK6Yh)|`;>zpPg3-|<83?M>_+K?2NA=W*hqia7+7u6fE}@oC7Uw)ONHbY#LtgHi Y81~>}hQj-$%#em1mN$5Ds-J^mOW!Syq5uE@ diff --git a/secrets/matrix/appservices/mautrix-signal.nix b/secrets/matrix/appservices/mautrix-signal.nix index 26720dcffa40443e184d5f2ce3dd739207626de2..f4b2076333902e2271650878c51bf38c6c322ab1 100644 GIT binary patch literal 282 zcmV+#0pQN5Bki1oS}J)m`=$^tGm&juRt(HKl` z!4Yx7e+*I*^Yjjw;e5A{0Dz*FkFwRtb}>q)RIhIe?p^{n%d~$$`^x(F3Cpds#cdsR z>Qhn+V;EVke4A{nd9t~|ZZf#_H5_z5bJ#YLY(>pxUCf`hqcfX1K0b3bzok)AZjzsF z<}-zJrSwhaG9ovt<=gM-j-zmCbUAABhE38lorZ-q)fb6bhOKh* zB&$l~*!-Q4&POTI?t$|45Ws#Q8bd{AlBAn{v8Tnu3S{nO!K8XR^;%GMOh5GacxFRU gNy*=Np660e42=~ZxoItpbA1ojmQ#eEsr&K_La(ojmjD0& literal 274 zcmV+t0qy<(M@dveQdv+`0742K%+mSARiUjwHSWw4peXx&2>vSL=gEf&PfY#^<0+$_^SO%@A|wj zP7-q7ad6W(5&BVnvvm=S_2D8I4qK}kI&9x(SsMtCbuyaD;lj+aO$Uj zH@uF@5&XZn^Y(pHEhEe41(Cr7f?e2kBcbwOA)B^W#?}WIhS(S!Hl`9J{1AQxb2}tp*8(lBZK>3u1B>(^b diff --git a/secrets/matrix/appservices/mautrix-slack.nix b/secrets/matrix/appservices/mautrix-slack.nix index 7f5a34e38b5b55df3361dba62cbd29fe02250460..47ae5c983d35ddbf7a0540a5c7804e7733c6e639 100644 GIT binary patch literal 282 zcmV+#0pu!f6i4M4YNxXM1|XpdeV1Wu2f0!tP$jHy1PQKq1c0g|Hz7YVsBb*513I zBK`Bc-4R4WP3fIs_Da?Y+UF|$(gG@o3NI^HH$7E0WuY1^K*}tKAS7%WYP2$Xj$2rF gr`=fUV2wk4=9W}KFKLp}Uhyx&7DqA)+I8&v(N(I8h5!Hn literal 274 zcmV+t0qy<(M@dveQdv+`0Q4=7^oibM91GtH$nUNJtCCG@a|2&#MRq|{=nlaG)dQ7W zXj%v;k$g%Dwmvf??ui!Ey&`bk>FkW|ZnS^;Ak%bT$7P2q?V*&FF(O1JZ6#K2yM&2q zAbSqhwqv}p&p$OH{^=$ykl(Pc^qV+AF{xM)Biu}m!H&RNV?gx2PnyW9tm6$3s2a*M z#Bp}&gixLLU&tFN+c<0#^5kjB(EwBTEL7&(@wu&@qMm34ki)0Pcbi(J|4N}13qUI7 z%Kq~X>td<<(^t9MUoxQUk#(35Og}2(*Tt1N0P)tpiJZWUeUg@4z}V9`wrX-VO;g1z Yv2(HlQktEN#{`Z2GBjV3a}D=_T`fe2ga7~l