diff --git a/lib/eval-config.nix b/lib/eval-config.nix index 4c3c009..a940497 100644 --- a/lib/eval-config.nix +++ b/lib/eval-config.nix @@ -12,6 +12,7 @@ in "${modulesPath}/hardware.nix" "${modulesPath}/base.nix" "${modulesPath}/busybox.nix" + "${modulesPath}/iproute2.nix" "${modulesPath}/hostname.nix" "${modulesPath}/kernel" "${modulesPath}/s6" diff --git a/modules/all-modules.nix b/modules/all-modules.nix index 98352c1..9afff7d 100644 --- a/modules/all-modules.nix +++ b/modules/all-modules.nix @@ -4,9 +4,10 @@ { imports = [ - ./base.nix + ./base.nix ./bridge ./busybox.nix + ./iproute2.nix ./dhcp6c ./jitter-rng ./dnsmasq diff --git a/modules/iproute2.nix b/modules/iproute2.nix new file mode 100644 index 0000000..2555d44 --- /dev/null +++ b/modules/iproute2.nix @@ -0,0 +1,28 @@ +{ 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; + }; + }; +} diff --git a/overlay.nix b/overlay.nix index b170c24..fda6239 100644 --- a/overlay.nix +++ b/overlay.nix @@ -210,6 +210,10 @@ extraPkgs // { echo "Removing unnecessary binary $out/sbin/$needless_binary" rm "$out/sbin/$needless_binary" done + # No man + rm -rf "$out/share" + # Remove all the data about distributions for tc. + rm -rf "$out/lib" ''; }); # Don't bring ebpf stuff to the table.