summaryrefslogtreecommitdiffstats
path: root/modules/hardware/network.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/hardware/network.nix')
-rw-r--r--modules/hardware/network.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/hardware/network.nix b/modules/hardware/network.nix
new file mode 100644
index 0000000..8c54349
--- /dev/null
+++ b/modules/hardware/network.nix
@@ -0,0 +1,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"];
+ };
+}