diff --git a/modules/cluster/deployment-options.nix b/modules/cluster/deployment-options.nix index 2d0379ba..0a68d9fe 100644 --- a/modules/cluster/deployment-options.nix +++ b/modules/cluster/deployment-options.nix @@ -42,6 +42,22 @@ Which glusterfs volume to use for persistedShares ''; }; + extraShares = mkOption { + type = with types; listOf (submodule { + options = { + source = mkOption { + type = str; + }; + mountPoint = mkOption { + type = str; + }; + }; + }); + default = []; + description = '' + Extra shares. THESE MUST BE AVAILABLE ON ALL MICROVM HOSTS! + ''; + }; needForSpeed = mkOption { type = types.bool; default = false; diff --git a/modules/cluster/deployment.nix b/modules/cluster/deployment.nix index 6e77fea5..00225480 100644 --- a/modules/cluster/deployment.nix +++ b/modules/cluster/deployment.nix @@ -37,19 +37,30 @@ in rm -f "${writableStoreOverlayImage}" ''; - shares = [ { - proto = "virtiofs"; - tag = "ro-store"; - source = "/nix/store"; - mountPoint = "/nix/.ro-store"; - } ] ++ map (mountPoint: { - proto = "virtiofs"; - tag = builtins.replaceStrings [ "/" ] [ "-" ] ( - withoutLeadingSlash mountPoint - ); - source = "/glusterfs/${config.deployment.storage}/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}"; - inherit mountPoint; - }) config.deployment.persistedShares; + shares = + [ { + proto = "virtiofs"; + tag = "ro-store"; + source = "/nix/store"; + mountPoint = "/nix/.ro-store"; + } ] + ++ + map (mountPoint: { + proto = "virtiofs"; + tag = builtins.replaceStrings [ "/" ] [ "-" ] ( + withoutLeadingSlash mountPoint + ); + source = "/glusterfs/${config.deployment.storage}/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}"; + inherit mountPoint; + }) config.deployment.persistedShares + ++ + map ({ source, mountPoint }: { + proto = "virtiofs"; + tag = builtins.replaceStrings [ "/" ] [ "-" ] ( + withoutLeadingSlash mountPoint + ); + inherit mountPoint source; + }) config.deployment.extraShares; volumes = [ { image = writableStoreOverlayImage; mountPoint = config.microvm.writableStoreOverlay;