From c6a6a8a3229688246c89ab781a4e107e26c8107b Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Mon, 23 Sep 2024 20:27:28 +0200 Subject: [PATCH] shinobu/router: Add avahi reflector --- machines/shinobu/services/router/avahi.nix | 15 +++++++++++++++ machines/shinobu/services/router/common.nix | 5 +++++ machines/shinobu/services/router/default.nix | 1 + 3 files changed, 21 insertions(+) create mode 100644 machines/shinobu/services/router/avahi.nix diff --git a/machines/shinobu/services/router/avahi.nix b/machines/shinobu/services/router/avahi.nix new file mode 100644 index 0000000..69dc7dd --- /dev/null +++ b/machines/shinobu/services/router/avahi.nix @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2024 Simon Bruder +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +{ lib, pkgs, ... }: +let + cfg = pkgs.callPackage ./common.nix { }; +in +{ + services.avahi = { + enable = true; + reflector = true; + allowInterfaces = lib.mapAttrsToList (name: _: "br-${name}") (lib.filterAttrs (_: { avahi, ... }: avahi) cfg.vlan); + }; +} diff --git a/machines/shinobu/services/router/common.nix b/machines/shinobu/services/router/common.nix index 119c348..e345443 100644 --- a/machines/shinobu/services/router/common.nix +++ b/machines/shinobu/services/router/common.nix @@ -60,26 +60,31 @@ rec { id = 10; subnet = mkSubnet "10.80.1.0/24" "2001:470:73b9:1::/64"; domain = "lan.shinonome-lab.de"; + avahi = true; }; management = { id = 20; subnet = mkSubnet "10.80.2.0/24" "2001:470:73b9:2::/64"; domain = "management.shinonome-lab.de"; + avahi = false; }; guest = { id = 30; subnet = mkSubnet "10.80.3.0/24" "2001:470:73b9:3::/64"; domain = "guest.shinonome-lab.de"; + avahi = false; }; iot = { id = 40; subnet = mkSubnet "10.80.4.0/24" "2001:470:73b9:4::/64"; domain = "iot.shinonome-lab.de"; + avahi = true; }; printer = { id = 41; subnet = mkSubnet "10.80.5.0/24" "2001:470:73b9:5::/64"; domain = "printer.shinonome-lab.de"; + avahi = true; }; }; tc = { diff --git a/machines/shinobu/services/router/default.nix b/machines/shinobu/services/router/default.nix index aa44a79..f498e45 100644 --- a/machines/shinobu/services/router/default.nix +++ b/machines/shinobu/services/router/default.nix @@ -31,6 +31,7 @@ let in { imports = [ + ./avahi.nix ./dnsmasq.nix ./nft.nix ./tc.nix