# Auto-generated using compose2nix v0.3.1-pre. { pkgs, lib, ... }: { # Runtime virtualisation.podman = { enable = true; autoPrune.enable = true; dockerCompat = true; defaultNetwork.settings = { # Required for container networking to be able to use names. dns_enabled = true; }; }; # Enable container name DNS for non-default Podman networks. # https://github.com/NixOS/nixpkgs/issues/226365 networking.firewall.interfaces."podman+".allowedUDPPorts = [ 53 ]; virtualisation.oci-containers.backend = "podman"; # Containers virtualisation.oci-containers.containers."db" = { image = "postgres:16"; environment = { "APP_DEBUG" = "0"; "APP_ENV" = "prod"; "CORS_ALLOW_ORIGIN" = "^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$"; "DB_DRIVER" = "pdo_pgsql"; "DB_HOST" = "db"; "DB_NAME" = "koillection"; "DB_PASSWORD" = "1840842"; "DB_PORT" = "5432"; "DB_USER" = "koillection"; "DB_VERSION" = "16"; "HTTPS_ENABLED" = "1"; "JWT_PUBLIC_KEY" = "%kernel.project_dir%/config/jwt/public.pem"; "JWT_SECRET_KEY" = "%kernel.project_dir%/config/jwt/private.pem"; "PHP_MEMORY_LIMIT" = "512M"; "PHP_TZ" = "Europe/Paris"; "POSTGRES_DB" = ""; "POSTGRES_PASSWORD" = ""; "POSTGRES_USER" = ""; "UPLOAD_MAX_FILESIZE" = "20M"; }; volumes = [ "/usr/volumes/postgresql:/var/lib/postgresql/data:rw" ]; log-driver = "journald"; extraOptions = [ "--network-alias=db" "--network=docker-compose_default" ]; }; systemd.services."podman-db" = { serviceConfig = { Restart = lib.mkOverride 90 "always"; }; after = [ "podman-network-docker-compose_default.service" ]; requires = [ "podman-network-docker-compose_default.service" ]; partOf = [ "podman-compose-docker-compose-root.target" ]; wantedBy = [ "podman-compose-docker-compose-root.target" ]; }; virtualisation.oci-containers.containers."koillection" = { image = "koillection/koillection"; environment = { "APP_DEBUG" = "0"; "APP_ENV" = "prod"; "CORS_ALLOW_ORIGIN" = "^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$"; "DB_DRIVER" = "pdo_pgsql"; "DB_HOST" = "db"; "DB_NAME" = "koillection"; "DB_PASSWORD" = "1840842"; "DB_PORT" = "5432"; "DB_USER" = "koillection"; "DB_VERSION" = "16"; "HTTPS_ENABLED" = "1"; "JWT_PUBLIC_KEY" = "%kernel.project_dir%/config/jwt/public.pem"; "JWT_SECRET_KEY" = "%kernel.project_dir%/config/jwt/private.pem"; "PHP_MEMORY_LIMIT" = "512M"; "PHP_TZ" = "Europe/Paris"; "UPLOAD_MAX_FILESIZE" = "20M"; }; volumes = [ "/usr/volumes/koillection/uploads:/uploads:rw" ]; ports = [ "5124:80/tcp" ]; dependsOn = [ "db" ]; log-driver = "journald"; extraOptions = [ "--network-alias=koillection" "--network=docker-compose_default" ]; }; systemd.services."podman-koillection" = { serviceConfig = { Restart = lib.mkOverride 90 "always"; }; after = [ "podman-network-docker-compose_default.service" ]; requires = [ "podman-network-docker-compose_default.service" ]; partOf = [ "podman-compose-docker-compose-root.target" ]; wantedBy = [ "podman-compose-docker-compose-root.target" ]; }; virtualisation.oci-containers.containers."homarr" = { image = "ghcr.io/ajnart/homarr:latest"; volumes = [ "/usr/volumes/homarr/configs:/app/data/configs:rw" "/usr/volumes/homarr/data:/data:rw" "/usr/volumes/homarr/icons:/app/public/icons:rw" #"/var/run/docker.sock:/var/run/docker.sock:rw" ]; ports = [ "7575:7575/tcp" ]; log-driver = "journald"; extraOptions = [ "--network-alias=homarr" "--network=docker-compose_default" ]; }; systemd.services."podman-homarr" = { serviceConfig = { Restart = lib.mkOverride 90 "always"; }; after = [ "podman-network-docker-compose_default.service" ]; requires = [ "podman-network-docker-compose_default.service" ]; partOf = [ "podman-compose-docker-compose-root.target" ]; wantedBy = [ "podman-compose-docker-compose-root.target" ]; }; virtualisation.oci-containers.containers."dash" = { image = "mauricenino/dashdot:latest"; volumes = [ "/:/mnt/host:ro" "/mnt:/mnt/host/mnt:ro" "/media:/mnt/host/media:ro" ]; ports = [ "3001:3001/tcp" ]; log-driver = "journald"; extraOptions = [ "--network-alias=dash" "--network=docker-compose_default" "--privileged" ]; }; systemd.services."podman-dash" = { serviceConfig = { Restart = lib.mkOverride 90 "always"; }; after = [ "podman-network-docker-compose_default.service" ]; requires = [ "podman-network-docker-compose_default.service" ]; partOf = [ "podman-compose-docker-compose-root.target" ]; wantedBy = [ "podman-compose-docker-compose-root.target" ]; }; # Networks systemd.services."podman-network-docker-compose_default" = { path = [ pkgs.podman ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; ExecStop = "podman network rm -f docker-compose_default"; }; script = '' podman network inspect docker-compose_default || podman network create docker-compose_default ''; partOf = [ "podman-compose-docker-compose-root.target" ]; wantedBy = [ "podman-compose-docker-compose-root.target" ]; }; # Root service # When started, this will automatically create all resources and start # the containers. When stopped, this will teardown all resources. systemd.targets."podman-compose-docker-compose-root" = { unitConfig = { Description = "Root target generated by compose2nix."; }; wantedBy = [ "multi-user.target" ]; }; }