diff --git a/hosts/desktop1/configuration.nix b/hosts/desktop1/configuration.nix index bdea3a7..1efb311 100644 --- a/hosts/desktop1/configuration.nix +++ b/hosts/desktop1/configuration.nix @@ -8,13 +8,10 @@ networking.hostName = "desktop1"; - networking.bridges.br0.interfaces = [ ]; - networking.interfaces.br0.ipv4.addresses = [ - { - address = "10.0.0.1"; - prefixLength = 24; - } - ]; + networking.bridges.br0.interfaces = [ "enp4s0" ]; + networking.interfaces.br0.ipv4.addresses = [ { address = "192.168.1.146"; prefixLength = 24; } ]; + networking.defaultGateway = "192.168.1.254"; + networking.nameservers = [ "192.168.1.137" "192.168.1.49" ]; smayzy = { desktop.enable = true; diff --git a/modules/nix/containers/nixos/default.nix b/modules/nix/containers/nixos/default.nix index a2139f2..898eb13 100644 --- a/modules/nix/containers/nixos/default.nix +++ b/modules/nix/containers/nixos/default.nix @@ -1,5 +1,6 @@ { ... }: { imports = [ + ./httpd.nix ]; } diff --git a/modules/nix/containers/nixos/httpd.nix b/modules/nix/containers/nixos/httpd.nix new file mode 100644 index 0000000..cf50bee --- /dev/null +++ b/modules/nix/containers/nixos/httpd.nix @@ -0,0 +1,39 @@ +{ lib, config, ... }: +let + inherit (lib) mkIf mkOption types; + cfg = config.smayzy.containers.nixos.httpd; +in +{ + options.smayzy.containers.nixos.httpd = { + enable = mkOption { + type = types.bool; + default = false; + description = "httpd nixos ct"; + }; + bridge = mkOption { + type = types.str; + description = "the bridge to use e.g. (br0)"; + }; + 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 = cfg.bridge; + localAddress = cfg.ip; + config = { ... }: { + system.stateVersion = "25.11"; + + services.httpd = { + enable = true; + }; + networking.firewall.allowedTCPPorts = [ 80 ]; + }; + }; + }; +}