Some fixes for Pixelfed on metal #27
|
@ -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,10 +160,13 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts.${fedicfg.web.rootDomain} = {
|
## Create a proxy from <bucket>.web.garage.<domain> to localhost:3902 for
|
||||||
|
## each bucket that has `website = true`.
|
||||||
|
services.nginx.virtualHosts =
|
||||||
|
let
|
||||||
|
value = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
serverAliases = lib.mapAttrsToList (bucket: _: fedicfg.web.domainForBucket bucket) cfg.ensureBuckets; ## TODO: use wildcard certificates?
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:3902";
|
proxyPass = "http://localhost:3902";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
@ -170,6 +174,9 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
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" ];
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
{ lib, config, modulesPath, ... }:
|
{ lib, config, modulesPath, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkVMOverride;
|
inherit (lib) mkVMOverride mapAttrs' filterAttrs;
|
||||||
|
|
||||||
|
cfg = config.services.garage;
|
||||||
|
|
||||||
fedicfg = config.fediversity.internal.garage;
|
fedicfg = config.fediversity.internal.garage;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||||
|
|
||||||
services.nginx.virtualHosts.${fedicfg.web.rootDomain} = {
|
services.nginx.virtualHosts =
|
||||||
|
let
|
||||||
|
value = {
|
||||||
forceSSL = mkVMOverride false;
|
forceSSL = mkVMOverride false;
|
||||||
enableACME = mkVMOverride false;
|
enableACME = mkVMOverride false;
|
||||||
};
|
};
|
||||||
|
in mapAttrs'
|
||||||
|
(bucket: _: {name = fedicfg.web.domainForBucket bucket; inherit value;})
|
||||||
|
(filterAttrs (_: {website, ...}: website) cfg.ensureBuckets);
|
||||||
|
|
||||||
virtualisation.diskSize = 2048;
|
virtualisation.diskSize = 2048;
|
||||||
virtualisation.forwardPorts = [
|
virtualisation.forwardPorts = [
|
||||||
|
|
Reference in a new issue