Files
nixos-conf/system/services/containerization/mealie-2.nix
autumn 2a85ad21cb
Some checks failed
Test Flake / test_flake (push) Failing after 23s
Test Flake / dry_build (push) Failing after 26s
what
2025-12-19 08:40:24 -07:00

149 lines
4.0 KiB
Nix

# Auto-generated by compose2nix.
{ pkgs, lib, config, ... }:
{
# Containers
virtualisation.oci-containers.containers."mealie" = {
image = "ghcr.io/mealie-recipes/mealie:v3.6.1";
environment = {
"ALLOW_SIGNUP" = "false";
"BASE_URL" = "https://mealie.yourdomain.com";
"DB_ENGINE" = "postgres";
"PGID" = "1000";
"POSTGRES_DB" = "mealie";
"POSTGRES_PASSWORD" = "mealie";
"POSTGRES_PORT" = "5432";
"POSTGRES_SERVER" = "postgres";
"POSTGRES_USER" = "mealie";
"PUID" = "1000";
"TZ" = "America/Denver";
};
volumes = [
"mealie-data:/app/data:rw"
];
ports = [
"9925:9000/tcp"
];
dependsOn = [
"postgres"
];
log-driver = "journald";
extraOptions = [
"--memory=1048576000b"
"--network-alias=mealie"
"--network=mealieio_default"
];
};
systemd.services."podman-mealie" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
after = [
"podman-network-mealieio_default.service"
"podman-volume-mealieio_mealie-data.service"
];
requires = [
"podman-network-mealieio_default.service"
"podman-volume-mealieio_mealie-data.service"
];
partOf = [
"podman-compose-mealieio-root.target"
];
wantedBy = [
"podman-compose-mealieio-root.target"
];
};
virtualisation.oci-containers.containers."postgres" = {
image = "postgres:17";
environment = {
"PGUSER" = "mealie";
"POSTGRES_DB" = "mealie";
"POSTGRES_PASSWORD" = "mealie";
"POSTGRES_USER" = "mealie";
};
volumes = [
"mealie-pgdata:/var/lib/postgresql/data:rw"
];
log-driver = "journald";
extraOptions = [
"--health-cmd=[\"pg_isready\"]"
"--health-interval=30s"
"--health-retries=3"
"--health-timeout=20s"
"--network-alias=postgres"
"--network=mealieio_default"
];
};
systemd.services."podman-postgres" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
after = [
"podman-network-mealieio_default.service"
"podman-volume-mealieio_mealie-pgdata.service"
];
requires = [
"podman-network-mealieio_default.service"
"podman-volume-mealieio_mealie-pgdata.service"
];
partOf = [
"podman-compose-mealieio-root.target"
];
wantedBy = [
"podman-compose-mealieio-root.target"
];
};
# Networks
systemd.services."podman-network-mealieio_default" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "podman network rm -f mealieio_default";
};
script = ''
podman network inspect mealieio_default || podman network create mealieio_default
'';
partOf = [ "podman-compose-mealieio-root.target" ];
wantedBy = [ "podman-compose-mealieio-root.target" ];
};
# Volumes
systemd.services."podman-volume-mealieio_mealie-data" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
script = ''
podman volume inspect mealieio_mealie-data || podman volume create mealieio_mealie-data
'';
partOf = [ "podman-compose-mealieio-root.target" ];
wantedBy = [ "podman-compose-mealieio-root.target" ];
};
systemd.services."podman-volume-mealieio_mealie-pgdata" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
script = ''
podman volume inspect mealieio_mealie-pgdata || podman volume create mealieio_mealie-pgdata
'';
partOf = [ "podman-compose-mealieio-root.target" ];
wantedBy = [ "podman-compose-mealieio-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-mealieio-root" = {
unitConfig = {
Description = "Root target generated by compose2nix.";
};
wantedBy = [ "multi-user.target" ];
};
}