summaryrefslogtreecommitdiff
path: root/os/core/networking.nix
diff options
context:
space:
mode:
Diffstat (limited to 'os/core/networking.nix')
-rw-r--r--os/core/networking.nix64
1 files changed, 44 insertions, 20 deletions
diff --git a/os/core/networking.nix b/os/core/networking.nix
index 0a93cb9..22fc206 100644
--- a/os/core/networking.nix
+++ b/os/core/networking.nix
@@ -8,26 +8,50 @@ let
cfg = config.os.core.network;
in
{
- options.os.core.network.enable = lib.mkEnableOption "system-wide networking setup";
- config = lib.mkIf cfg.enable {
- networking = {
- networkmanager = {
- enable = true;
- wifi = {
- macAddress = "random";
- backend = "iwd";
- };
- ethernet.macAddress = "random";
- dns = "systemd-resolved";
- };
- firewall = {
- enable = true;
- allowedTCPPorts = [ ];
- allowedUDPPorts = [ ];
- };
+ options.os.core.network = {
+ enable = lib.mkEnableOption "system-wide networking setup";
+
+ profile = lib.mkOption {
+ type = lib.types.enum [
+ "client"
+ "server"
+ ];
+ default = "client";
+ description = "Which networking profile configuration to apply";
};
- environment.systemPackages = [ pkgs.impala ];
- services.resolved.enable = true;
- systemd.services."NetworkManager-wait-online".enable = false;
};
+
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ networking.networkmanager = {
+ enable = true;
+ dns = "systemd-resolved";
+ };
+
+ services.resolved.enable = true;
+ }
+
+ (lib.mkIf (cfg.profile == "client") {
+ networking.networkmanager = {
+ wifi.macAddress = "random";
+ wifi.backend = "iwd";
+ ethernet.macAddress = "random";
+ };
+
+ systemd.services."NetworkManager-wait-online".enable = false;
+
+ environment.systemPackages = [
+ pkgs.impala
+ ];
+ })
+
+ (lib.mkIf (cfg.profile == "server") {
+ networking.networkmanager = {
+ wifi.macAddress = "keep";
+ ethernet.macAddress = "keep";
+ };
+ })
+ ]
+ );
}