diff options
| author | Kumar Damani <me@kumardamani.net> | 2026-09-15 15:34:40 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2026-09-15 15:34:40 +0000 |
| commit | 2a841c704b17d5f8edf864a3ee5245d07e6ec5c7 (patch) | |
| tree | 788e8c2e5ead0a92220a09afb69332fabc33d988 /nix/per-host/s3 | |
| parent | 34a9231e704ff4f6f2676dfaaccbb3bfb03a933d (diff) | |
s3 config
Diffstat (limited to 'nix/per-host/s3')
| -rw-r--r-- | nix/per-host/s3/configuration.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/nix/per-host/s3/configuration.nix b/nix/per-host/s3/configuration.nix new file mode 100644 index 0000000..7af6d9d --- /dev/null +++ b/nix/per-host/s3/configuration.nix @@ -0,0 +1,67 @@ +{ config, pkgs, modulesPath, lib, system, ... }: + +{ + config = { + sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + sops.defaultSopsFile = ../../secrets/s3.yaml; + sops.secrets."garage/rpc-secret" = { + owner = "garage"; + mode = "0400"; + }; + sops.secrets."garage/admin-token" = { + owner = "garage"; + mode = "0400"; + }; + sops.secrets."garage/env" = { }; + + networking.hostName = "s3"; + networking.firewall.allowedTCPPorts = [ 3900 3902 ]; + + users.users.garage = { + isSystemUser = true; + group = "garage"; + }; + users.groups.garage = { }; + + systemd.services.garage = { + serviceConfig = { + DynamicUser = false; + User = "garage"; + Group = "garage"; + }; + unitConfig.RequiresMountsFor = "/mnt/data"; + }; + + services.garage = { + enable = true; + package = pkgs.garage; + environmentFile = config.sops.secrets."garage/env".path; + settings = { + data_dir = "/mnt/data"; + replication_factor = 1; + rpc_bind_addr = "[::]:3901"; + rpc_secret_file = config.sops.secrets."garage/rpc-secret".path; + s3_api = { + s3_region = "garage"; + api_bind_addr = "[::]:3900"; + }; + s3_web = { + bind_addr = "[::]:3902"; + root_domain = ".s3web.kumardamani.net"; + index = "index.html"; + }; + admin = { + api_bind_addr = "127.0.0.1:3901"; + admin_token_file = config.sops.secrets."garage/admin-token".path; + }; + }; + }; + + fileSystems = { + "/mnt/data" = { + device = "nas.bacala:/mnt/tank/customers/lab/s3"; + fsType = "nfs"; + }; + }; + }; +} |
