From 4b6fce111a3f26d14809dbba950e315ab66e0d55 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 21 Nov 2022 04:00:54 +0100 Subject: [PATCH] modules/cluster: prepare for leon --- modules/cluster/default.nix | 6 ++++++ modules/cluster/deployment.nix | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/cluster/default.nix b/modules/cluster/default.nix index 8fff0498..8e4e0f18 100644 --- a/modules/cluster/default.nix +++ b/modules/cluster/default.nix @@ -49,6 +49,12 @@ in { uid = 1001; sshKeys = config.users.users.root.openssh.authorizedKeys.keys; }; + users.leon = { + uid = 1002; + sshKeys = with import ../../users.nix; + leon.sshKeys ++ + astro.sshKeys; + }; deploy.customizationModule = ./deployment.nix; storage.glusterfs = { diff --git a/modules/cluster/deployment.nix b/modules/cluster/deployment.nix index 1bb2eccc..abe7ee90 100644 --- a/modules/cluster/deployment.nix +++ b/modules/cluster/deployment.nix @@ -33,6 +33,8 @@ let then s else withoutLeadingSlash s'; + writableStoreOverlayImage = "/var/tmp/${user}-${repo}-${vmName}-overlay.img"; + in { deployment.networks = nets; @@ -42,6 +44,11 @@ in vcpu = config.deployment.vcpu; mem = config.deployment.mem; + preStart = '' + # Discard old writable store overlay + rm -f "${writableStoreOverlayImage}" + ''; + shares = [ { proto = "virtiofs"; tag = "ro-store"; @@ -55,12 +62,12 @@ in source = "/glusterfs/fast/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}"; inherit mountPoint; }) config.deployment.persistedShares; - # volumes = [ { - # image = "/glusterfs/fast/microvms/${user}/${repo}/${vmName}/overlay.img"; - # mountPoint = "/"; - # size = 8 * 1024; - # } ]; - # writableStoreOverlay = "/nix/.rw-store"; + volumes = [ { + image = writableStoreOverlayImage; + mountPoint = config.microvm.writableStoreOverlay; + size = 8 * 1024; + } ]; + writableStoreOverlay = "/nix/.rw-store"; interfaces = map (net: { type = "tap";