nix-config/hosts/odyssey/zonos-container.nix

73 lines
1.7 KiB
Nix

# Auto-generated using compose2nix v0.3.2-pre.
{ pkgs, lib, ... }:
{
hardware.nvidia-container-toolkit.enable = true;
# Runtime
virtualisation.docker = {
enable = true;
# enableNvidia = true;
enableOnBoot = true;
autoPrune.enable = true;
daemon.settings.features.cdi = true;
rootless.enable = true;
rootless.daemon.settings.features.cdi = true;
};
virtualisation.oci-containers.backend = "docker";
# Containers
virtualisation.oci-containers.containers."zonos_container" = {
image = "compose2nix/zonos_container";
environment = {
"GRADIO_SHARE" = "False";
"NVIDIA_VISIBLE_DEVICES" = "0";
};
cmd = [
"python3"
"gradio_interface.py"
];
log-driver = "journald";
extraOptions = [
"--device=nvidia.com/gpu=0"
"--network=host"
];
};
systemd.services."docker-zonos_container" = {
serviceConfig = {
Restart = lib.mkOverride 90 "no";
};
partOf = [
"docker-compose-zonos-root.target"
];
wantedBy = [
"docker-compose-zonos-root.target"
];
};
# Builds
systemd.services."docker-build-zonos_container" = {
path = [
pkgs.docker
pkgs.git
];
serviceConfig = {
Type = "oneshot";
TimeoutSec = 900;
};
script = ''
cd /home/jordan/projects/jordan/Zonos
docker build -t compose2nix/zonos_container .
'';
};
# Root service
# When started, this will automatically create all resources and start
# the containers. When stopped, this will teardown all resources.
systemd.targets."docker-compose-zonos-root" = {
unitConfig = {
Description = "Root target generated by compose2nix.";
};
wantedBy = [ "multi-user.target" ];
};
}