1{ system ? builtins.currentSystem
2, config ? { }
3, pkgs ? import ../../.. { inherit system config; }
4}:
5with pkgs.lib;
6
7let
8 mkNode = package: { replicationMode, publicV6Address ? "::1" }: { pkgs, ... }: {
9 networking.interfaces.eth1.ipv6.addresses = [{
10 address = publicV6Address;
11 prefixLength = 64;
12 }];
13
14 networking.firewall.allowedTCPPorts = [ 3901 3902 ];
15
16 services.garage = {
17 enable = true;
18 inherit package;
19 settings = {
20 replication_mode = replicationMode;
21
22 rpc_bind_addr = "[::]:3901";
23 rpc_public_addr = "[${publicV6Address}]:3901";
24 rpc_secret = "5c1915fa04d0b6739675c61bf5907eb0fe3d9c69850c83820f51b4d25d13868c";
25
26 s3_api = {
27 s3_region = "garage";
28 api_bind_addr = "[::]:3900";
29 root_domain = ".s3.garage";
30 };
31
32 s3_web = {
33 bind_addr = "[::]:3902";
34 root_domain = ".web.garage";
35 index = "index.html";
36 };
37 };
38 };
39 environment.systemPackages = [ pkgs.minio-client ];
40
41 # Garage requires at least 1GiB of free disk space to run.
42 virtualisation.diskSize = 2 * 1024;
43 };
44in
45 foldl
46 (matrix: ver: matrix // {
47 "basic${toString ver}" = import ./basic.nix { inherit system pkgs; mkNode = mkNode pkgs."garage_${ver}"; };
48 "with-3node-replication${toString ver}" = import ./with-3node-replication.nix { inherit system pkgs; mkNode = mkNode pkgs."garage_${ver}"; };
49 })
50 {}
51 [
52 "0_8"
53 ]