1 { config, lib, pkgs, ... }:
6 opts = { name, config, ... }: {
12 description = lib.mdDoc "Whether to enable proxy for this bucket";
14 bucketName = mkOption {
17 example = "my-bucket-name";
18 description = lib.mdDoc "Name of Google storage bucket";
22 example = "localhost:3000";
23 description = lib.mdDoc "The address of the proxy.";
27 enabledProxies = lib.filterAttrs (n: v: v.enable) config.services.nix-store-gcs-proxy;
28 mapProxies = function: lib.mkMerge (lib.mapAttrsToList function enabledProxies);
31 options.services.nix-store-gcs-proxy = mkOption {
32 type = types.attrsOf (types.submodule opts);
34 description = lib.mdDoc ''
35 An attribute set describing an HTTP to GCS proxy that allows us to use GCS
36 bucket via HTTP protocol.
40 config.systemd.services = mapProxies (name: cfg: {
41 "nix-store-gcs-proxy-${name}" = {
42 description = "A HTTP nix store that proxies requests to Google Storage";
43 wantedBy = ["multi-user.target"];
45 startLimitIntervalSec = 10;
49 ${pkgs.nix-store-gcs-proxy}/bin/nix-store-gcs-proxy \
50 --bucket-name ${cfg.bucketName} \
56 ProtectSystem = "strict";
59 PrivateDevices = true;
63 ProtectKernelTunables = true;
64 ProtectKernelModules = true;
65 ProtectControlGroups = true;
67 NoNewPrivileges = true;
68 LockPersonality = true;
69 RestrictRealtime = true;
74 meta.maintainers = [ maintainers.mrkkrp ];