copy microvm config

This commit is contained in:
Pim Kunis 2024-01-17 21:28:15 +01:00
parent dc2fe94c28
commit 390cc30173
4 changed files with 124 additions and 10 deletions

View file

@ -52,18 +52,49 @@
name = "lewis";
hostName = "lewis.hyp";
nixosModule.lab = {
dataHost.enable = true;
nixosModule = { pkgs, ... }: {
lab = {
dataHost.enable = true;
storage = {
osDisk = "/dev/sda";
dataPartition = "/dev/nvme0n1p1";
storage = {
osDisk = "/dev/sda";
dataPartition = "/dev/nvme0n1p1";
};
ssh = {
useCertificates = true;
hostCert = builtins.readFile ./lewis_host_ed25519-cert.pub;
userCert = builtins.readFile ./lewis_user_ed25519-cert.pub;
};
};
ssh = {
useCertificates = true;
hostCert = builtins.readFile ./lewis_host_ed25519-cert.pub;
userCert = builtins.readFile ./lewis_user_ed25519-cert.pub;
microvm.vms.my-microvm.config = {
services.openssh.enable = true;
networking.firewall.enable = false;
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"
];
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";
}];
};
};
};
};

View file

@ -153,6 +153,11 @@ in {
++ lib.lists.optional (cfg.staticDMZIPv6Address != "") cfg.staticDMZIPv6Address;
};
};
"40-vms" = {
matchConfig.Name = "vm-*";
networkConfig.Bridge = cfg.dmzBridgeName;
};
};
};
};