infra/nix/tests/buildvmwithbootloader/build-vm.nix

44 lines
949 B
Nix
Raw Normal View History

2023-02-07 18:24:28 +01:00
{
system ? builtins.currentSystem,
vmPkgsPath,
buildPkgsPath,
nixosConfigPath,
}: let
buildPkgs = import buildPkgsPath {};
vmPkgs' = import vmPkgsPath {};
vmPkgs =
vmPkgs'
// {
runtimeShell = "${vmPkgs'.bash}/${vmPkgs'.bash.shellPath}";
};
2018-09-23 14:09:35 +02:00
2023-02-07 18:24:28 +01:00
importWithPkgs = {
path,
pkgs,
}: args:
import path (args // {inherit pkgs;});
2022-10-31 11:04:38 +01:00
nixosConfig = importWithPkgs {
path = "${nixosConfigPath}";
pkgs = vmPkgs;
};
vmConfig = importWithPkgs {
path = "${buildPkgsPath}/nixos/modules/virtualisation/qemu-vm.nix";
pkgs = vmPkgs;
};
evalConfig = importWithPkgs {
path = "${vmPkgsPath}/nixos/lib/eval-config.nix";
pkgs = null;
};
2018-09-23 14:09:35 +02:00
2023-02-07 18:24:28 +01:00
vmWithBootLoaderConfigMixed =
(evalConfig {
modules = [
nixosConfig
vmConfig
{virtualisation.useBootLoader = true;}
];
})
.config;
in {vmWithBootLoaderMixed = vmWithBootLoaderConfigMixed.system.build.vm;}