39 lines
887 B
Nix
39 lines
887 B
Nix
{
|
|
system ? builtins.currentSystem,
|
|
vmPkgsPath,
|
|
buildPkgsPath,
|
|
nixosConfigPath,
|
|
}:
|
|
let
|
|
vmPkgs' = import vmPkgsPath { };
|
|
vmPkgs = vmPkgs' // {
|
|
runtimeShell = "${vmPkgs'.bash}/${vmPkgs'.bash.shellPath}";
|
|
};
|
|
|
|
importWithPkgs = { path, pkgs }: args: import path (args // { inherit pkgs; });
|
|
|
|
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;
|
|
};
|
|
|
|
vmWithBootLoaderConfigMixed =
|
|
(evalConfig {
|
|
modules = [
|
|
nixosConfig
|
|
vmConfig
|
|
{ virtualisation.useBootLoader = true; }
|
|
];
|
|
}).config;
|
|
in
|
|
{
|
|
vmWithBootLoaderMixed = vmWithBootLoaderConfigMixed.system.build.vm;
|
|
}
|