File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 160
160
fi
161
161
162
162
${ pkgs . iproute2 } /bin/ip tuntap add name $id mode tap user ${ user } $TAP_FLAGS
163
- ${ pkgs . iproute2 } /bin/ip link set $id up
163
+ ${ config . microvm . host . tapScript }
164
164
done
165
165
'' ;
166
166
} ;
342
342
wants = map ( name : "microvm@${ name } .service" ) config . microvm . autostart ;
343
343
} ;
344
344
345
+ microvm . host . tapScript = lib . mkDefault ''
346
+ ${ pkgs . iproute2 } /bin/ip link set $id up
347
+ '' ;
348
+
345
349
# This helper creates tap interfaces and attaches them to a bridge
346
350
# for qemu regardless if it is run as root or not.
347
351
security . wrappers . qemu-bridge-helper = lib . mkIf ( ! config . virtualisation . libvirtd . enable ) {
Original file line number Diff line number Diff line change 21
21
'' ;
22
22
} ;
23
23
24
+ host . tapScript = mkOption {
25
+ description = ''
26
+ Commands to run after creating a tap interface
27
+
28
+ Defaults to bring the interface up.
29
+
30
+ If you do not want the interface to be automatically created
31
+ at all, just set
32
+ `systemd.services."microvm-tap-interfaces@%i.service".enable = false`
33
+ '' ;
34
+ example = ''
35
+ # Attach tap interface to bridge br0, and set it up
36
+ '' ${pkgs.iproute2}/bin/ip link set $id master br0 up
37
+ '' ;
38
+ type = types . lines ;
39
+ } ;
40
+
24
41
vms = mkOption {
25
42
type = with types ; attrsOf ( submodule ( { config , name , ... } : {
26
43
options = {
You can’t perform that action at this time.
0 commit comments