Skip to content

Commit

Permalink
treewide: format everything and remove unused bindings
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Jan 29, 2024
1 parent 8996fa8 commit 9529791
Show file tree
Hide file tree
Showing 23 changed files with 145 additions and 165 deletions.
2 changes: 1 addition & 1 deletion nixos/hosts/matrix/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: {
{ config, ... }: {
imports = [ ./hardware-configuration.nix ];

deployment.keys = let
Expand Down
2 changes: 1 addition & 1 deletion nixos/hosts/mineshspc/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ pkgs, ... }:
let dataDir = "/var/lib/mineshspc";
in {
imports = [ ./hardware-configuration.nix ];
Expand Down
182 changes: 90 additions & 92 deletions nixos/hosts/monitoring/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 2 additions & 3 deletions nixos/modules/services/grafana.nix
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/healthcheck.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ let
};
};
};
in
{
in {
options.services.healthcheck = {
enable = mkEnableOption "the healthcheck ping service.";
checkId = mkOption {
Expand Down
5 changes: 2 additions & 3 deletions nixos/modules/services/matrix/linkedin-matrix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let

linkedinMatrixAppserviceConfigYaml =
yamlFormat.generate "linkedin-matrix-registration.yaml"
linkedinMatrixAppserviceConfig;
linkedinMatrixAppserviceConfig;

linkedinMatrixConfig = {
homeserver = {
Expand Down Expand Up @@ -141,8 +141,7 @@ let

linkedinMatrixConfigYaml =
yamlFormat.generate "linkedin-config.yaml" linkedinMatrixConfig;
in
{
in {
options = {
services.linkedin-matrix = {
enable = mkEnableOption
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/matrix/matrix-chessbot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 2 additions & 3 deletions nixos/modules/services/matrix/mautrix-discord.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let

mautrixDiscordAppserviceConfigYaml =
yamlFormat.generate "mautrix-discord-registration.yaml"
mautrixDiscordAppserviceConfig;
mautrixDiscordAppserviceConfig;

mautrixDiscordConfig = {
homeserver = {
Expand Down Expand Up @@ -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.";
Expand Down
5 changes: 2 additions & 3 deletions nixos/modules/services/matrix/mautrix-slack.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let

mautrixSlackAppserviceConfigYaml =
yamlFormat.generate "mautrix-slack-registration.yaml"
mautrixSlackAppserviceConfig;
mautrixSlackAppserviceConfig;

mautrixSlackConfig = {
homeserver = {
Expand Down Expand Up @@ -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.";
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/matrix/meetbot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ let
};
format = pkgs.formats.yaml { };
meetbotConfigFile = format.generate "meetbot.config.yaml" meetbotConfig;
in
{
in {
options = {
services.meetbot = {
enable = mkEnableOption "Meetbot";
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/matrix/mjolnir.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
with lib;
let mjolnirCfg = config.services.mjolnir;
in mkIf mjolnirCfg.enable {
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/matrix/msclinkbot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/matrix/standupbot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ let
format = pkgs.formats.json { };
standupbotConfigJson =
format.generate "standupbot.config.json" standupbotConfig;
in
{
in {
options = {
services.standupbot = {
enable = mkEnableOption "standupbot";
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/matrix/synapse/cleanup-synapse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ let
systemctl start matrix-synapse.target
'';
in
{
in {
options.services.cleanup-synapse = {
environmentFile = mkOption {
type = types.path;
Expand Down
8 changes: 3 additions & 5 deletions nixos/modules/services/matrix/synapse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -144,8 +143,7 @@ let
resources = [{ names = [ "media" ]; }];
}];
});
in
{
in {
imports = [ ./cleanup-synapse.nix ];

options = {
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/services/matrix/synapse/shared-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ let
};
disable_existing_loggers = false;
};
in
{
in {
# Experimental features
experimental_features = {
# Enable support for the suppressing edit notifications.
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/postgresql.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
with lib;
mkMerge [
(mkIf config.services.postgresql.enable {
Expand Down
1 change: 0 additions & 1 deletion nixos/modules/services/prometheus.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{ config, lib, ... }:
let promPort = 9002;
in {
config = {
Expand Down
Loading

0 comments on commit 9529791

Please sign in to comment.