mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:19:22 +08:00
修正misskey
This commit is contained in:
29
flake.nix
29
flake.nix
@@ -208,12 +208,7 @@
|
||||
};
|
||||
nix-serve = { enable = true; hostname = "nix-store.chn.moe"; };
|
||||
smartd.enable = true;
|
||||
nginx =
|
||||
{
|
||||
enable = true;
|
||||
transparentProxy.externalIp = [ "192.168.82.3" ];
|
||||
applications.misskey.instances."xn--qbtm095lrg0bfka60z.chn.moe" = {};
|
||||
};
|
||||
nginx.transparentProxy.externalIp = [ "192.168.82.3" ]; };
|
||||
misskey.instances.misskey.hostname = "xn--qbtm095lrg0bfka60z.chn.moe";
|
||||
beesd = { enable = true; instances.root = { device = "/"; hashTableSizeMB = 2048; }; };
|
||||
};
|
||||
@@ -275,7 +270,6 @@
|
||||
frpServer = { enable = true; serverName = "frp.chn.moe"; };
|
||||
nginx =
|
||||
{
|
||||
enable = true;
|
||||
transparentProxy =
|
||||
{
|
||||
externalIp = [ "74.211.99.69" "192.168.82.1" ];
|
||||
@@ -287,23 +281,22 @@
|
||||
};
|
||||
streamProxy =
|
||||
{
|
||||
enable = true;
|
||||
map =
|
||||
{
|
||||
"nix-store.chn.moe" = { upstream = "internal.pc.chn.moe:443"; rewriteHttps = true; };
|
||||
"anchor.fm" = { upstream = "anchor.fm:443"; rewriteHttps = true; };
|
||||
"podcasters.spotify.com" = { upstream = "podcasters.spotify.com:443"; rewriteHttps = true; };
|
||||
"xlog.chn.moe" = { upstream = "cname.xlog.app:443"; rewriteHttps = true; };
|
||||
"xn--qbtm095lrg0bfka60z.chn.moe" =
|
||||
{ upstream.address = "internal.pc.chn.moe"; proxyProtocol = true; };
|
||||
"xn--s8w913fdga.chn.moe" =
|
||||
{ upstream.address = "internal.vps7.chn.moe"; proxyProtocol = true; };
|
||||
"misskey.chn.moe" =
|
||||
{ upstream.address = "internal.vps7.chn.moe"; proxyProtocol = true; };
|
||||
};
|
||||
};
|
||||
applications =
|
||||
{
|
||||
misskey.instances =
|
||||
{
|
||||
"xn--qbtm095lrg0bfka60z.chn.moe".upstream.address = "internal.pc.chn.moe";
|
||||
"xn--s8w913fdga.chn.moe".upstream.address = "internal.vps7.chn.moe";
|
||||
"misskey.chn.moe".upstream = "internal.vps7.chn.moe:9727";
|
||||
};
|
||||
synapse.instances."synapse.chn.moe".upstream.address = "internal.vps7.chn.moe";
|
||||
vaultwarden = { enable = true; upstream.address = "internal.vps7.chn.moe"; };
|
||||
element.instances."element.chn.moe" = {};
|
||||
@@ -367,15 +360,9 @@
|
||||
rsshub.enable = true;
|
||||
nginx =
|
||||
{
|
||||
enable = true;
|
||||
transparentProxy.externalIp = [ "95.111.228.40" "192.168.82.2" ];
|
||||
applications =
|
||||
{
|
||||
misskey.instances =
|
||||
{
|
||||
"xn--s8w913fdga.chn.moe" = {};
|
||||
"misskey.chn.moe".upstream.port = 9727;
|
||||
};
|
||||
synapse.instances."synapse.chn.moe" = {};
|
||||
vaultwarden.enable = true;
|
||||
photoprism.instances."photoprism.chn.moe" = {};
|
||||
@@ -616,7 +603,7 @@
|
||||
tcp.store = { localPort = 443; remotePort = 7676; };
|
||||
};
|
||||
smartd.enable = true;
|
||||
nginx = { enable = true; transparentProxy.enable = false; };
|
||||
nginx.transparentProxy.enable = false;
|
||||
postgresql.enable = true;
|
||||
};
|
||||
bugs = [ "xmunet" "firefox" "embree" ];
|
||||
|
||||
@@ -160,6 +160,27 @@ inputs:
|
||||
};
|
||||
})
|
||||
(filter (instance: instance.value.meilisearch.enable) (attrsToList misskey.instances)));
|
||||
nginx =
|
||||
{
|
||||
enable = mkIf (misskey.instances != {}) true;
|
||||
https = listToAttrs (map
|
||||
(instance: with instance.value;
|
||||
{
|
||||
name = hostname;
|
||||
value =
|
||||
{
|
||||
global.rewriteHttps = true;
|
||||
listen.main.proxyProtocol = true;
|
||||
locations."/".proxy =
|
||||
{
|
||||
upstream = "http://127.0.0.1:${toString port}";
|
||||
websocket = true;
|
||||
setHeaders.Host = hostname;
|
||||
};
|
||||
};
|
||||
})
|
||||
(attrsToList misskey.instances));
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ inputs:
|
||||
{
|
||||
imports = inputs.localLib.mkModules
|
||||
[
|
||||
./misskey.nix
|
||||
./synapse.nix
|
||||
./vaultwarden.nix
|
||||
./element.nix
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.services.nginx.applications.misskey.instances = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.attrsOf (types.submodule (submoduleInputs: { options =
|
||||
{
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = submoduleInputs.config._module.args.name; };
|
||||
upstream = mkOption
|
||||
{
|
||||
type = types.oneOf [ types.nonEmptyStr (types.submodule { options =
|
||||
{
|
||||
address = mkOption { type = types.nonEmptyStr; default = "127.0.0.1"; };
|
||||
port = mkOption { type = types.ints.unsigned; default = 9726; };
|
||||
};})];
|
||||
default = "127.0.0.1:9726";
|
||||
};
|
||||
};}));
|
||||
default = {};
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.config.nixos.services.nginx.applications.misskey) instances;
|
||||
inherit (inputs.localLib) attrsToList;
|
||||
inherit (builtins) map listToAttrs toString;
|
||||
in
|
||||
{
|
||||
nixos.services.nginx.http = listToAttrs (map
|
||||
(proxy: with proxy.value;
|
||||
{
|
||||
name = hostname;
|
||||
value =
|
||||
{
|
||||
rewriteHttps = true;
|
||||
locations."/".proxy =
|
||||
{
|
||||
upstream = if builtins.typeOf upstream == "string" then "http://${upstream}"
|
||||
else "http://${upstream.address}:${toString upstream.port}";
|
||||
websocket = true;
|
||||
setHeaders.Host = hostname;
|
||||
};
|
||||
};
|
||||
})
|
||||
(attrsToList instances));
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user