Merge pull request 'clanModules: add garage module' (#1887) from kenji/clan-core:modules/init-garage into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1887
This commit is contained in:
kenji
2024-08-14 14:16:51 +00:00
4 changed files with 53 additions and 8 deletions

View File

@@ -1,24 +1,25 @@
{ ... }: { ... }:
{ {
flake.clanModules = { flake.clanModules = {
iwd = ./iwd;
dyndns = ./dyndns;
borgbackup = ./borgbackup; borgbackup = ./borgbackup;
borgbackup-static = ./borgbackup-static; borgbackup-static = ./borgbackup-static;
deltachat = ./deltachat; deltachat = ./deltachat;
dyndns = ./dyndns;
ergochat = ./ergochat; ergochat = ./ergochat;
garage = ./garage;
iwd = ./iwd;
localbackup = ./localbackup; localbackup = ./localbackup;
localsend = ./localsend; localsend = ./localsend;
single-disk = ./single-disk;
matrix-synapse = ./matrix-synapse; matrix-synapse = ./matrix-synapse;
moonlight = ./moonlight; moonlight = ./moonlight;
packages = ./packages;
mumble = ./mumble; mumble = ./mumble;
packages = ./packages;
postgresql = ./postgresql; postgresql = ./postgresql;
root-password = ./root-password; root-password = ./root-password;
single-disk = ./single-disk;
sshd = ./sshd; sshd = ./sshd;
sunshine = ./sunshine;
static-hosts = ./static-hosts; static-hosts = ./static-hosts;
sunshine = ./sunshine;
syncthing = ./syncthing; syncthing = ./syncthing;
syncthing-static-peers = ./syncthing-static-peers; syncthing-static-peers = ./syncthing-static-peers;
thelounge = ./thelounge; thelounge = ./thelounge;

View File

@@ -0,0 +1,10 @@
---
description = "S3-compatible object store for small self-hosted geo-distributed deployments"
---
This module generates garage specific keys automatically.
When using garage in a distributed deployment the `rpc_key` between connected instances must be shared.
This is currently still a manual process.
Options: [NixosModuleOptions](https://search.nixos.org/options?channel=unstable&size=50&sort=relevance&type=packages&query=garage)
Documentation: https://garagehq.deuxfleurs.fr/

View File

@@ -0,0 +1,33 @@
{ config, pkgs, ... }:
{
systemd.services.garage.serviceConfig = {
LoadCredential = [
"rpc_secret_path:${config.clan.core.vars.generators.garage.files.rpc_secret.path}"
"admin_token_path:${config.clan.core.vars.generators.garage.files.admin_token.path}"
"metrics_token_path:${config.clan.core.vars.generators.garage.files.metrics_token.path}"
];
Environment = [
"GARAGE_ALLOW_WORLD_READABLE_SECRETS=true"
"GARAGE_RPC_SECRET_FILE=%d/rpc_secret_path"
"GARAGE_ADMIN_TOKEN_FILE=%d/admin_token_path"
"GARAGE_METRICS_TOKEN_FILE=%d/metrics_token_path"
];
};
clan.core.vars.generators.garage = {
files.rpc_secret = { };
files.admin_token = { };
files.metrics_token = { };
runtimeInputs = [
pkgs.coreutils
pkgs.openssl
];
script = ''
openssl rand -hex -out $out/rpc_secret 32
openssl rand -base64 -out $out/admin_token 32
openssl rand -base64 -out $out/metrics_token 32
'';
};
clan.core.state.garage.folders = [ config.services.garage.settings.metadata_dir ];
}

View File

@@ -55,17 +55,19 @@ nav:
- Reference: - Reference:
- reference/index.md - reference/index.md
- Clan Modules: - Clan Modules:
- reference/clanModules/index.md
- reference/clanModules/borgbackup-static.md - reference/clanModules/borgbackup-static.md
- reference/clanModules/borgbackup.md - reference/clanModules/borgbackup.md
- reference/clanModules/deltachat.md - reference/clanModules/deltachat.md
- reference/clanModules/iwd.md
- reference/clanModules/dyndns.md - reference/clanModules/dyndns.md
- reference/clanModules/ergochat.md - reference/clanModules/ergochat.md
- reference/clanModules/garage.md
- reference/clanModules/index.md
- reference/clanModules/iwd.md
- reference/clanModules/localbackup.md - reference/clanModules/localbackup.md
- reference/clanModules/localsend.md - reference/clanModules/localsend.md
- reference/clanModules/matrix-synapse.md - reference/clanModules/matrix-synapse.md
- reference/clanModules/moonlight.md - reference/clanModules/moonlight.md
- reference/clanModules/mumble.md
- reference/clanModules/packages.md - reference/clanModules/packages.md
- reference/clanModules/postgresql.md - reference/clanModules/postgresql.md
- reference/clanModules/root-password.md - reference/clanModules/root-password.md
@@ -76,7 +78,6 @@ nav:
- reference/clanModules/syncthing-static-peers.md - reference/clanModules/syncthing-static-peers.md
- reference/clanModules/syncthing.md - reference/clanModules/syncthing.md
- reference/clanModules/thelounge.md - reference/clanModules/thelounge.md
- reference/clanModules/mumble.md
- reference/clanModules/trusted-nix-caches.md - reference/clanModules/trusted-nix-caches.md
- reference/clanModules/user-password.md - reference/clanModules/user-password.md
- reference/clanModules/xfce.md - reference/clanModules/xfce.md