2021-11-21 19:07:12 +01:00
|
|
|
{
|
2022-03-01 22:19:03 +01:00
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.eboskma.networking;
|
|
|
|
in {
|
2021-11-21 19:07:12 +01:00
|
|
|
options.eboskma.networking = {
|
|
|
|
enable = mkEnableOption "activate networing settings";
|
|
|
|
|
|
|
|
dhcpInterfaces = mkOption {
|
|
|
|
description = "list of interfaces to enable DHCP on";
|
|
|
|
type = types.listOf types.nonEmptyStr;
|
|
|
|
};
|
2021-12-06 09:58:39 +01:00
|
|
|
|
|
|
|
hosts = mkOption {
|
|
|
|
description = "Additional entries to the hosts file";
|
|
|
|
type = types.attrsOf (types.listOf types.str);
|
|
|
|
};
|
2021-11-21 19:07:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf (cfg.enable) {
|
|
|
|
networking = {
|
|
|
|
networkmanager.enable = true;
|
|
|
|
interfaces = listToAttrs (builtins.map
|
2022-03-01 22:19:03 +01:00
|
|
|
(iface: {
|
|
|
|
name = iface;
|
|
|
|
value = {useDHCP = true;};
|
|
|
|
})
|
|
|
|
cfg.dhcpInterfaces);
|
2021-12-06 09:58:39 +01:00
|
|
|
hosts = cfg.hosts;
|
2021-12-10 10:53:40 +01:00
|
|
|
|
|
|
|
firewall = {
|
2022-03-01 22:19:03 +01:00
|
|
|
trustedInterfaces = ["lo"];
|
2021-12-10 10:53:40 +01:00
|
|
|
interfaces = listToAttrs (builtins.map
|
2022-03-01 22:19:03 +01:00
|
|
|
(iface: {
|
|
|
|
name = iface;
|
|
|
|
value = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
# Horus System V2
|
|
|
|
12345
|
|
|
|
5555
|
|
|
|
5556
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
cfg.dhcpInterfaces);
|
2021-12-10 10:53:40 +01:00
|
|
|
};
|
2021-11-21 19:07:12 +01:00
|
|
|
};
|
2022-03-01 22:19:03 +01:00
|
|
|
users.extraUsers.${config.eboskma.var.mainUser}.extraGroups = ["networkmanager"];
|
2021-12-06 09:58:39 +01:00
|
|
|
|
2021-12-10 20:11:36 +01:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
nmap
|
|
|
|
nmap-formatter
|
|
|
|
];
|
|
|
|
|
2021-12-06 09:58:39 +01:00
|
|
|
services.avahi = {
|
|
|
|
enable = true;
|
|
|
|
nssmdns = true;
|
|
|
|
publish = {
|
|
|
|
enable = true;
|
|
|
|
domain = true;
|
2021-12-10 10:53:40 +01:00
|
|
|
userServices = true;
|
2021-12-06 09:58:39 +01:00
|
|
|
};
|
|
|
|
};
|
2021-11-21 19:07:12 +01:00
|
|
|
};
|
|
|
|
}
|