nixos-config/modules/networking/default.nix

28 lines
677 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;
};
};
config = mkIf (cfg.enable) {
networking = {
networkmanager.enable = true;
interfaces = listToAttrs (builtins.map
(iface: {
name = iface;
value = { useDHCP = true; };
})
cfg.dhcpInterfaces);
};
users.extraUsers.${config.eboskma.var.mainUser}.extraGroups = [ "networkmanager" ];
};
}