Unverified Commit f53c7758 authored by Atemu's avatar Atemu Committed by GitHub
Browse files

Merge pull request #278454 from litchipi/mealie

mealie: init at 1.2.0
parents c5b820ea aeb79caa
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11023,6 +11023,12 @@
    githubId = 591860;
    name = "Lionello Lunesu";
  };
  litchipi = {
    email = "litchi.pi@proton.me";
    github = "litchipi";
    githubId = 61109829;
    name = "Litchi Pi";
  };
  livnev = {
    email = "lev@liv.nev.org.uk";
    github = "livnev";
+2 −0
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m

- [systemd-lock-handler](https://git.sr.ht/~whynothugo/systemd-lock-handler/), a bridge between logind D-Bus events and systemd targets. Available as [services.systemd-lock-handler.enable](#opt-services.systemd-lock-handler.enable).

- [Mealie](https://nightly.mealie.io/), a self-hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in NuxtJS for a pleasant user experience for the whole family. Available as [services.mealie](#opt-services.mealie.enable)

## Backward Incompatibilities {#sec-release-24.05-incompatibilities}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+1 −0
Original line number Diff line number Diff line
@@ -1323,6 +1323,7 @@
  ./services/web-apps/mastodon.nix
  ./services/web-apps/matomo.nix
  ./services/web-apps/mattermost.nix
  ./services/web-apps/mealie.nix
  ./services/web-apps/mediawiki.nix
  ./services/web-apps/meme-bingo-web.nix
  ./services/web-apps/microbin.nix
+79 −0
Original line number Diff line number Diff line
{ config, lib, pkgs, ...}:
let
  cfg = config.services.mealie;
  pkg = cfg.package;
in
{
  options.services.mealie = {
    enable = lib.mkEnableOption "Mealie, a recipe manager and meal planner";

    package = lib.mkPackageOption pkgs "mealie" { };

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "0.0.0.0";
      description = "Address on which the service should listen.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 9000;
      description = "Port on which to serve the Mealie service.";
    };

    settings = lib.mkOption {
      type = with lib.types; attrsOf anything;
      default = {};
      description = lib.mdDoc ''
        Configuration of the Mealie service.

        See [the mealie documentation](https://nightly.mealie.io/documentation/getting-started/installation/backend-config/) for available options and default values.

        In addition to the official documentation, you can set {env}`MEALIE_LOG_FILE`.
      '';
      example = {
        ALLOW_SIGNUP = "false";
      };
    };

    credentialsFile = lib.mkOption {
      type = with lib.types; nullOr path;
      default = null;
      example = "/run/secrets/mealie-credentials.env";
      description = ''
        File containing credentials used in mealie such as {env}`POSTGRES_PASSWORD`
        or sensitive LDAP options.

        Expects the format of an `EnvironmentFile=`, as described by {manpage}`systemd.exec(5)`.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    systemd.services.mealie = {
      description = "Mealie, a self hosted recipe manager and meal planner";

      after = [ "network-online.target" ];
      wants = [ "network-online.target" ];
      wantedBy = [ "multi-user.target" ];

      environment = {
        PRODUCTION = "true";
        ALEMBIC_CONFIG_FILE="${pkg}/config/alembic.ini";
        API_PORT = toString cfg.port;
        DATA_DIR = "/var/lib/mealie";
        CRF_MODEL_PATH = "/var/lib/mealie/model.crfmodel";
      } // (builtins.mapAttrs (_: val: toString val) cfg.settings);

      serviceConfig = {
        DynamicUser = true;
        User = "mealie";
        ExecStartPre = "${pkg}/libexec/init_db";
        ExecStart = "${lib.getExe pkg} -b ${cfg.listenAddress}:${builtins.toString cfg.port}";
        EnvironmentFile = lib.mkIf (cfg.credentialsFile != null) cfg.credentialsFile;
        StateDirectory = "mealie";
        StandardOutput="journal";
      };
    };
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -516,6 +516,7 @@ in {
  matrix-synapse = handleTest ./matrix/synapse.nix {};
  matrix-synapse-workers = handleTest ./matrix/synapse-workers.nix {};
  mattermost = handleTest ./mattermost.nix {};
  mealie = handleTest ./mealie.nix {};
  mediamtx = handleTest ./mediamtx.nix {};
  mediatomb = handleTest ./mediatomb.nix {};
  mediawiki = handleTest ./mediawiki.nix {};
Loading