Merge pull request 'Initialize microvm directories' (#93) from microvm-dirs into master
All checks were successful
Check flake syntax / flake-check (push) Successful in 4m34s
All checks were successful
Check flake syntax / flake-check (push) Successful in 4m34s
Reviewed-on: #93
This commit was merged in pull request #93.
This commit is contained in:
@@ -195,8 +195,7 @@ rec {
|
|||||||
|
|
||||||
vmNestedMicroVMOverwrites = host: sopsDummy: {
|
vmNestedMicroVMOverwrites = host: sopsDummy: {
|
||||||
|
|
||||||
services.malobeo.microvm.deployHosts = pkgs.lib.mkForce [];
|
microvm.vms = pkgs.lib.mkForce (
|
||||||
microvm.vms =
|
|
||||||
let
|
let
|
||||||
# Map the values to each hostname to then generate an Attrset using listToAttrs
|
# Map the values to each hostname to then generate an Attrset using listToAttrs
|
||||||
mapperFunc = name: { inherit name; value = {
|
mapperFunc = name: { inherit name; value = {
|
||||||
@@ -216,7 +215,7 @@ rec {
|
|||||||
};
|
};
|
||||||
}; };
|
}; };
|
||||||
in
|
in
|
||||||
builtins.listToAttrs (map mapperFunc self.nixosConfigurations.${host}.config.services.malobeo.microvm.deployHosts);
|
builtins.listToAttrs (map mapperFunc self.nixosConfigurations.${host}.config.services.malobeo.microvm.deployHosts));
|
||||||
};
|
};
|
||||||
|
|
||||||
buildVM = host: networking: sopsDummy: disableDisko: varPath: writableStore: fwdPort: (self.nixosConfigurations.${host}.extendModules {
|
buildVM = host: networking: sopsDummy: disableDisko: varPath: writableStore: fwdPort: (self.nixosConfigurations.${host}.extendModules {
|
||||||
|
|||||||
@@ -102,6 +102,22 @@ in
|
|||||||
/run/current-system/sw/bin/microvm -Ru ${name}
|
/run/current-system/sw/bin/microvm -Ru ${name}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"microvm-init-dirs@${name}" = {
|
||||||
|
description = "Initialize microvm directories";
|
||||||
|
after = [ "zfs-mount.service" ];
|
||||||
|
wantedBy = [ "microvm@${name}.service" ];
|
||||||
|
unitConfig.ConditionPathExists = "!/var/lib/microvms/${name}/.is_initialized";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
mkdir -p /var/lib/microvms/${name}/var
|
||||||
|
mkdir -p /var/lib/microvms/${name}/etc
|
||||||
|
mkdir -p /var/lib/microvms/data/${name}
|
||||||
|
touch /var/lib/microvms/${name}/.is_initialized
|
||||||
|
'';
|
||||||
|
};
|
||||||
}) {} (cfg.deployHosts);
|
}) {} (cfg.deployHosts);
|
||||||
|
|
||||||
systemd.timers = builtins.foldl' (timers: name: timers // {
|
systemd.timers = builtins.foldl' (timers: name: timers // {
|
||||||
|
|||||||
Reference in New Issue
Block a user