mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 07:09:22 +08:00
整理 photoprism
This commit is contained in:
17
flake.nix
17
flake.nix
@@ -289,12 +289,15 @@
|
||||
"xlog.chn.moe" = { upstream = "cname.xlog.app:443"; rewriteHttps = true; };
|
||||
"xn--qbtm095lrg0bfka60z.chn.moe" =
|
||||
{ upstream.address = "internal.pc.chn.moe"; proxyProtocol = true; rewriteHttps = true; };
|
||||
"xn--s8w913fdga.chn.moe" =
|
||||
{ upstream.address = "internal.vps7.chn.moe"; proxyProtocol = true; rewriteHttps = true; };
|
||||
"misskey.chn.moe" =
|
||||
{ upstream.address = "internal.vps7.chn.moe"; proxyProtocol = true; rewriteHttps = true; };
|
||||
"nextcloud.chn.moe" =
|
||||
{ upstream.address = "internal.vps7.chn.moe"; proxyProtocol = true; rewriteHttps = true; };
|
||||
}
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(site:
|
||||
{
|
||||
name = "${site}.chn.moe";
|
||||
value =
|
||||
{ upstream.address = "internal.vps7.chn.moe"; proxyProtocol = true; rewriteHttps = true; };
|
||||
})
|
||||
[ "xn--s8w913fdga" "misskey" "nextcloud" "photoprism" ]));
|
||||
};
|
||||
};
|
||||
applications =
|
||||
@@ -302,7 +305,6 @@
|
||||
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" = {};
|
||||
photoprism.instances."photoprism.chn.moe".upstream.address = "internal.vps7.chn.moe";
|
||||
synapse-admin.instances."synapse-admin.chn.moe" = {};
|
||||
};
|
||||
};
|
||||
@@ -366,7 +368,6 @@
|
||||
{
|
||||
synapse.instances."synapse.chn.moe" = {};
|
||||
vaultwarden.enable = true;
|
||||
photoprism.instances."photoprism.chn.moe" = {};
|
||||
};
|
||||
};
|
||||
wallabag.enable = true;
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.services.nginx.applications.photoprism.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 = 2342; };
|
||||
};})];
|
||||
default = "127.0.0.1:2342";
|
||||
};
|
||||
};}));
|
||||
default = {};
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.config.nixos.services.nginx.applications.photoprism) 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));
|
||||
};
|
||||
}
|
||||
@@ -42,6 +42,24 @@ inputs:
|
||||
'';
|
||||
secrets."photoprism/adminPassword" = {};
|
||||
};
|
||||
nixos.services.mariadb = { enable = true; instances.photoprism = {}; };
|
||||
nixos.services =
|
||||
{
|
||||
mariadb = { enable = true; instances.photoprism = {}; };
|
||||
nginx =
|
||||
{
|
||||
enable = true;
|
||||
https.${photoprism.hostname} =
|
||||
{
|
||||
global.rewriteHttps = true;
|
||||
listen.main.proxyProtocol = true;
|
||||
location."/".proxy =
|
||||
{
|
||||
upstream = "http://127.0.0.1:${toString photoprism.port}";
|
||||
websocket = true;
|
||||
setHeaders.Host = photoprism.hostname;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user