11{ config , lib , ... } :
22let
3- inherit ( config . networking ) hostName ;
3+ inherit ( config . networking ) fqdnOrHostName ;
44
55in
66lib . mkIf config . microvm . guest . enable {
@@ -9,7 +9,7 @@ lib.mkIf config.microvm.guest.enable {
99 map ( volumes : {
1010 assertion = builtins . length volumes == 1 ;
1111 message = ''
12- MicroVM ${ hostName } : volume image "${ ( builtins . head volumes ) . image } " is used ${ toString ( builtins . length volumes ) } > 1 times.
12+ MicroVM ${ fqdnOrHostName } : volume image "${ ( builtins . head volumes ) . image } " is used ${ toString ( builtins . length volumes ) } > 1 times.
1313 '' ;
1414 } ) (
1515 builtins . attrValues (
@@ -21,7 +21,7 @@ lib.mkIf config.microvm.guest.enable {
2121 map ( interfaces : {
2222 assertion = builtins . length interfaces == 1 ;
2323 message = ''
24- MicroVM ${ hostName } : interface id "${ ( builtins . head interfaces ) . id } " is used ${ toString ( builtins . length interfaces ) } > 1 times.
24+ MicroVM ${ fqdnOrHostName } : interface id "${ ( builtins . head interfaces ) . id } " is used ${ toString ( builtins . length interfaces ) } > 1 times.
2525 '' ;
2626 } ) (
2727 builtins . attrValues (
@@ -35,14 +35,14 @@ lib.mkIf config.microvm.guest.enable {
3535 then {
3636 assertion = bridge != null ;
3737 message = ''
38- MicroVM ${ hostName } : interface ${ id } is of type "bridge"
38+ MicroVM ${ fqdnOrHostName } : interface ${ id } is of type "bridge"
3939 but doesn't have a bridge to attach to defined.
4040 '' ;
4141 }
4242 else {
4343 assertion = bridge == null ;
4444 message = ''
45- MicroVM ${ hostName } : interface ${ id } is not of type "bridge"
45+ MicroVM ${ fqdnOrHostName } : interface ${ id } is not of type "bridge"
4646 and therefore shouldn't have a "bridge" option defined.
4747 '' ;
4848 }
@@ -52,7 +52,7 @@ lib.mkIf config.microvm.guest.enable {
5252 map ( { id , ... } : {
5353 assertion = builtins . stringLength id <= 15 ;
5454 message = ''
55- MicroVM ${ hostName } : interface name ${ id } is longer than the
55+ MicroVM ${ fqdnOrHostName } : interface name ${ id } is longer than the
5656 the maximum length of 15 characters on Linux.
5757 '' ;
5858 } ) config . microvm . interfaces
@@ -61,7 +61,7 @@ lib.mkIf config.microvm.guest.enable {
6161 map ( shares : {
6262 assertion = builtins . length shares == 1 ;
6363 message = ''
64- MicroVM ${ hostName } : share tag "${ ( builtins . head shares ) . tag } " is used ${ toString ( builtins . length shares ) } > 1 times.
64+ MicroVM ${ fqdnOrHostName } : share tag "${ ( builtins . head shares ) . tag } " is used ${ toString ( builtins . length shares ) } > 1 times.
6565 '' ;
6666 } ) (
6767 builtins . attrValues (
@@ -73,7 +73,7 @@ lib.mkIf config.microvm.guest.enable {
7373 map ( shares : {
7474 assertion = builtins . length shares == 1 ;
7575 message = ''
76- MicroVM ${ hostName } : share socket "${ ( builtins . head shares ) . socket } " is used ${ toString ( builtins . length shares ) } > 1 times.
76+ MicroVM ${ fqdnOrHostName } : share socket "${ ( builtins . head shares ) . socket } " is used ${ toString ( builtins . length shares ) } > 1 times.
7777 '' ;
7878 } ) (
7979 builtins . attrValues (
@@ -88,7 +88,7 @@ lib.mkIf config.microvm.guest.enable {
8888 map ( { tag , socket , ... } : {
8989 assertion = socket != null ;
9090 message = ''
91- MicroVM ${ hostName } : virtiofs share with tag "${ tag } " is missing a `socket` path.
91+ MicroVM ${ fqdnOrHostName } : virtiofs share with tag "${ tag } " is missing a `socket` path.
9292 '' ;
9393 } ) (
9494 builtins . filter ( { proto , ... } : proto == "virtiofs" )
@@ -103,22 +103,22 @@ lib.mkIf config.microvm.guest.enable {
103103 builtins . any ( { type , ... } : type == "user" ) config . microvm . interfaces
104104 ) ;
105105 message = ''
106- MicroVM ${ hostName } : `config.microvm.forwardPorts` works only with qemu and one network interface with `type = "user"`
106+ MicroVM ${ fqdnOrHostName } : `config.microvm.forwardPorts` works only with qemu and one network interface with `type = "user"`
107107 '' ;
108108 } ]
109109 ++
110110 # cloud-hypervisor specific asserts
111111 lib . optionals ( config . microvm . hypervisor == "cloud-hypervisor" ) [ {
112112 assertion = ! ( lib . any ( str : lib . hasInfix "oem_strings" str ) config . microvm . cloud-hypervisor . platformOEMStrings ) ;
113113 message = ''
114- MicroVM ${ hostName } : `config.microvm.cloud-hypervisor.platformOEMStrings` items must not contain `oem_strings`
114+ MicroVM ${ fqdnOrHostName } : `config.microvm.cloud-hypervisor.platformOEMStrings` items must not contain `oem_strings`
115115 '' ;
116116 } ] ;
117117
118118
119119 warnings =
120120 # 32 MB is just an optimistic guess, not based on experience
121121 lib . optional ( config . microvm . mem < 32 ) ''
122- MicroVM ${ hostName } : ${ toString config . microvm . mem } MB of RAM is uncomfortably narrow.
122+ MicroVM ${ fqdnOrHostName } : ${ toString config . microvm . mem } MB of RAM is uncomfortably narrow.
123123 '' ;
124124}
0 commit comments