add journal merging and ssh

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
2024-05-25 18:29:34 -04:00
parent eba9d9c4cd
commit 23fc7d2667
3 changed files with 43 additions and 10 deletions

View File

@ -6,13 +6,14 @@ rec {
host:
{
ipv4,
machine-id,
server ? false,
}:
genMicroVM host ipv4 "x86_64-linux" (if server then server-config else agent-config)
genMicroVM host ipv4 "x86_64-linux" machine-id (if server then server-config else agent-config)
) vms;
genMicroVM =
hostName: ipv4: _system: vm-config:
hostName: ipv4: _system: machine-id: vm-config:
# microvm refers to microvm.nixosModules
# {
@ -35,6 +36,12 @@ rec {
imports = [ vm-config ];
# It is highly recommended to share the host's nix-store
# with the VMs to prevent building huge images.
environment.etc."machine-id" = {
mode = "0644";
text = machine-id + "\n";
};
microvm.shares = [
{
source = "/nix/store";
@ -42,6 +49,15 @@ rec {
tag = "ro-store";
proto = "virtiofs";
}
{
# On the host
source = "/var/lib/microvms/${hostName}/journal";
# In the MicroVM
mountPoint = "/var/log/journal";
tag = "journal";
proto = "virtiofs";
socket = "journal.sock";
}
];
networking = {
@ -54,6 +70,22 @@ rec {
];
};
services.openssh.enable = true;
users.users.alice = {
openssh.authorizedKeys.keys = [
# photon
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOGcqhLaKsjwAnb6plDavAhEyQHNvFS9Uh5lMTuwMhGF alice@parthenon-7588"
# gh
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoaEmzaS9vANckvBmqrYSHdFR0sPL4Xgeonbh9KcgFe gitlab keypair"
# janus
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfcO9p5opG8Tym6tcLkat6YGCcE6vwg0+V4MTC5WKop alice@parthenon-7588"
# palatine
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP59pDsx34k2ikrKa0eVacj0APSGivaij3lP9L0Zd9au alice@parthenon-7588"
# jeeves
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJDgkUndkfns6f779T5ckHOVhyOKP8GttQ9RfaO9uJdx alice@parthenon-7588"
];
isNormalUser = true;
};
# Any other configuration for your MicroVM
# [...]
};