nixos-config/modules/networking/default.nix
2021-11-21 19:07:12 +01:00

27 lines
677 B
Nix

{ 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" ];
};
}