27 lines
879 B
Nix
27 lines
879 B
Nix
{ config, pkgs, lib, ... }:
|
|
let
|
|
# enabledContainers = lib.filterAttrs (name: cfg: cfg.enable) config.syscfg.server.containers;
|
|
# containerImports = {
|
|
# cloud = import ./defs/cloud.nix;
|
|
# authentik = import ./defs/authentik.nix;
|
|
# };
|
|
containerDir = ./defs;
|
|
allFiles = builtins.readDir containerDir;
|
|
enabledNames = lib.filterAttrs (name: cfg: cfg.enable) config.syscfg.server.containers;
|
|
activeContainers = lib.mapAttrs (name: cfg:
|
|
let
|
|
fileName = "${name}.nix";
|
|
in
|
|
if builtins.hasAttr fileName allFiles
|
|
then import (containerDir + "/${fileName}")
|
|
else throw "Container config for '${name}' enabled, but ${containerDir}/${fileName} does not exist!"
|
|
) enabledNames;
|
|
in
|
|
{
|
|
config = lib.mkIf ( enabledNames != {} ) {
|
|
virtualisation.oci-containers = {
|
|
backend = "podman";
|
|
containers = activeContainers;
|
|
};
|
|
};
|
|
} |