summaryrefslogtreecommitdiff
path: root/os/core/networking.nix
diff options
context:
space:
mode:
authoradikro <adikro@disroot.org>2026-05-17 01:05:14 +0200
committeradikro <adikro@disroot.org>2026-05-17 01:05:14 +0200
commitdec36d2e9aaca7ca7149a244aa984e97925a3dba (patch)
treebdf3ec35e101beaa4e74c48930dca4341d48ae2c /os/core/networking.nix
parent8bedd672ac49617d2e3a808efe470228cbb0240d (diff)
moved ssh and tailscale to srv, revamped netwroking modules
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";
+ };
+ })
+ ]
+ );
}