profiles: init (vsock ssh &c.)
This commit is contained in:
parent
12e95630b1
commit
1828835a1d
8 changed files with 228 additions and 0 deletions
47
profiles/uvms-guest.nix
Normal file
47
profiles/uvms-guest.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
options,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./vsock-connect-guest.nix
|
||||
./uvms-users.nix
|
||||
];
|
||||
config = lib.optionalAttrs (options ? microvm) {
|
||||
microvm = {
|
||||
hypervisor = "cloud-hypervisor";
|
||||
volumes = [
|
||||
{
|
||||
image = "swapfile.img";
|
||||
mountPoint = "/var/swapfiles";
|
||||
size = 1024;
|
||||
}
|
||||
];
|
||||
cloud-hypervisor.extraArgs = [
|
||||
"--api-socket=ch.sock"
|
||||
];
|
||||
};
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/swapfiles/swap0";
|
||||
size = 768;
|
||||
}
|
||||
];
|
||||
|
||||
boot.kernelParams = [ "zswap.enabled=1" ];
|
||||
zramSwap.enable = false;
|
||||
|
||||
systemd.services."microvm@".serviceConfig.ExecStartPost =
|
||||
pkgs.writeShellScript "microvm-fix-umask" ''
|
||||
if [[ -e CONNECT.vsock ]] ; then
|
||||
chmod g+r CONNECT.vsock
|
||||
fi
|
||||
'';
|
||||
|
||||
systemd.tmpfiles.settings."10-muvm" = {
|
||||
"/var/lib/microvms/*/CONNECT.sock".z.mode = "660";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue