summary refs log tree commit diff
path: root/nixos/modules/config/iproute2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/config/iproute2.nix')
-rw-r--r--nixos/modules/config/iproute2.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/modules/config/iproute2.nix b/nixos/modules/config/iproute2.nix
new file mode 100644
index 000000000000..881ad671a627
--- /dev/null
+++ b/nixos/modules/config/iproute2.nix
@@ -0,0 +1,23 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.networking.iproute2;
+  confDir = "/run/iproute2";
+in
+{
+  options.networking.iproute2.enable = mkEnableOption "copy IP route configuration files";
+
+  config = mkMerge [
+    ({ nixpkgs.config.iproute2.confDir = confDir; })
+
+    (mkIf cfg.enable {
+      system.activationScripts.iproute2 = ''
+        cp -R ${pkgs.iproute}/etc/iproute2 ${confDir}
+        chmod -R 664 ${confDir}
+        chmod +x ${confDir}
+      '';
+    })
+  ];
+}