about summary refs log tree commit diff stats
path: root/system
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-05-14 11:42:28 +0200
committerSoispha <soispha@vhack.eu>2023-05-14 11:42:28 +0200
commitec02b316765c899fe2869e6aa1dac79c05c7a23c (patch)
tree391cb12ff4765a8c99be9ddfc9c32cacc48b1871 /system
parentBuild(flake): Update deps (diff)
downloadnixos-config-ec02b316765c899fe2869e6aa1dac79c05c7a23c.tar.gz
nixos-config-ec02b316765c899fe2869e6aa1dac79c05c7a23c.zip
Feat(system/network): Add a tap device and bridges
Diffstat (limited to '')
-rw-r--r--system/default.nix1
-rw-r--r--system/network/default.nix30
2 files changed, 31 insertions, 0 deletions
diff --git a/system/default.nix b/system/default.nix
index d1eba0b4..b7ff9b1e 100644
--- a/system/default.nix
+++ b/system/default.nix
@@ -7,6 +7,7 @@
     #./impermanence already at flake level imported
     ./libvirtd
     ./locale
+    ./network
     #./nixpkgs already at flake level imported
     ./options
     ./polkit
diff --git a/system/network/default.nix b/system/network/default.nix
new file mode 100644
index 00000000..c93d4e23
--- /dev/null
+++ b/system/network/default.nix
@@ -0,0 +1,30 @@
+# vim: ts=2
+{config, ...}: {
+  systemd.network.netdevs = {
+    "tab0" = {
+      netdevConfig = {
+        Name = "tap0";
+        Kind = "tap";
+      };
+      tapConfig = {
+        User = "${config.users.users.soispha.username}";
+        Group = "libvirt";
+      };
+    };
+    "br0" = {
+      netdevConfig = {
+        Name = "br0";
+        Kind = "bridge";
+      };
+    };
+  };
+  networking.bridges = {
+    br1 = {
+      interfaces = [
+        # TODO don't use hardcoded names
+        "enp4s0"
+        "tap0"
+      ];
+    };
+  };
+}