nixos/home/routing-common: Move mstpd config to separate file
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 17m10s
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 17m10s
This commit is contained in:
parent
0e115544e4
commit
d347234e82
@ -59,27 +59,18 @@ in
|
||||
let
|
||||
inherit (lib) mkIf mkMerge mkForce;
|
||||
inherit (lib.my) networkdAssignment;
|
||||
|
||||
# TODO: Move into nixpkgs
|
||||
mstpd = pkgs.mstpd.overrideAttrs {
|
||||
patches = [ ./mstpd.patch ];
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ (import ./dns.nix index) ];
|
||||
imports = map (m: import m index) [
|
||||
./mstpd.nix
|
||||
./dns.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
environment = {
|
||||
systemPackages = [
|
||||
pkgs.ethtool
|
||||
mstpd
|
||||
systemPackages = with pkgs; [
|
||||
ethtool
|
||||
];
|
||||
etc = {
|
||||
"bridge-stp.conf".text = ''
|
||||
MANAGE_MSTPD=n
|
||||
MSTP_BRIDGES=lan
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
@ -95,43 +86,11 @@ in
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
networkd-dispatcher = {
|
||||
enable = true;
|
||||
rules = {
|
||||
configure-mstpd = {
|
||||
onState = [ "routable" ];
|
||||
script = ''
|
||||
#!${pkgs.runtimeShell}
|
||||
if [ $IFACE = "lan" ]; then
|
||||
${mstpd}/sbin/mstpctl setforcevers $IFACE rstp
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
networkd-dispatcher.enable = true;
|
||||
};
|
||||
|
||||
networking.domain = "h.${pubDomain}";
|
||||
|
||||
systemd = {
|
||||
services = {
|
||||
mstpd = {
|
||||
description = "MSTP daemon";
|
||||
before = [ "network-pre.target" ];
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
ExecStart = "${mstpd}/sbin/bridge-stp restart";
|
||||
ExecReload = "${mstpd}/sbin/bridge-stp restart_config";
|
||||
PIDFile = "/run/mstpd.pid";
|
||||
Restart = "always";
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.network = {
|
||||
wait-online.enable = false;
|
||||
config = {
|
||||
|
53
nixos/boxes/home/routing-common/mstpd.nix
Normal file
53
nixos/boxes/home/routing-common/mstpd.nix
Normal file
@ -0,0 +1,53 @@
|
||||
index: { lib, pkgs, ... }:
|
||||
let
|
||||
# TODO: Move into nixpkgs
|
||||
mstpd = pkgs.mstpd.overrideAttrs {
|
||||
patches = [ ./mstpd.patch ];
|
||||
};
|
||||
in
|
||||
{
|
||||
environment = {
|
||||
systemPackages = [
|
||||
mstpd
|
||||
];
|
||||
etc = {
|
||||
"bridge-stp.conf".text = ''
|
||||
MANAGE_MSTPD=n
|
||||
MSTP_BRIDGES=lan
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
networkd-dispatcher.rules = {
|
||||
configure-mstpd = {
|
||||
onState = [ "routable" ];
|
||||
script = ''
|
||||
#!${pkgs.runtimeShell}
|
||||
if [ $IFACE = "lan" ]; then
|
||||
${mstpd}/sbin/mstpctl setforcevers $IFACE rstp
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services = {
|
||||
mstpd = {
|
||||
description = "MSTP daemon";
|
||||
before = [ "network-pre.target" ];
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
ExecStart = "${mstpd}/sbin/bridge-stp restart";
|
||||
ExecReload = "${mstpd}/sbin/bridge-stp restart_config";
|
||||
PIDFile = "/run/mstpd.pid";
|
||||
Restart = "always";
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user