Skip to content

Commit 5e193f2

Browse files
Merge pull request microvm-nix#390 from SuperSandro2000/deadnix
Fix deadnix
2 parents 80bddbd + 2ac68d2 commit 5e193f2

File tree

11 files changed

+54
-51
lines changed

11 files changed

+54
-51
lines changed

checks/shutdown-command.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ self, nixpkgs, system, makeTestConfigs }:
1+
{ nixpkgs, system, makeTestConfigs, ... }:
22

33
let
44
pkgs = nixpkgs.legacyPackages.${system};

checks/startup-shutdown.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ self, nixpkgs, system, makeTestConfigs }:
1+
{ nixpkgs, system, makeTestConfigs, ... }:
22

33
let
44
pkgs = nixpkgs.legacyPackages.${system};

examples/graphics.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ nixpkgs.lib.nixosSystem {
1010
# this runs as a MicroVM
1111
self.nixosModules.microvm
1212

13-
({ config, lib, pkgs, ... }: {
13+
({ lib, pkgs, ... }: {
1414
microvm = {
1515
hypervisor = "cloud-hypervisor";
1616
graphics.enable = true;

examples/microvms-host.nix

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ nixpkgs.lib.nixosSystem {
1010
# this runs as a MicroVM that nests MicroVMs
1111
self.nixosModules.microvm
1212

13-
({ config, lib, pkgs, ... }:
13+
({ config, lib, ... }:
1414
let
1515
inherit (self.lib) hypervisors;
1616

@@ -123,18 +123,19 @@ nixpkgs.lib.nixosSystem {
123123
networkConfig.Bridge = "virbr0";
124124
};
125125
};
126-
# Allow DHCP server
127-
networking.firewall.allowedUDPPorts = [ 67 ];
128-
# Allow Internet access
129-
networking.nat = {
130-
enable = true;
131-
enableIPv6 = true;
132-
internalInterfaces = [ "virbr0" ];
126+
networking = {
127+
extraHosts = lib.concatMapStrings (hypervisor: ''
128+
${hypervisorIPv4Addrs.${hypervisor}} ${hypervisor}
129+
'') hypervisors;
130+
# Allow DHCP server
131+
firewall.allowedUDPPorts = [ 67 ];
132+
# Allow Internet access
133+
nat = {
134+
enable = true;
135+
enableIPv6 = true;
136+
internalInterfaces = [ "virbr0" ];
137+
};
133138
};
134-
135-
networking.extraHosts = lib.concatMapStrings (hypervisor: ''
136-
${hypervisorIPv4Addrs.${hypervisor}} ${hypervisor}
137-
'') hypervisors;
138139
})
139140
];
140141
}

examples/qemu-vnc.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ nixpkgs.lib.nixosSystem {
1616
# this runs as a MicroVM
1717
self.nixosModules.microvm
1818

19-
({ config, lib, pkgs, ... }: {
19+
({ lib, pkgs, ... }: {
2020
microvm = {
2121
hypervisor = "qemu";
2222
graphics.enable = true;

flake.nix

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
lib = import ./lib { inherit (nixpkgs) lib; };
131131

132132
overlay = final: super: {
133-
cloud-hypervisor-graphics = import "${spectrum}/pkgs/cloud-hypervisor" { inherit final super; };
133+
cloud-hypervisor-graphics = import "${spectrum}/pkgs/cloud-hypervisor" { inherit final super; };
134134
};
135135
overlays.default = self.overlay;
136136

@@ -160,34 +160,36 @@
160160
inherit system;
161161
modules = [
162162
self.nixosModules.microvm
163-
({ config, lib, ... }: {
163+
({ lib, ... }: {
164164
system.stateVersion = lib.trivial.release;
165165

166166
networking.hostName = "${hypervisor}-microvm";
167167
services.getty.autologinUser = "root";
168168

169169
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+
};
191193
};
192194
networking.firewall.allowedTCPPorts = lib.optional (hypervisor == "qemu") 22;
193195
services.openssh = lib.optionalAttrs (hypervisor == "qemu") {
@@ -209,14 +211,16 @@
209211
nixpkgs.lib.optionalAttrs (builtins.elem hypervisor self.lib.hypervisorsWithNetwork) {
210212
"${system}-${hypervisor}-example-with-tap" = makeExample {
211213
inherit system hypervisor;
212-
config = { lib, ...}: {
214+
config = _: {
213215
microvm.interfaces = [ {
214216
type = "tap";
215217
id = "vm-${builtins.substring 0 4 hypervisor}";
216218
mac = "02:00:00:01:01:0${toString n}";
217219
} ];
218-
networking.interfaces.eth0.useDHCP = true;
219-
networking.firewall.allowedTCPPorts = [ 22 ];
220+
networking = {
221+
interfaces.eth0.useDHCP = true;
222+
firewall.allowedTCPPorts = [ 22 ];
223+
};
220224
services.openssh = {
221225
enable = true;
222226
settings.PermitRootLogin = "yes";

lib/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rec {
1414

1515
defaultFsType = "ext4";
1616

17-
withDriveLetters = { volumes, hypervisor, storeOnDisk, ... }:
17+
withDriveLetters = { volumes, storeOnDisk, ... }:
1818
let
1919
offset =
2020
if storeOnDisk

lib/runners/stratovirt.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ in {
124124
}"
125125
]) (enumerate 0 volumes) ++
126126
lib.optionals (shares != []) (
127-
builtins.concatMap ({ proto, index, socket, source, tag, ... }: {
127+
builtins.concatMap ({ proto, index, socket, tag, ... }: {
128128
"virtiofs" = [
129129
"-chardev"
130130
"socket,id=fs${toString index},path=${socket}"

nixos-modules/microvm/graphics.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
let
44
# TODO: did not get sommelier to work
5-
run-sommelier = with pkgs; writeShellScriptBin "run-sommelier" ''
6-
exec ${lib.getExe sommelier} --virtgpu-channel -- $@
7-
'';
5+
# run-sommelier = with pkgs; writeShellScriptBin "run-sommelier" ''
6+
# exec ${lib.getExe sommelier} --virtgpu-channel -- $@
7+
# '';
88
# Working: run Wayland applications prefixed with `run-wayland-proxy`
99
run-wayland-proxy = with pkgs; writeShellScriptBin "run-wayland-proxy" ''
1010
exec ${lib.getExe wayland-proxy-virtwl} --virtio-gpu -- $@
@@ -17,7 +17,7 @@ in
1717
lib.mkIf config.microvm.graphics.enable {
1818
boot.kernelModules = [ "drm" "virtio_gpu" ];
1919

20-
environment.systemPackages = with pkgs; [
20+
environment.systemPackages = [
2121
#run-sommelier
2222
run-wayland-proxy
2323
run-waypipe

nixos-modules/microvm/store-disk.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ let
55
rootPaths = [ config.system.build.toplevel ];
66
};
77

8-
kernelAtLeast = lib.versionAtLeast config.boot.kernelPackages.kernel.version;
9-
108
erofs-utils =
119
# Are any extended options specified?
1210
if lib.any (with lib; flip elem ["-Ededupe" "-Efragments"]) config.microvm.storeDiskErofsFlags

0 commit comments

Comments
 (0)