1{ config, lib, pkgs, ... }:
2let
3 cfg = config.services.mstpd;
4in
5with lib;
6{
7 options.services.mstpd = {
8
9 enable = mkOption {
10 default = false;
11 type = types.bool;
12 description = ''
13 Whether to enable the multiple spanning tree protocol daemon.
14 '';
15 };
16
17 };
18
19 config = mkIf cfg.enable {
20 environment.systemPackages = [ pkgs.mstpd ];
21
22 systemd.services.mstpd = {
23 description = "Multiple Spanning Tree Protocol Daemon";
24 wantedBy = [ "network.target" ];
25 unitConfig.ConditionCapability = "CAP_NET_ADMIN";
26 serviceConfig = {
27 Type = "forking";
28 ExecStart = "@${pkgs.mstpd}/bin/mstpd mstpd";
29 PIDFile = "/run/mstpd.pid";
30 };
31 };
32 };
33}