Files
nixos/modules/services/speedtest.nix
2025-07-17 13:46:23 +08:00

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; };
};
};
};
}