summary refs log tree commit diff
path: root/nixos/modules/config/iproute2.nix
blob: 881ad671a627596c8b903c8bc1fb493ce96acc9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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}
      '';
    })
  ];
}