integrate VM definitions

This commit is contained in:
Pim Kunis 2024-01-28 11:48:13 +01:00
parent e57f80df82
commit 472175c5a3
6 changed files with 296 additions and 216 deletions

View file

@ -1,7 +1,9 @@
{
jefke = {
name = "jefke";
hostName = "jefke.hyp";
# TODO: directly set and read this from nixos config.
hostName = "jefke";
domain = "hyp";
type = "physical";
nixosModule.lab = {
terraformDatabase.enable = true;
@ -20,8 +22,9 @@
};
atlas = {
name = "atlas";
hostName = "atlas.hyp";
hostName = "atlas";
domain = "hyp";
type = "physical";
nixosModule = { config, ... }:
let inherit (config.lab.networking) dmzServicesIPv4 dmzServicesIPv6; in
@ -49,8 +52,9 @@
};
lewis = {
name = "lewis";
hostName = "lewis.hyp";
hostName = "lewis";
domain = "hyp";
type = "physical";
nixosModule = { pkgs, ... }: {
lab = {
@ -67,35 +71,21 @@
userCert = builtins.readFile ./lewis_user_ed25519-cert.pub;
};
};
};
};
microvm.vms.my-microvm.config = {
services.openssh.enable = true;
networking.firewall.enable = false;
my-microvm = {
hostName = "my-microvm";
domain = "dmz";
type = "virtual";
hypervisorName = "lewis";
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"
];
nixosModule = { pkgs, config, ... }: {
programs.bash.interactiveShellInit = ''
echo "Hello world from inside a virtual machine!" | ${pkgs.lolcat}/bin/lolcat
'';
programs.bash.interactiveShellInit = ''
echo "Hello world from inside a virtual machine!" | ${pkgs.lolcat}/bin/lolcat
'';
microvm = {
shares = [{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}];
interfaces = [{
type = "tap";
id = "vm-my-microvm";
mac = "48:2D:63:E1:C5:39";
}];
};
};
lab.vmMacAddress = "BA:DB:EE:F0:00:00";
};
};
}