nix-config/modules/nix/containers/nixos/httpd.nix
smayzy d341c0c3f1
All checks were successful
nixos config pipeline / show-flake (push) Successful in 27s
nixos config pipeline / deploy (push) Successful in 1m38s
format nix code
2025-10-09 17:55:32 +02:00

41 lines
924 B
Nix

{ lib, config, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.smayzy.containers.nixos.httpd;
net = config.smayzy.containers.networking;
in
{
options.smayzy.containers.nixos.httpd = {
enable = mkOption {
type = types.bool;
default = false;
description = "httpd nixos ct";
};
ip = mkOption {
type = types.str;
description = "ip addr e.g. (192.168.1.20)";
};
};
config = mkIf cfg.enable {
containers.httpd = {
autoStart = true;
privateNetwork = true;
hostBridge = net.bridge;
localAddress = cfg.ip;
config =
{ ... }:
{
system.stateVersion = "25.11";
services.httpd = {
enable = true;
};
networking.defaultGateway = net.gateway;
networking.nameservers = net.dns;
networking.firewall.allowedTCPPorts = [ 80 ];
};
};
};
}