aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/nixos/modules/config/iproute2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/nixos/modules/config/iproute2.nix')
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/iproute2.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/iproute2.nix b/infra/libkookie/nixpkgs/nixos/modules/config/iproute2.nix
new file mode 100644
index 000000000000..a1d9ebcec66b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/iproute2.nix
@@ -0,0 +1,32 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.networking.iproute2;
+in
+{
+ options.networking.iproute2 = {
+ enable = mkEnableOption "copy IP route configuration files";
+ rttablesExtraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Verbatim lines to add to /etc/iproute2/rt_tables
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ environment.etc."iproute2/bpf_pinning" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/bpf_pinning"; };
+ environment.etc."iproute2/ematch_map" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/ematch_map"; };
+ environment.etc."iproute2/group" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/group"; };
+ environment.etc."iproute2/nl_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/nl_protos"; };
+ environment.etc."iproute2/rt_dsfield" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_dsfield"; };
+ environment.etc."iproute2/rt_protos" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_protos"; };
+ environment.etc."iproute2/rt_realms" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_realms"; };
+ environment.etc."iproute2/rt_scopes" = { mode = "0644"; text = fileContents "${pkgs.iproute}/etc/iproute2/rt_scopes"; };
+ environment.etc."iproute2/rt_tables" = { mode = "0644"; text = (fileContents "${pkgs.iproute}/etc/iproute2/rt_tables")
+ + (optionalString (cfg.rttablesExtraConfig != "") "\n\n${cfg.rttablesExtraConfig}"); };
+ };
+}