From 472227ca1c0aae214fde7fa434ba66313722befb Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 7 Dec 2024 22:52:26 +0100 Subject: [PATCH] nixos-modules/host/options: retire microvm.host.tapScript --- doc/src/interfaces.md | 8 ++++++++ lib/runner.nix | 2 +- nixos-modules/host/options.nix | 23 ----------------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/doc/src/interfaces.md b/doc/src/interfaces.md index c8962f73..9c494abd 100644 --- a/doc/src/interfaces.md +++ b/doc/src/interfaces.md @@ -45,6 +45,14 @@ with more than one CPU core. When running MicroVMs through the `host` module, the tap network interfaces are created through a systemd service dependency. +Extend the generated script in the guest configuration like this: + +```nix +microvm.binScripts.tap-up = lib.mkAfter '' + ${lib.getExe' pkgs.iproute2 "ip"} link set dev 'vm-ixp-as11201p' master 'ixp-peering' +''; +``` + ## `type = "macvtap"` *MACVTAP* interfaces attach to a host's physical network interface, diff --git a/lib/runner.nix b/lib/runner.nix index 24a928f7..9d13fefd 100644 --- a/lib/runner.nix +++ b/lib/runner.nix @@ -6,7 +6,7 @@ let inherit (pkgs) lib; - inherit (microvmConfig) hostName virtiofsdScripts tapScripts macvtapScripts; + inherit (microvmConfig) hostName virtiofsdScripts; inherit (import ./. { inherit lib; }) createVolumesScript makeMacvtap; inherit (makeMacvtap { diff --git a/nixos-modules/host/options.nix b/nixos-modules/host/options.nix index 2fc98a25..cbbe5b10 100644 --- a/nixos-modules/host/options.nix +++ b/nixos-modules/host/options.nix @@ -22,29 +22,6 @@ ''; }; - host.tapScript = mkOption { - description = '' - Commands to run after creating a tap interface - - Defaults to bring the interface up. - - If you do not want the interface to be automatically created - at all, just set - `systemd.services."microvm-tap-interfaces@%i.service".enable = false` - ''; - example = lib.literalExpression '' - # Attach tap interface to bridge br0, and bring it up - "${pkgs.iproute2}/bin/ip link set \"$id\" master br0 up" - ''; - type = types.lines; - default = '' - ${pkgs.iproute2}/bin/ip link set "$id" up - ''; - defaultText = '' - ${pkgs.iproute2}/bin/ip link set "$id" up - ''; - }; - vms = mkOption { type = with types; attrsOf (submodule ({ config, name, ... }: { options = {