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