2017-05-20 21:45:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.lldpd;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
options.services.lldpd = {
|
2022-08-28 20:18:44 +01:00
|
|
|
enable = mkEnableOption (lib.mdDoc "Link Layer Discovery Protocol Daemon");
|
2017-05-20 21:45:48 +01:00
|
|
|
|
|
|
|
extraArgs = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = [ "-c" "-k" "-I eth0" ];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "List of command line parameters for lldpd";
|
2017-05-20 21:45:48 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2018-06-30 00:58:35 +01:00
|
|
|
users.users._lldpd = {
|
2017-05-20 21:45:48 +01:00
|
|
|
description = "lldpd user";
|
|
|
|
group = "_lldpd";
|
2018-12-19 21:40:13 +00:00
|
|
|
home = "/run/lldpd";
|
2018-01-01 13:22:58 +00:00
|
|
|
isSystemUser = true;
|
2017-05-20 21:45:48 +01:00
|
|
|
};
|
2018-06-30 00:58:35 +01:00
|
|
|
users.groups._lldpd = {};
|
2017-05-20 21:45:48 +01:00
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.lldpd ];
|
2017-08-24 18:53:25 +01:00
|
|
|
systemd.packages = [ pkgs.lldpd ];
|
2017-05-20 21:45:48 +01:00
|
|
|
|
|
|
|
systemd.services.lldpd = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2017-08-24 18:53:25 +01:00
|
|
|
environment.LLDPD_OPTIONS = concatStringsSep " " cfg.extraArgs;
|
2017-05-20 21:45:48 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|