diff options
author | Matthieu Coudron <mattator@gmail.com> | 2018-05-11 17:42:37 +0900 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2018-05-15 21:55:04 +0900 |
commit | 1e0975f4c05959cf11b5a905f335c269dcaae630 (patch) | |
tree | 22dba45f4228d53c664d7b76cbad0c6f363cf9ee /nixos/modules/config | |
parent | 6db7f92cc2af827e8b8b181bf5ed828a1d0f141d (diff) | |
download | nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.tar nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.tar.gz nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.tar.bz2 nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.tar.lz nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.tar.xz nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.tar.zst nixlib-1e0975f4c05959cf11b5a905f335c269dcaae630.zip |
iproute2: module to create rt_table file & co
When doing source routing/multihoming, it's practical to give names to routing tables. The absence of the rt_table file in /etc make this impossible. This patch recreates these files on rebuild so that they can be modified by the user see NixOS#38638. iproute2 is modified to look into config.networking.iproute2.confDir instead of /etc/iproute2.
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/iproute2.nix | 23 |
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} + ''; + }) + ]; +} |