This commit is contained in:
2023-11-16 12:06:53 +08:00
parent d2479b229e
commit 3cfedc26c9
2 changed files with 15 additions and 6 deletions

View File

@@ -499,6 +499,7 @@ inputs:
cinny-desktop # nur-xddxdd.wine-wechat thunder
# browser
google-chrome
john
];
};
};

View File

@@ -1,21 +1,29 @@
inputs:
{
options.nixos.services.httpua = let inherit (inputs.lib) mkOption types; in
options.nixos.services.httpapi = let inherit (inputs.lib) mkOption types; in
{
enable = mkOption { type = types.bool; default = false; };
hostname = mkOption { type = types.nonEmptyStr; default = "ua.chn.moe"; };
hostname = mkOption { type = types.nonEmptyStr; default = "api.chn.moe"; };
};
config =
let
inherit (inputs.config.nixos.services) httpua;
inherit (inputs.config.nixos.services) httpapi;
inherit (inputs.lib) mkIf;
inherit (builtins) toString;
in mkIf httpua.enable
in mkIf httpapi.enable
{
nixos.services =
{
phpfpm.instances.httpua = {};
nginx.http.${httpua.hostname}.php =
phpfpm.instances.httpapi = {};
nginx.https.${httpapi.hostname}.location =
{
"/led".static =
{
root = "/srv/api";
detectAuth.users = [ "chn" ];
}
}
php =
{
root = toString ./.;
fastcgiPass = inputs.config.nixos.services.phpfpm.instances.httpua.fastcgi;