dotfiles/terranix/main/containers/matrix/default.nix
magic_rb 4a29b6d8d3
Move terranix config into terranix/main
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-04-07 10:45:07 +02:00

283 lines
8.3 KiB
Nix

{
config',
config,
elib,
tflib,
vars,
...
}: let
inherit
(elib)
nfsVolume
nomadJob
;
inherit
(tflib)
tf
;
buildNixNGSystem' = attrs:
elib.buildNixNGSystem (attrs
// {
hosts = [
"blowhole.hosts.in.redalder.org"
];
});
in {
resource."nomad_volume"."matrix-synapse" = nfsVolume {
volume_name = "matrix-synapse";
access_mode = "multi-node-multi-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/synapse";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-postgresql" = nfsVolume {
volume_name = "matrix-postgresql";
access_mode = "single-node-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/jimmy/infrastructure/matrix/postgresql";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-registrations" = nfsVolume {
volume_name = "matrix-registrations";
access_mode = "multi-node-multi-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/registrations";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-mautrix-discord" = nfsVolume {
volume_name = "matrix-mautrix-discord";
access_mode = "single-node-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/mautrix-discord";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-mautrix-slack" = nfsVolume {
volume_name = "matrix-mautrix-slack";
access_mode = "single-node-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/mautrix-slack";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-mautrix-facebook" = nfsVolume {
volume_name = "matrix-mautrix-facebook";
access_mode = "single-node-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/mautrix-facebook";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-mautrix-signal" = nfsVolume {
volume_name = "matrix-mautrix-signal";
access_mode = "single-node-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/mautrix-signal";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."nomad_volume"."matrix-redis" = nfsVolume {
volume_name = "matrix-redis";
access_mode = "single-node-writer";
server = "blowhole.hosts.in.redalder.org";
share = "/mnt/kyle/infrastructure/matrix/redis";
mount_flags = ["hard" "vers=4.2" "rsize=16384" "wsize=16384" "async"];
};
resource."vault_policy"."matrix-mautrix-signal-policy" = {
name = "matrix-mautrix-signal-policy";
policy = ''
path "kv/data/cluster/matrix/mautrix-signal/main" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-signal/postgresql" {
capabilities = ["read"]
}
'';
};
resource."vault_policy"."matrix-mautrix-discord-policy" = {
name = "matrix-mautrix-discord-policy";
policy = ''
path "kv/data/cluster/matrix/mautrix-discord/main" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-discord/postgresql" {
capabilities = ["read"]
}
'';
};
resource."vault_policy"."matrix-mautrix-slack-policy" = {
name = "matrix-mautrix-slack-policy";
policy = ''
path "kv/data/cluster/matrix/mautrix-slack/main" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-slack/postgresql" {
capabilities = ["read"]
}
'';
};
resource."vault_policy"."matrix-mautrix-facebook-policy" = {
name = "matrix-mautrix-facebook-policy";
policy = ''
path "kv/data/cluster/matrix/mautrix-facebook/main" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-facebook/postgresql" {
capabilities = ["read"]
}
'';
};
resource."vault_policy"."matrix-synapse-policy" = {
name = "matrix-synapse-policy";
policy = ''
path "kv/data/cluster/matrix/synapse" {
capabilities = ["read"]
}
'';
};
resource."vault_policy"."matrix-postgresql-policy" = {
name = "matrix-postgresql-policy";
policy = ''
path "kv/data/cluster/matrix/synapse" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-facebook/postgresql" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-signal/postgresql" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-discord/postgresql" {
capabilities = ["read"]
}
path "kv/data/cluster/matrix/mautrix-slack/postgresql" {
capabilities = ["read"]
}
'';
};
imports = [
(buildNixNGSystem' {
name = "synapse";
})
(buildNixNGSystem' {
name = "synapseClient";
})
(buildNixNGSystem' {
name = "synapseSync";
})
(buildNixNGSystem' {
name = "synapseFederationSender";
})
(buildNixNGSystem' {
name = "synapseFederationReceiver";
})
(buildNixNGSystem' {
name = "synapsePostgreSQL";
})
(buildNixNGSystem' {
name = "synapseRedis";
})
(buildNixNGSystem' {
name = "mautrixDiscord";
})
(buildNixNGSystem' {
name = "mautrixSlack";
})
(buildNixNGSystem' {
name = "mautrixFacebook";
})
(buildNixNGSystem' {
name = "mautrixSignal";
})
(buildNixNGSystem' {
name = "heisenbridge";
})
];
resource."nomad_job"."matrix-synapse" = nomadJob {
jobspec = ./matrix-synapse.hcl;
vars = {
flake_ref = "unused";
flake_sha = "unused";
store_path = builtins.toJSON {
synapse = tf "data.external.nixng-system-synapse.result.out";
synapseClient = tf "data.external.nixng-system-synapseClient.result.out";
synapseSync = tf "data.external.nixng-system-synapseSync.result.out";
synapseFederationSender = tf "data.external.nixng-system-synapseFederationSender.result.out";
synapseFederationReceiver = tf "data.external.nixng-system-synapseFederationReceiver.result.out";
postgresql = tf "data.external.nixng-system-synapsePostgreSQL.result.out";
redis = tf "data.external.nixng-system-synapseRedis.result.out";
};
};
depends_on = [
"terraform_data.nixng-system-synapse-copy"
"terraform_data.nixng-system-synapseClient-copy"
"terraform_data.nixng-system-synapseSync-copy"
"terraform_data.nixng-system-synapseFederationSender-copy"
"terraform_data.nixng-system-synapseFederationReceiver-copy"
"terraform_data.nixng-system-synapsePostgreSQL-copy"
"terraform_data.nixng-system-synapseRedis-copy"
];
};
resource."nomad_job"."matrix-mautrix-discord" = nomadJob {
jobspec = ./matrix-mautrix-discord.hcl;
vars = {
flake_ref = "unused";
flake_sha = "unused";
store_path = tf "data.external.nixng-system-mautrixDiscord.result.out";
};
};
resource."nomad_job"."matrix-mautrix-slack" = nomadJob {
jobspec = ./matrix-mautrix-slack.hcl;
vars = {
flake_ref = "unused";
flake_sha = "unused";
store_path = tf "data.external.nixng-system-mautrixSlack.result.out";
};
};
resource."nomad_job"."matrix-mautrix-facebook" = nomadJob {
jobspec = ./matrix-mautrix-facebook.hcl;
vars = {
flake_ref = "unused";
flake_sha = "unused";
store_path = tf "data.external.nixng-system-mautrixFacebook.result.out";
};
};
resource."nomad_job"."matrix-mautrix-signal" = nomadJob {
jobspec = ./matrix-mautrix-signal.hcl;
vars = {
flake_ref = "unused";
flake_sha = "usused";
store_path = tf "data.external.nixng-system-mautrixSignal.result.out";
};
};
resource."nomad_job"."matrix-heisenbridge" = nomadJob {
jobspec = ./matrix-heisenbridge.hcl;
vars = {
flake_ref = "unused";
flake_sha = "unused";
store_path = tf "data.external.nixng-system-heisenbridge.result.out";
};
};
}