Unverified Commit 27885653 authored by Anton Mosich's avatar Anton Mosich
Browse files

mealie: 2.7.1 -> 2.8.0

crfpp has been replaced by ingredient-parser-nlp, so we no longer need
to have it around.
Changelog: https://github.com/mealie-recipes/mealie/releases/tag/v2.8.0
parent 8974da03
Loading
Loading
Loading
Loading
+10 −25
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  callPackage,
  fetchFromGitHub,
  makeWrapper,
  nixosTests,
  python3Packages,
  nltk-data,
  writeShellScript,
  nix-update-script,
}:

let
  version = "2.7.1";
  version = "2.8.0";
  src = fetchFromGitHub {
    owner = "mealie-recipes";
    repo = "mealie";
    tag = "v${version}";
    hash = "sha256-nN8AuSzxHjIDKc8rGN+O2/vlzkH/A5LAr4aoAlOTLlk=";
    hash = "sha256-0LUT7OdYoOZTdR/UXJO2eL2Afo2Y7GjBPIrjWUt205E=";
  };

  frontend = callPackage (import ./mealie-frontend.nix src version) { };

  pythonpkgs = python3Packages;
  python = pythonpkgs.python;

  crfpp = stdenv.mkDerivation {
    pname = "mealie-crfpp";
    version = "unstable-2024-02-12";
    src = fetchFromGitHub {
      owner = "mealie-recipes";
      repo = "crfpp";
      rev = "c56dd9f29469c8a9f34456b8c0d6ae0476110516";
      hash = "sha256-XNps3ZApU8m07bfPEnvip1w+3hLajdn9+L5+IpEaP0c=";
    };

    # Can remove once the `register` keyword is removed from source files
    # Configure overwrites CXXFLAGS so patch it in the Makefile
    postConfigure = lib.optionalString stdenv.cc.isClang ''
      substituteInPlace Makefile \
        --replace-fail "CXXFLAGS = " "CXXFLAGS = -std=c++14 "
    '';
  };
in

pythonpkgs.buildPythonApplication rec {
@@ -69,6 +51,7 @@ pythonpkgs.buildPythonApplication rec {
    gunicorn
    html2text
    httpx
    ingredient-parser-nlp
    itsdangerous
    jinja2
    lxml
@@ -106,7 +89,6 @@ pythonpkgs.buildPythonApplication rec {
        ${lib.getExe pythonpkgs.gunicorn} "$@" -k uvicorn.workers.UvicornWorker mealie.app:app;
      '';
      init_db = writeShellScript "init-mealie-db" ''
        ${python.interpreter} $OUT/${python.sitePackages}/mealie/scripts/install_model.py
        ${python.interpreter} $OUT/${python.sitePackages}/mealie/db/init_db.py
      '';
    in
@@ -116,9 +98,7 @@ pythonpkgs.buildPythonApplication rec {

      makeWrapper ${start_script} $out/bin/mealie \
        --set PYTHONPATH "$out/${python.sitePackages}:${pythonpkgs.makePythonPath dependencies}" \
        --set LD_LIBRARY_PATH "${crfpp}/lib" \
        --set STATIC_FILES "${frontend}" \
        --set PATH "${lib.makeBinPath [ crfpp ]}"
        --set STATIC_FILES "${frontend}"

      makeWrapper ${init_db} $out/libexec/init_db \
        --set PYTHONPATH "$out/${python.sitePackages}:${pythonpkgs.makePythonPath dependencies}" \
@@ -127,6 +107,11 @@ pythonpkgs.buildPythonApplication rec {

  nativeCheckInputs = with pythonpkgs; [ pytestCheckHook ];

  # Needed for tests
  preCheck = ''
    export NLTK_DATA=${nltk-data.averaged_perceptron_tagger_eng}
  '';

  disabledTestPaths = [
    # KeyError: 'alembic_version'
    "tests/unit_tests/services_tests/backup_v2_tests/test_backup_v2.py"