2018-05-11 10:42:37 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.networking.iproute2;
|
|
|
|
in
|
|
|
|
{
|
2018-09-01 20:28:23 +02:00
|
|
|
options.networking.iproute2 = {
|
2022-08-28 21:18:44 +02:00
|
|
|
enable = mkEnableOption (lib.mdDoc "copy IP route configuration files");
|
2018-09-01 20:28:23 +02:00
|
|
|
rttablesExtraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
2022-07-28 23:19:15 +02:00
|
|
|
description = lib.mdDoc ''
|
2018-09-01 20:28:23 +02:00
|
|
|
Verbatim lines to add to /etc/iproute2/rt_tables
|
2018-05-11 10:42:37 +02:00
|
|
|
'';
|
2018-09-01 20:28:23 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2021-04-20 10:01:33 +02:00
|
|
|
environment.etc."iproute2/bpf_pinning" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/bpf_pinning"; };
|
|
|
|
environment.etc."iproute2/ematch_map" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/ematch_map"; };
|
|
|
|
environment.etc."iproute2/group" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/group"; };
|
|
|
|
environment.etc."iproute2/nl_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/nl_protos"; };
|
|
|
|
environment.etc."iproute2/rt_dsfield" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_dsfield"; };
|
|
|
|
environment.etc."iproute2/rt_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_protos"; };
|
|
|
|
environment.etc."iproute2/rt_realms" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_realms"; };
|
|
|
|
environment.etc."iproute2/rt_scopes" = { mode = "0644"; text = fileContents "${pkgs.iproute2}/etc/iproute2/rt_scopes"; };
|
|
|
|
environment.etc."iproute2/rt_tables" = { mode = "0644"; text = (fileContents "${pkgs.iproute2}/etc/iproute2/rt_tables")
|
2018-09-01 20:28:23 +02:00
|
|
|
+ (optionalString (cfg.rttablesExtraConfig != "") "\n\n${cfg.rttablesExtraConfig}"); };
|
|
|
|
};
|
2018-05-11 10:42:37 +02:00
|
|
|
}
|