New server docker
This commit is contained in:
27
modules/server/containers/default.nix
Normal file
27
modules/server/containers/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user