From 7cc0a882dbc972504b8f3da942f74bfeccead374 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Tue, 2 Jul 2024 10:40:19 -0500 Subject: [PATCH] mealie --- hosts/nas/configuration.nix | 5 +++ modules/apps/mealie/default.nix | 33 ++++++++++++++++++ modules/apps/mealie/options.nix | 62 +++++++++++++++++++++++++++++++++ modules/default.nix | 1 + 4 files changed, 101 insertions(+) create mode 100644 modules/apps/mealie/default.nix create mode 100644 modules/apps/mealie/options.nix diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index b2db60c..5cd4c3e 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -62,6 +62,11 @@ in mariadb.enable = true; + mealie = { + enable = true; + baseUrl = "https://mealie.mjallen.dev" + } + nextcloud = { enable = true; httpPort = "9980"; diff --git a/modules/apps/mealie/default.nix b/modules/apps/mealie/default.nix new file mode 100644 index 0000000..36c3f70 --- /dev/null +++ b/modules/apps/mealie/default.nix @@ -0,0 +1,33 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +let + cfg = config.nas-apps.mealie; +in +{ + imports = [ ./options.nix ]; + + config = mkIf cfg.enable { + virtualisation.oci-containers.containers."${cfg.name}" = { + autoStart = cfg.autoStart; + image = cfg.image; + ports = [ "${cfg.port}:9000" ]; + volumes = [ + "${cfg.dataPath}:/app/data" + ]; + environment = { + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; + ALLOW_SIGNUP = cfg.allowSignup; + MAX_WORKERS = cfg.maxWorkers; + MAX_CONCURRENCY = cfg.maxConcurrency; + BASE_URL = cfg.baseUrl; + }; + }; + }; +} diff --git a/modules/apps/mealie/options.nix b/modules/apps/mealie/options.nix new file mode 100644 index 0000000..b7da63c --- /dev/null +++ b/modules/apps/mealie/options.nix @@ -0,0 +1,62 @@ +{ lib, ... }: +with lib; +{ + options.nas-apps.mealie = { + enable = mkEnableOption "mealie docker service"; + + autoStart = mkOption { + type = types.bool; + default = true; + }; + + port = mkOption { + type = types.str; + default = "9000"; + }; + + name = mkOption { + type = types.str; + default = "mealie"; + }; + + image = mkOption { + type = types.str; + default = "ghcr.io/mealie-recipes/mealie"; + }; + + dataPath = mkOption { + type = types.str; + default = "/media/nas/ssd/nix-app-data/mealie"; + }; + + puid = mkOption { + type = types.str; + default = "911"; + }; + + pgid = mkOption { + type = types.str; + default = "1000"; + }; + + timeZone = mkOption { + type = types.str; + default = "America/Chicago"; + }; + + maxWorkers = mkOption { + type = types.str; + default = "1"; + }; + + maxConcurrency = mkOption { + type = types.str; + default = "1"; + }; + + baseUrl = mkOption { + type = types.str; + default = ""; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 8a09f52..1561564 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -11,6 +11,7 @@ ./apps/jellyfin ./apps/jellyseerr ./apps/mariadb + ./apps/mealie ./apps/nextcloud ./apps/ollama ./apps/open-webui