yumeami/modules/nixos/virtualization/docker/default.nix

34 lines
862 B
Nix

{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption mkOverride;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.virtualization.docker";
cfg = getAttrByNamespace config base;
nvdaBase = "${namespace}.hardware.nvidia";
nvdaCfg = getAttrByNamespace config nvdaBase;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "docker";
};
config = mkIf cfg.enable {
hardware.nvidia-container-toolkit.enable = nvdaCfg.enable;
virtualisation = {
containers = {
enable = true;
containersConf.settings.containers.label = false;
};
oci-containers.backend = mkOverride 0 "docker";
};
networking.firewall.allowedTCPPorts = [2376];
${namespace}.services.storage.impermanence.folders = ["/var/lib/docker"];
};
}