Some fixes for Pixelfed on metal #27

Merged
Niols merged 3 commits from pixelfed-on-metal-2 into main 2024-10-29 17:09:20 +01:00
Showing only changes of commit 4c8d380e9e - Show all commits

View file

@ -14,6 +14,7 @@ let
inherit (builtins) toString; inherit (builtins) toString;
inherit (lib) types mkOption mkEnableOption optionalString concatStringsSep; inherit (lib) types mkOption mkEnableOption optionalString concatStringsSep;
inherit (lib.strings) escapeShellArg; inherit (lib.strings) escapeShellArg;
inherit (lib.attrsets) filterAttrs mapAttrs';
cfg = config.services.garage; cfg = config.services.garage;
fedicfg = config.fediversity.internal.garage; fedicfg = config.fediversity.internal.garage;
concatMapAttrs = scriptFn: attrset: concatStringsSep "\n" (lib.mapAttrsToList scriptFn attrset); concatMapAttrs = scriptFn: attrset: concatStringsSep "\n" (lib.mapAttrsToList scriptFn attrset);
@ -159,16 +160,23 @@ in
}; };
}; };
services.nginx.virtualHosts.${fedicfg.web.domainForBucket "pixelfed"} = { ## Create a proxy from <bucket>.web.garage.<domain> to localhost:3902 for
forceSSL = true; ## each bucket that has `website = true`.
enableACME = true; services.nginx.virtualHosts =
locations."/" = { let
proxyPass = "http://localhost:3902"; value = {
extraConfig = '' forceSSL = true;
proxy_set_header Host $host; enableACME = true;
''; locations."/" = {
}; proxyPass = "http://localhost:3902";
}; extraConfig = ''
proxy_set_header Host $host;
'';
};
};
in mapAttrs'
(bucket: _: {name = fedicfg.web.domainForBucket bucket; inherit value;})
(filterAttrs (_: {website, ...}: website) cfg.ensureBuckets);
systemd.services.ensure-garage = { systemd.services.ensure-garage = {
after = [ "garage.service" ]; after = [ "garage.service" ];