mealie: 2.7.1 -> 2.8.0 (#392158)

This commit is contained in:
Bruno BELANYI
2025-04-13 19:59:31 +01:00
committed by GitHub
5 changed files with 76 additions and 26 deletions

View File

@@ -65,7 +65,7 @@ in
API_PORT = toString cfg.port;
BASE_URL = "http://localhost:${toString cfg.port}";
DATA_DIR = "/var/lib/mealie";
CRF_MODEL_PATH = "/var/lib/mealie/model.crfmodel";
NLTK_DATA = pkgs.nltk-data.averaged_perceptron_tagger_eng;
} // (builtins.mapAttrs (_: val: toString val) cfg.settings);
serviceConfig = {

View File

@@ -1,46 +1,28 @@
{
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"

View File

@@ -0,0 +1,58 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
nix-update-script,
setuptools,
nltk,
python-crfsuite,
pint,
floret,
pytestCheckHook,
nltk-data,
}:
buildPythonPackage rec {
pname = "ingredient-parser-nlp";
version = "2.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "strangetom";
repo = "ingredient-parser";
tag = version;
hash = "sha256-i14RKBcvU56pDNGxNVBvvpQ65FCbitMIfvN5eLLJCWU=";
};
build-system = [ setuptools ];
dependencies = [
nltk
python-crfsuite
pint
floret
];
nativeCheckInputs = [
pytestCheckHook
];
pythonImportsCheck = [
"ingredient_parser"
];
# Needed for tests
preCheck = ''
export NLTK_DATA=${nltk-data.averaged_perceptron_tagger_eng}
'';
meta = {
description = "Parse structured information from recipe ingredient sentences";
license = lib.licenses.mit;
homepage = "https://github.com/strangetom/ingredient-parser/";
changelog = "https://github.com/strangetom/ingredient-parser/releases/tag/${version}";
maintainers = with lib.maintainers; [ antonmosich ];
};
}

View File

@@ -67,6 +67,11 @@ lib.makeScope newScope (self: {
location = "taggers";
hash = "sha256-tl3Cn2okhBkUtTXvAmFRx72Brez6iTGRdmFTwFmpk3M=";
};
averaged_perceptron_tagger_eng = makeNltkDataPackage {
pname = "averaged_perceptron_tagger_eng";
location = "taggers";
hash = "sha256-tl3Cn2okhBkUtTXvAmFRx72Brez6iTGRdmFTwFmpk3M=";
};
snowball_data = makeNltkDataPackage {
pname = "snowball_data";
location = "stemmers";

View File

@@ -6669,6 +6669,8 @@ self: super: with self; {
inform = callPackage ../development/python-modules/inform { };
ingredient-parser-nlp = callPackage ../development/python-modules/ingredient-parser-nlp { };
iniconfig = callPackage ../development/python-modules/iniconfig { };
inifile = callPackage ../development/python-modules/inifile { };