diff options
-rw-r--r-- | nixos/doc/manual/release-notes/rl-1809.xml | 5 | ||||
-rw-r--r-- | nixos/modules/config/iproute2.nix | 23 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | pkgs/os-specific/linux/iproute/default.nix | 5 |
4 files changed, 31 insertions, 3 deletions
diff --git a/nixos/doc/manual/release-notes/rl-1809.xml b/nixos/doc/manual/release-notes/rl-1809.xml index fd998b1b3183..0ae630945db2 100644 --- a/nixos/doc/manual/release-notes/rl-1809.xml +++ b/nixos/doc/manual/release-notes/rl-1809.xml @@ -53,7 +53,10 @@ $ nix-instantiate -E '(import <nixpkgsunstable> {}).gitFull' <itemizedlist> <listitem> - <para></para> + <para>When enabled the <literal>iproute2</literal> will copy the files + expected by ip route (e.g., <filename>rt_tables</filename>) in + <filename>/run/iproute2</filename>. This allows to write aliases for + routing tables for instance.</para> </listitem> </itemizedlist> </section> 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} + ''; + }) + ]; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 04881d6db369..5e0c3c369d7b 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -9,6 +9,7 @@ ./config/fonts/ghostscript.nix ./config/gnu.nix ./config/i18n.nix + ./config/iproute2.nix ./config/krb5/default.nix ./config/ldap.nix ./config/networking.nix diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix index 7d412d7e15d0..8ccb0c203803 100644 --- a/pkgs/os-specific/linux/iproute/default.nix +++ b/pkgs/os-specific/linux/iproute/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, lib, flex, bash, bison, db, iptables, pkgconfig }: +{ fetchurl, stdenv, config, lib, flex, bash, bison, db, iptables, pkgconfig }: stdenv.mkDerivation rec { name = "iproute2-${version}"; @@ -26,8 +26,9 @@ stdenv.mkDerivation rec { "HDRDIR=$(TMPDIR)/include/iproute2" # Don't install headers ]; + # enable iproute2 module if you want this folder to be created buildFlags = [ - "CONFDIR=/etc/iproute2" + "CONFDIR=${config.iproute2.confDir or "/run/iproute2"}" ]; installFlags = [ |