Skip to content

Commit

Permalink
lib/runner: add macvtap config checks
Browse files Browse the repository at this point in the history
  • Loading branch information
astro committed Oct 13, 2024
1 parent 4d81c41 commit de44c89
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions lib/runner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,21 @@ pkgs.buildPackages.runCommand "microvm-${microvmConfig.hypervisor}-${microvmConf
${lib.concatMapStringsSep " " (interface:
lib.optionalString (
interface.type == "macvtap" &&
interface ? id &&
(interface.macvtap.link or null) != null &&
(interface.macvtap.mode or null) != null
) ''
echo "${builtins.concatStringsSep " " [
interface.id
interface.mac
interface.macvtap.link
(builtins.toString interface.macvtap.mode)
]}" >> $out/share/microvm/macvtap-interfaces
'') microvmConfig.interfaces}
interface ? id
) (
if interface.macvtap.link or null == null
then throw "microvm.interface's macvtap.link must be specified for id=${interface.id}"
else if interface.macvtap.mode or null == null
then throw "microvm.interface's macvtap.mode must be specified for id=${interface.id}"
else ''
echo "${builtins.concatStringsSep " " [
interface.id
interface.mac
interface.macvtap.link
(builtins.toString interface.macvtap.mode)
]}" >> $out/share/microvm/macvtap-interfaces
''
)) microvmConfig.interfaces}
${lib.concatMapStrings ({ tag, socket, source, proto, ... }:
Expand Down

0 comments on commit de44c89

Please sign in to comment.