1e0975f4c0
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.
24 lines
487 B
Nix
24 lines
487 B
Nix
{ 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}
|
|
'';
|
|
})
|
|
];
|
|
}
|