mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
nginx.applications.webdav: allow multiple instances
This commit is contained in:
@@ -353,7 +353,7 @@
|
||||
send.enable = true;
|
||||
huginn.enable = true;
|
||||
fz-new-order.enable = true;
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.enable = true; };
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; };
|
||||
httpapi.enable = true;
|
||||
};
|
||||
};})
|
||||
@@ -455,7 +455,7 @@
|
||||
{
|
||||
enable = true;
|
||||
transparentProxy.externalIp = [ "192.168.82.4" "192.168.1.185" ];
|
||||
applications.webdav = { enable = true; hostname = "local.webdav.chn.moe"; };
|
||||
applications.webdav.instances."local.webdav.chn.moe" = {};
|
||||
};
|
||||
};
|
||||
users.users = [ "root" "chn" "xll" "zem" "yjq" "yxy" ];
|
||||
|
||||
@@ -1,22 +1,36 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.services.nginx.applications.webdav = let inherit (inputs.lib) mkOption types; in
|
||||
options.nixos.services.nginx.applications.webdav.instances = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "webdav.chn.moe"; };
|
||||
type = types.attrsOf (types.submodule (submoduleInputs: { options =
|
||||
{
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = submoduleInputs.config._module.args.name; };
|
||||
path = mkOption { type = types.nonEmptyStr; default = "/srv/webdav"; };
|
||||
users = mkOption { type = types.nonEmptyListOf types.nonEmptyStr; default = [ "chn" ]; };
|
||||
};}));
|
||||
default = {};
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.config.nixos.services.nginx.applications) webdav;
|
||||
inherit (inputs.lib) mkIf;
|
||||
in mkIf webdav.enable
|
||||
inherit (inputs.config.nixos.services.nginx.applications.webdav) instances;
|
||||
inherit (builtins) map listToAttrs attrNames;
|
||||
inherit (inputs.lib) mkMerge;
|
||||
in
|
||||
{
|
||||
nixos.services.nginx.https."${webdav.hostname}".location."/".static =
|
||||
{ root = "/srv/webdav"; index = "auto"; charset = "utf-8"; webdav = true; detectAuth.users = [ "chn" ]; };
|
||||
systemd =
|
||||
{
|
||||
tmpfiles.rules = [ "d /srv/webdav 0700 nginx nginx" ];
|
||||
services.nginx.serviceConfig.ReadWritePaths = [ "/srv/webdav" ];
|
||||
};
|
||||
nixos.services.nginx.https = listToAttrs (map
|
||||
(site:
|
||||
{
|
||||
name = site.hostname;
|
||||
value.location."/".static =
|
||||
{ root = site.path; index = "auto"; charset = "utf-8"; webdav = true; detectAuth.users = site.users; };
|
||||
})
|
||||
(attrNames instances));
|
||||
systemd = mkMerge (map
|
||||
(site:
|
||||
{
|
||||
tmpfiles.rules = [ "d ${site.path} 0700 nginx nginx" ];
|
||||
services.nginx.serviceConfig.ReadWritePaths = [ site.path ];
|
||||
})
|
||||
(attrNames instances));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ xray-server:
|
||||
user16: ENC[AES256_GCM,data:ijz4n66TY2tGpKLvGr7I6n+cOP6BfgpJdHmcPy2oTPGCvhR0,iv:RK8wi3Cj9XFVTqqt00DLru12Hiu/WJU8lV/v9MF5deI=,tag:6SHR8Yb2dO1rRY/xV5u9yw==,type:str]
|
||||
#ENC[AES256_GCM,data:inAhj6SP8p4KahuZ+aSjPfnEcOY=,iv:eB6OvUkQvfdAkNuf95K7jAjZZ8i+nbsnsH3WEdRWFhw=,tag:dgw+RFY2cm6jF+R5z3Z+XA==,type:comment]
|
||||
user17: ENC[AES256_GCM,data:Wz7tWzASeIKE9TzicUIwyOnjZDDICYvDAUu/scHrQoFjoOlE,iv:A2gPFSiIXaf1dQkFlXjw5yesKtv3qOVcIXzM2QspvDk=,tag:JWCVx2FJS84v2iMdzBxhlQ==,type:str]
|
||||
#ENC[AES256_GCM,data:b839t/OihMOmz0gIcTo43r2MIw==,iv:8kaAFG7DhFOoitcvbFaAvE1NUSLFrFhy1KiMrqs4r/c=,tag:G4vSADa52ZfN5y5ytoFJoQ==,type:comment]
|
||||
user18: ENC[AES256_GCM,data:xQMRt+YC1Kn0Qxtis9QVIypq4uHNLq2sWKxxQe515Kfg+zzw,iv:28nQibxqzx5Q17UkEwK0zYhu6mFJ8LUk78xxlQrIqFY=,tag:B7N/fC81v8VBTsDdIZDvDw==,type:str]
|
||||
user19: ENC[AES256_GCM,data:Qjajmu6cfACT4eho6BK56zRd7BSXxo4fUeJ2RRawopVFZESJ,iv:QZN81pQxspe76V90NQxzsKmMwtvaC1qwuvd5a6WbrdU=,tag:/+LYeQLqvwM60DgIPtZzKA==,type:str]
|
||||
user20: ENC[AES256_GCM,data:uRSG6jOks7utk2bRdd5sndvqVnSGRhjkts2f3+V7JdEwQf4k,iv:xZdVv/H5RuliwSEWmgLViLquWZ5znGOpP9YwwLJfsyo=,tag:JR3BsCKkHpkE7woTaMHXwQ==,type:str]
|
||||
@@ -95,8 +96,8 @@ sops:
|
||||
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
|
||||
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2023-11-15T03:24:39Z"
|
||||
mac: ENC[AES256_GCM,data:vUekGOHfSM9qBZCvbUYA/PUZh9zoxDg7EgVsi35jJt+g8EYeG8LGCkEdoHXhoiTayLNUNPpYSLid1xnHGOg43wtpBZfR/UC8OafcOu+hIGdojxTfnEWsQk0lT3Qt/AyYA0PbakDxx6JiH8RRADCb2+ZZ3V2PuB6gE7Rc7tWpvOE=,iv:gIIySdB1CGeSn7tamGa0UxkXtdHfF1J5Ta12BgYB0Yg=,tag:Lqx49Aa/0QbAUwdkm4b0uQ==,type:str]
|
||||
lastmodified: "2023-11-18T15:17:58Z"
|
||||
mac: ENC[AES256_GCM,data:L8aX2FWeHLxtNz/a2sdkPNnd00Rf8a2snSxXWd6prwMfHAjzhNtgrA9AdRes3gCGY50NwkcOVyxmQ5YFvlsYaqjHUHlFehQtZwO6TI7x31rKuhWiejiiB5fcLqd2jKb9ZZYXIw1KemqPDZGo70vkYBFpAT94mx92nubQJwl01ao=,iv:UrdPEMwiPKyEZqRoZbLXfUZfRLPdGlkr+mFMXlrLjjU=,tag:6s2a0L8bFtCvsePclBw1Hg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.7.3
|
||||
|
||||
Reference in New Issue
Block a user