feat(nixosModules/server): add nginx

This commit is contained in:
Mohammad Rafiq 2025-06-04 20:31:37 +08:00
parent d478e9009f
commit 5ba9667f4e
No known key found for this signature in database
4 changed files with 28 additions and 34 deletions

View file

@ -0,0 +1,27 @@
{ config, lib, ... }:
let
cfg = config.server.web-servers;
in
{
options.server.web-servers = {
nginx = {
enable = lib.mkEnableOption "the Nginx server";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.nginx.enable {
networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx = {
enable = true;
virtualHosts.${config.system.hostname} = {
locations."/" = {
return = "200 '<html><body>It works!</body></html'";
extraConfig = ''
default_type text/html;
'';
};
};
};
})
];
}