Skip to content

Commit

Permalink
nixos/networkd: add LLDP options
Browse files Browse the repository at this point in the history
  • Loading branch information
apfelkuchen6 committed Mar 16, 2023
1 parent ae15b86 commit a7724b8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions nixos/modules/system/boot/networkd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,12 @@ let
(assertInt "VLANId")
(assertRange "VLANId" 0 4094)
];

sectionLLDP = checkUnitConfig "LLDP" [
(assertOnlyFields [
"MUDURL"
])
];
};
};

Expand Down Expand Up @@ -1658,6 +1664,17 @@ let
'';
};

lldpConfig = mkOption {
default = {};
example = { MUDURL = "https://things.example.org/product_abc123/v5"; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionLLDP;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[LLDP]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};

name = mkOption {
type = types.nullOr types.str;
default = null;
Expand Down Expand Up @@ -2077,6 +2094,10 @@ let
[BridgeMDB]
${attrsToSection x.bridgeMDBConfig}
'')
+ optionalString (def.lldpConfig != { }) ''
[LLDP]
${attrsToSection def.lldpConfig}
''
+ def.extraConfig;
};

Expand Down

0 comments on commit a7724b8

Please sign in to comment.