From a0998bde12f5c899eacfad6eb3d51f7c69924ad9 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 23 May 2020 20:22:25 +0530 Subject: [PATCH] add nixos-module test app --- flake.nix | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 1424782..e19e9cf 100644 --- a/flake.nix +++ b/flake.nix @@ -116,6 +116,12 @@ nixpkgs = nixpkgsFor.${system}; nixpkgsLocal = nixpkgsFor.${localSystem}; packages = self.packages.${system}; + } // { + nixosGuest = { + type = "app"; + program = + "${self.checks.${localSystem}.nixosGuest}/bin/run-nixos-vm"; + }; }); in apps' // { x86_64-linux = apps'.x86_64-linux-x86_64-genode; }; @@ -144,21 +150,37 @@ system = localSystem; modules = [ self.nixosModules.genodeHost - { - genode.guests.flakeCheck = { - config = { config, lib, pkgs, ... }: { - services.sshd.enable = true; - services.nginx.enable = true; - networking.firewall.allowedTCPPorts = [ 80 ]; - users.users.root.password = "nixos"; - services.openssh.permitRootLogin = lib.mkDefault "yes"; - services.mingetty.autologinUser = lib.mkDefault "root"; + ({ modulesPath, ... }: { + imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ]; + boot.loader.grub.extraEntriesBeforeNixOS = true; + virtualisation = { + cores = 2; + memorySize = 1024; + useBootLoader = true; + qemu = { + options = + [ "-machine q35" "-cpu phenom" "-serial mon:stdio" ]; + networkingOptions = [ + "-net nic,netdev=user.0,model=e1000" + "-netdev user,id=user.0\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}" + ]; }; }; - } + genode.guests.flakeCheck = { + config = { config, lib, pkgs, ... }: { + networking.firewall.allowedTCPPorts = [ 80 ]; + services.mingetty.autologinUser = lib.mkDefault "root"; + services.nginx.enable = true; + services.openssh.permitRootLogin = lib.mkDefault "yes"; + services.sshd.enable = true; + users.users.root.password = "nixos"; + virtualbox.memorySize = 128; + }; + }; + }) ]; }; - in nixos.config.system.build.genode.firmware; + in nixos.config.system.build.vm; }); in { x86_64-linux = checks'.x86_64-linux-x86_64-genode; };