summaryrefslogtreecommitdiffstats
path: root/modules/hardware/network.nix
blob: 8c54349794357d970b11f758faa7c2f70186c5d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
    config,
    options,
    lib,
    ...
}: let
    networkConfig = config.modules.hardware.network;
    device = config.modules.device;
in {
    options.modules.hardware.network = {
        enable = lib.mkOption {
            type = lib.types.bool;
            default = true;
        };
    };

    config = lib.mkIf (networkConfig.enable) {
        networking = {
            hostName = device.name;
            hostId = builtins.substring 0 8 (
                builtins.hashString "md5" config.networking.hostName
            );
            networkmanager.enable = true;
        };
        user.extraGroups = ["networkmanager"];
    };
}