Add a script to launch the robot vm.
This commit is contained in:
@@ -126,12 +126,62 @@
|
||||
packages = (
|
||||
forAllSystems (
|
||||
system:
|
||||
(builtins.mapAttrs (hostname: nodeConfig: {
|
||||
iso = (nixosConfigs."${hostname}" "iso").config.system.build.isoImage;
|
||||
vm_iso = (nixosConfigs."${hostname}" "vm_iso").config.system.build.isoImage;
|
||||
sd = (nixosConfigs."${hostname}" "sd").config.system.build.sdImage;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes))
|
||||
(
|
||||
(builtins.mapAttrs (hostname: nodeConfig: {
|
||||
iso = (nixosConfigs."${hostname}" "iso").config.system.build.isoImage;
|
||||
vm_iso = (nixosConfigs."${hostname}" "vm_iso").config.system.build.isoImage;
|
||||
sd = (nixosConfigs."${hostname}" "sd").config.system.build.sdImage;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes))
|
||||
// {
|
||||
launch_robot =
|
||||
let
|
||||
pkgs = (nixosConfigs."robot" "vm_iso").pkgs;
|
||||
patchScriptBin =
|
||||
filename: contents:
|
||||
((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
}));
|
||||
launch_robot_script = (
|
||||
patchScriptBin "launch_robot" (
|
||||
builtins.readFile (
|
||||
pkgs.replaceVars ./files/robot/launch_robot.bash (
|
||||
let
|
||||
robot_image_package = (nixosConfigs."robot" "vm_iso").config.system.build.isoImage;
|
||||
robot_image = "${robot_image_package}/iso/${robot_image_package.isoName}";
|
||||
in
|
||||
{
|
||||
"OVMFfd" = "${pkgs.OVMF.fd}";
|
||||
"mountiso" = robot_image;
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
launch_robot_script_wrapped =
|
||||
(pkgs.writeScriptBin "launch_robot" ''
|
||||
#!/usr/bin/env bash
|
||||
export "PATH=${
|
||||
pkgs.lib.makeBinPath (
|
||||
with pkgs;
|
||||
[
|
||||
qemu
|
||||
]
|
||||
)
|
||||
}:''${PATH}"
|
||||
exec ${launch_robot_script}/bin/launch_robot "''${@}"
|
||||
'').overrideAttrs
|
||||
(old: {
|
||||
buildCommand = ''
|
||||
${old.buildCommand}
|
||||
patchShebangs $out
|
||||
'';
|
||||
});
|
||||
|
||||
in
|
||||
launch_robot_script_wrapped;
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user