mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 01:29:24 +08:00
25 lines
768 B
Nix
25 lines
768 B
Nix
inputs:
|
|
{
|
|
options.nixos.services.speedtest = let inherit (inputs.lib) mkOption types; in mkOption
|
|
{
|
|
type = types.nullOr (types.submodule { options =
|
|
{
|
|
hostname = mkOption { type = types.nonEmptyStr; default = "409test.chn.moe"; };
|
|
};});
|
|
default = null;
|
|
};
|
|
config = let inherit (inputs.config.nixos.services) speedtest; in inputs.lib.mkIf (speedtest != null)
|
|
{
|
|
nixos.services =
|
|
{
|
|
phpfpm.instances.speedtest = {};
|
|
nginx.https.${speedtest.hostname} = let pkg = inputs.pkgs.localPackages.speedtest; in
|
|
{
|
|
global.root = "${pkg}";
|
|
location."~ ^.+?\.php(/.*)?$".php =
|
|
{ root = "${pkg}"; fastcgiPass = inputs.config.nixos.services.phpfpm.instances.speedtest.fastcgi; };
|
|
};
|
|
};
|
|
};
|
|
}
|