make ssh host keys persistent for VMs

closes #49
This commit is contained in:
Pim Kunis 2024-02-07 22:22:10 +01:00
parent 06c61e2a61
commit 257afae918

View file

@ -42,14 +42,33 @@
config = { config = {
system.stateVersion = hypervisorConfig.system.stateVersion; system.stateVersion = hypervisorConfig.system.stateVersion;
microvm = { services.openssh = {
shares = [{ hostKeys = [{
source = "/nix/store"; path = "/etc/ssh/host_keys/ssh_host_ed25519_key";
mountPoint = "/nix/.ro-store"; type = "ed25519";
tag = "ro-store";
proto = "virtiofs";
}]; }];
extraConfig = ''
HostKey /etc/ssh/host_keys/ssh_host_ed25519_key
'';
};
microvm = {
shares = [
{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}
{
source = "/var/lib/microvms/${config.networking.hostName}/shares/host_keys";
mountPoint = "/etc/ssh/host_keys";
tag = "host_keys";
proto = "virtiofs";
}
];
interfaces = [{ interfaces = [{
type = "tap"; type = "tap";
id = "vm-${config.networking.hostName}"; id = "vm-${config.networking.hostName}";