fix: create container directories if not existent

This commit is contained in:
Patrick Großmann 2023-12-03 19:52:26 +01:00
parent 8f55b769fe
commit ad2efa8c9f
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F

View file

@ -7,6 +7,9 @@
}: let
inherit
(lib)
mapAttrs'
concatStrings
nameValuePair
mapAttrsToList
flip
types
@ -47,6 +50,15 @@ in {
}
));
};
config.system.activationScripts = let
mkDir = paths: (concatStrings (flip map paths (path: ''
[[ -d "${path}" ]] || ${pkgs.coreutils}/bin/mkdir -p "${path}"
'')));
in
flip mapAttrs' config.containers (
name: value:
nameValuePair "mkContainerFolder-${name}" (mkDir (mapAttrsToList (_: x: x.hostPath) value.bindMounts))
);
config.disko = mkMerge (flip mapAttrsToList config.containers
(
_: cfg: {