|
167 | 167 | services.getty.autologinUser = "root";
|
168 | 168 |
|
169 | 169 | nixpkgs.overlays = [ self.overlay ];
|
170 |
| - microvm.hypervisor = hypervisor; |
171 |
| - # share the host's /nix/store if the hypervisor can do 9p |
172 |
| - microvm.shares = lib.optional (builtins.elem hypervisor hypervisorsWith9p) { |
173 |
| - tag = "ro-store"; |
174 |
| - source = "/nix/store"; |
175 |
| - mountPoint = "/nix/.ro-store"; |
176 |
| - }; |
177 |
| - # microvm.writableStoreOverlay = "/nix/.rw-store"; |
178 |
| - # microvm.volumes = [ { |
179 |
| - # image = "nix-store-overlay.img"; |
180 |
| - # mountPoint = config.microvm.writableStoreOverlay; |
181 |
| - # size = 2048; |
182 |
| - # } ]; |
183 |
| - microvm.interfaces = lib.optional (builtins.elem hypervisor hypervisorsWithUserNet) { |
184 |
| - type = "user"; |
185 |
| - id = "qemu"; |
186 |
| - mac = "02:00:00:01:01:01"; |
187 |
| - }; |
188 |
| - microvm.forwardPorts = lib.optional (hypervisor == "qemu") { |
189 |
| - host.port = 2222; |
190 |
| - guest.port = 22; |
| 170 | + microvm = { |
| 171 | + inherit hypervisor; |
| 172 | + # share the host's /nix/store if the hypervisor can do 9p |
| 173 | + shares = lib.optional (builtins.elem hypervisor hypervisorsWith9p) { |
| 174 | + tag = "ro-store"; |
| 175 | + source = "/nix/store"; |
| 176 | + mountPoint = "/nix/.ro-store"; |
| 177 | + }; |
| 178 | + # writableStoreOverlay = "/nix/.rw-store"; |
| 179 | + # volumes = [ { |
| 180 | + # image = "nix-store-overlay.img"; |
| 181 | + # mountPoint = config.microvm.writableStoreOverlay; |
| 182 | + # size = 2048; |
| 183 | + # } ]; |
| 184 | + interfaces = lib.optional (builtins.elem hypervisor hypervisorsWithUserNet) { |
| 185 | + type = "user"; |
| 186 | + id = "qemu"; |
| 187 | + mac = "02:00:00:01:01:01"; |
| 188 | + }; |
| 189 | + forwardPorts = lib.optional (hypervisor == "qemu") { |
| 190 | + host.port = 2222; |
| 191 | + guest.port = 22; |
| 192 | + }; |
191 | 193 | };
|
192 | 194 | networking.firewall.allowedTCPPorts = lib.optional (hypervisor == "qemu") 22;
|
193 | 195 | services.openssh = lib.optionalAttrs (hypervisor == "qemu") {
|
|
215 | 217 | id = "vm-${builtins.substring 0 4 hypervisor}";
|
216 | 218 | mac = "02:00:00:01:01:0${toString n}";
|
217 | 219 | } ];
|
218 |
| - networking.interfaces.eth0.useDHCP = true; |
219 |
| - networking.firewall.allowedTCPPorts = [ 22 ]; |
| 220 | + networking = { |
| 221 | + interfaces.eth0.useDHCP = true; |
| 222 | + firewall.allowedTCPPorts = [ 22 ]; |
| 223 | + }; |
220 | 224 | services.openssh = {
|
221 | 225 | enable = true;
|
222 | 226 | settings.PermitRootLogin = "yes";
|
|
0 commit comments