59 lines
1.3 KiB
Nix
59 lines
1.3 KiB
Nix
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
|
|
#
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
{ config, lib, ... }:
|
|
let
|
|
inherit (lib)
|
|
concatMapStringsSep
|
|
mkOption
|
|
;
|
|
inherit (lib.types)
|
|
str
|
|
listOf
|
|
submodule
|
|
;
|
|
in
|
|
{
|
|
options = {
|
|
routing-options.static.route = mkOption {
|
|
type = listOf (submodule {
|
|
options = {
|
|
destination = mkOption {
|
|
type = str;
|
|
description = ''
|
|
Destination network.
|
|
'';
|
|
};
|
|
next-hop = mkOption {
|
|
type = str;
|
|
description = ''
|
|
Gateway for this network.
|
|
'';
|
|
};
|
|
};
|
|
});
|
|
default = [ ];
|
|
description = ''
|
|
Static routes.
|
|
'';
|
|
};
|
|
netconf.xmls.routing-options = mkOption {
|
|
type = str;
|
|
readOnly = true;
|
|
visible = false;
|
|
};
|
|
};
|
|
config.netconf.xmls.routing-options = ''
|
|
<routing-options operation="replace">
|
|
<static>
|
|
${concatMapStringsSep "\n" (route: ''
|
|
<route>
|
|
<name>${route.destination}</name>
|
|
<next-hop>${route.next-hop}</next-hop>
|
|
</route>
|
|
'') config.routing-options.static.route}
|
|
</static>
|
|
</routing-options>
|
|
'';
|
|
}
|