feat: introduce iproute2 module for linkage
Some checks failed
build liminix / build_vm_qemu_mips (push) Has been cancelled
build liminix / test_hostapd (push) Has been cancelled
build liminix / build_zyxel-nwa50ax_mips (push) Has been cancelled
build liminix / test_shell_customization (push) Has been cancelled

In the future, we will make it possible to choose between iproute2 and
busybox more properly.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
Raito Bezarius 2024-12-09 00:43:45 +01:00
parent 0c6d26b4fc
commit 9490822c1a
4 changed files with 35 additions and 1 deletions

View file

@ -12,6 +12,7 @@ in
"${modulesPath}/hardware.nix" "${modulesPath}/hardware.nix"
"${modulesPath}/base.nix" "${modulesPath}/base.nix"
"${modulesPath}/busybox.nix" "${modulesPath}/busybox.nix"
"${modulesPath}/iproute2.nix"
"${modulesPath}/hostname.nix" "${modulesPath}/hostname.nix"
"${modulesPath}/kernel" "${modulesPath}/kernel"
"${modulesPath}/s6" "${modulesPath}/s6"

View file

@ -4,9 +4,10 @@
{ {
imports = [ imports = [
./base.nix ./base.nix
./bridge ./bridge
./busybox.nix ./busybox.nix
./iproute2.nix
./dhcp6c ./dhcp6c
./jitter-rng ./jitter-rng
./dnsmasq ./dnsmasq

28
modules/iproute2.nix Normal file
View file

@ -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;
};
};
}

View file

@ -210,6 +210,10 @@ extraPkgs // {
echo "Removing unnecessary binary $out/sbin/$needless_binary" echo "Removing unnecessary binary $out/sbin/$needless_binary"
rm "$out/sbin/$needless_binary" rm "$out/sbin/$needless_binary"
done 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. # Don't bring ebpf stuff to the table.