Added the rest of the configuration. Still some things to add.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./firewall.nix
|
||||
./networking.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
networking.nftables.enable = true;
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
allowPing = true;
|
||||
allowedTCPPorts = [ 53 80 443 ];
|
||||
allowedUDPPorts = [ 53 443 ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.numbus.services.networking;
|
||||
in
|
||||
|
||||
{
|
||||
options.numbus.services.networking = {
|
||||
ipAddress = mkOption {
|
||||
description = "The IP address that this server will use";
|
||||
type = types.str;
|
||||
example = "192.168.1.100";
|
||||
};
|
||||
interface = mkOption {
|
||||
description = "The interface that this server will use to connect to the network";
|
||||
type = types.str;
|
||||
example = "enp1s0";
|
||||
};
|
||||
routerIpAddress = mkOption {
|
||||
description = "The IP address of the router of your network";
|
||||
type = types.str;
|
||||
example = "192.168.1.1";
|
||||
};
|
||||
dnsServers = mkOption {
|
||||
description = "The list of DNS servers that this server will use";
|
||||
type = types.listOf types.str;
|
||||
default = [ "${cfg.ipAddress}" "9.9.9.9" ];
|
||||
example = [ "${cfg.ipAddress}" "9.9.9.9" ];
|
||||
};
|
||||
};
|
||||
|
||||
networking.hostName = "numbus-server";
|
||||
networking.networkmanager.enable = false;
|
||||
|
||||
# Allow rootless containers to bind to port 53 and up
|
||||
boot.kernel.sysctl."net.ipv4.ip_unprivileged_port_start" = 53;
|
||||
|
||||
networking.bridges.br0.interfaces = [ "${cfg.interface}" ];
|
||||
networking.interfaces."${cfg.interface}".useDHCP = false;
|
||||
networking.interfaces.br0.useDHCP = false;
|
||||
networking.nameservers = ${cfg.dnsServers};
|
||||
networking.interfaces.br0.ipv4.addresses = [{
|
||||
address = "${cfg.ipAddress}";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
networking.defaultGateway = {
|
||||
address = "${cfg.routerIpAddress}";
|
||||
interface = "br0";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user