2022-04-27 00:21:19 +02:00
|
|
|
{ pkgs
|
|
|
|
, config
|
|
|
|
, lib
|
|
|
|
, ...
|
2022-03-01 22:19:03 +01:00
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.eboskma.networking;
|
2022-04-27 00:21:19 +02:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2022-05-03 18:17:38 +02:00
|
|
|
config = mkIf cfg.enable {
|
2021-11-21 19:07:12 +01:00
|
|
|
networking = {
|
|
|
|
networkmanager.enable = true;
|
|
|
|
interfaces = listToAttrs (builtins.map
|
2022-03-18 21:14:51 +01:00
|
|
|
(iface: {
|
|
|
|
name = iface;
|
2022-04-27 00:21:19 +02:00
|
|
|
value = { useDHCP = true; };
|
2022-03-18 21:14:51 +01:00
|
|
|
})
|
|
|
|
cfg.dhcpInterfaces);
|
2021-12-06 09:58:39 +01:00
|
|
|
hosts = cfg.hosts;
|
2021-12-10 10:53:40 +01:00
|
|
|
|
|
|
|
firewall = {
|
2022-04-27 00:21:19 +02:00
|
|
|
trustedInterfaces = [ "lo" ];
|
2021-12-10 10:53:40 +01:00
|
|
|
interfaces = listToAttrs (builtins.map
|
2022-03-18 21:14:51 +01:00
|
|
|
(iface: {
|
|
|
|
name = iface;
|
|
|
|
value = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
# Horus System V2
|
|
|
|
12345
|
|
|
|
5555
|
|
|
|
5556
|
2022-06-24 08:44:19 +02:00
|
|
|
# Elixir/Phoenix dev environment
|
|
|
|
4000
|
2022-03-18 21:14:51 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
cfg.dhcpInterfaces);
|
2021-12-10 10:53:40 +01:00
|
|
|
};
|
2021-11-21 19:07:12 +01:00
|
|
|
};
|
2022-04-27 00:21:19 +02: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
|
|
|
};
|
|
|
|
}
|