29 lines
616 B
Nix
29 lines
616 B
Nix
|
{ config, pkgs, lib, ... }:
|
||
|
let
|
||
|
inherit (lib) mkEnableOption mkPackageOption mkIf genAttrs;
|
||
|
inherit (pkgs.pseudofile) dir symlink;
|
||
|
cfg = config.programs.iproute2;
|
||
|
minimalPrograms = [
|
||
|
"ip"
|
||
|
"devlink"
|
||
|
"ss"
|
||
|
"bridge"
|
||
|
"genl"
|
||
|
"ifstat"
|
||
|
"nstat"
|
||
|
];
|
||
|
links = genAttrs minimalPrograms (p: symlink "${cfg.package}/bin/${p}");
|
||
|
in
|
||
|
{
|
||
|
options.programs.iproute2 = {
|
||
|
enable = mkEnableOption "the iproute2 programs instead of busybox variants";
|
||
|
package = mkPackageOption pkgs "iproute2" { };
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
filesystem = dir {
|
||
|
bin = dir links;
|
||
|
};
|
||
|
};
|
||
|
}
|