nixos-config/modules/networking/default.nix

43 lines
993 B
Nix
Raw Normal View History

2021-11-21 19:07:12 +01:00
{ pkgs, config, lib, ... }:
with lib;
let cfg = config.eboskma.networking;
in
{
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
(iface: {
name = iface;
value = { useDHCP = true; };
})
cfg.dhcpInterfaces);
2021-12-06 09:58:39 +01:00
hosts = cfg.hosts;
2021-11-21 19:07:12 +01:00
};
users.extraUsers.${config.eboskma.var.mainUser}.extraGroups = [ "networkmanager" ];
2021-12-06 09:58:39 +01:00
services.avahi = {
enable = true;
nssmdns = true;
publish = {
enable = true;
domain = true;
};
};
2021-11-21 19:07:12 +01:00
};
}