my nix configs for my servers and desktop
1{ config, lib, pkgs, ... }:
2
3with lib;
4let
5 cfg = config.modules.garage;
6in
7{
8 options = {
9 modules = {
10 garage = {
11 enable = mkEnableOption "Deploy garage";
12 };
13 };
14 };
15
16 config = mkIf cfg.enable {
17 services.garage = {
18 enable = true;
19 package = pkgs.garage;
20 settings = {
21 metadata_dir = "/garage/metadata";
22 data_dir = "/garage/data";
23 db_engine = "lmdb";
24 replication_mode = "2";
25 rpc_bind_addr = "[::]:3901";
26 rpc_public_addr = "${config.networking.hostName}:3901";
27 rpc_secret_file = config.age.secrets."garage-rpc-secret".path;
28 s3_api = {
29 s3_region = config.networking.hostName;
30 api_bind_addr = "[::]:3900";
31 root_domain = ".s3.nekomimi.pet";
32 };
33 s3_web = {
34 bind_addr = "[::]:3902";
35 root_domain = ".web.nekomimi.pet";
36 index = "index.html";
37 };
38 admin = {
39 api_bind_addr = "[::]:3903";
40 admin_token_file = config.age.secrets."garage-admin-token".path;
41 metrics_token_file = config.age.secrets."garage-metrics-token".path;
42 };
43 bootstrap_peers = [
44 "d548d0c9ae9aec9e26fe0bd2ca3efe75f654fa350bad5cb02bc9aebc9850ba8f@[2a04:52c0:135:48d1::2]:3901" # buer
45 "5504cb25910dcef4a4312006691d651c099cde7c3a88df9ca79aa350571e6e65@[2601:5c2:8400:26c0:4ecc:6aff:fef7:98ca]:3901" #valefar
46 ];
47 };
48 };
49 };
50}