2022-10-06 18:32:54 +00:00
|
|
|
{ callPackage
|
|
|
|
, nixosTests
|
|
|
|
, python3
|
2023-04-12 12:48:02 +00:00
|
|
|
, fetchFromGitHub
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchpatch
|
2022-10-06 18:32:54 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
python = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
2024-01-02 11:29:13 +00:00
|
|
|
validators = super.validators.overridePythonAttrs (_: rec {
|
|
|
|
version = "0.20.0";
|
2023-04-12 12:48:02 +00:00
|
|
|
src = fetchFromGitHub {
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "python-validators";
|
|
|
|
repo = "validators";
|
|
|
|
rev = version;
|
|
|
|
hash = "sha256-ZnLyTHlsrXthGnaPzlV2ga/UTm5SSEHLTwC/tobiPak=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
propagatedBuildInputs = [ super.decorator super.six ];
|
2022-10-06 18:32:54 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
common = callPackage ./common.nix { };
|
|
|
|
|
|
|
|
frontend = callPackage ./frontend.nix { };
|
|
|
|
in
|
|
|
|
python.pkgs.pythonPackages.buildPythonPackage rec {
|
|
|
|
pname = "tandoor-recipes";
|
|
|
|
|
|
|
|
inherit (common) version src;
|
|
|
|
|
|
|
|
format = "other";
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Allow setting MEDIA_ROOT through environment variable
|
|
|
|
./media-root.patch
|
2023-11-16 04:20:00 +00:00
|
|
|
# https://github.com/TandoorRecipes/recipes/pull/2706
|
|
|
|
(fetchpatch {
|
2024-01-02 11:29:13 +00:00
|
|
|
url = "https://github.com/TandoorRecipes/recipes/commit/702c1d67d3b2d13cf471bf9daa1d2ef0f1837dec.patch";
|
|
|
|
hash = "sha256-6vmtYs6b0d38Ojxxc2I7oxqpkIlyRVlhzURBOTO2VlQ=";
|
2023-11-16 04:20:00 +00:00
|
|
|
})
|
2022-10-06 18:32:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
|
|
|
beautifulsoup4
|
|
|
|
bleach
|
|
|
|
bleach-allowlist
|
|
|
|
boto3
|
|
|
|
cryptography
|
|
|
|
django
|
|
|
|
django-allauth
|
|
|
|
django-annoying
|
|
|
|
django-auth-ldap
|
|
|
|
django-autocomplete-light
|
|
|
|
django-cleanup
|
|
|
|
django-cors-headers
|
|
|
|
django-crispy-forms
|
2024-01-02 11:29:13 +00:00
|
|
|
django-crispy-bootstrap4
|
2022-10-06 18:32:54 +00:00
|
|
|
django-hcaptcha
|
|
|
|
django-js-reverse
|
|
|
|
django-oauth-toolkit
|
|
|
|
django-prometheus
|
|
|
|
django-scopes
|
|
|
|
django-storages
|
|
|
|
django-tables2
|
|
|
|
django-webpack-loader
|
2023-08-04 22:07:22 +00:00
|
|
|
django-treebeard
|
2022-10-06 18:32:54 +00:00
|
|
|
djangorestframework
|
|
|
|
drf-writable-nested
|
|
|
|
gunicorn
|
|
|
|
icalendar
|
|
|
|
jinja2
|
|
|
|
lxml
|
|
|
|
markdown
|
|
|
|
microdata
|
|
|
|
pillow
|
|
|
|
psycopg2
|
|
|
|
pyppeteer
|
|
|
|
python-dotenv
|
|
|
|
pytube
|
|
|
|
pyyaml
|
|
|
|
recipe-scrapers
|
|
|
|
requests
|
|
|
|
six
|
|
|
|
uritemplate
|
|
|
|
validators
|
|
|
|
webdavclient3
|
|
|
|
whitenoise
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
ln -sf ${frontend}/ cookbook/static/vue
|
|
|
|
cp ${frontend}/webpack-stats.json vue/
|
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
# Disable debug logging
|
2022-10-06 18:32:54 +00:00
|
|
|
export DEBUG=0
|
2023-05-24 13:37:59 +00:00
|
|
|
# Avoid dependency on django debug toolbar
|
|
|
|
export DEBUG_TOOLBAR=0
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
# See https://github.com/TandoorRecipes/recipes/issues/2043
|
|
|
|
mkdir cookbook/static/themes/maps/
|
|
|
|
touch cookbook/static/themes/maps/style.min.css.map
|
|
|
|
touch cookbook/static/themes/bootstrap.min.css.map
|
|
|
|
touch cookbook/static/css/bootstrap-vue.min.css.map
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
${python.pythonOnBuildForHost.interpreter} manage.py collectstatic_js_reverse
|
|
|
|
${python.pythonOnBuildForHost.interpreter} manage.py collectstatic
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/lib
|
|
|
|
cp -r . $out/lib/tandoor-recipes
|
|
|
|
chmod +x $out/lib/tandoor-recipes/manage.py
|
|
|
|
makeWrapper $out/lib/tandoor-recipes/manage.py $out/bin/tandoor-recipes \
|
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH"
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# usually copied during frontend build (see vue.config.js)
|
|
|
|
cp vue/src/sw.js $out/lib/tandoor-recipes/cookbook/templates/
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python.pkgs; [
|
2022-10-06 18:32:54 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pytest-django
|
|
|
|
pytest-factoryboy
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
# flaky
|
|
|
|
disabledTests = [
|
|
|
|
"test_search_count"
|
|
|
|
];
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
passthru = {
|
|
|
|
inherit frontend python;
|
|
|
|
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
|
|
|
|
tests = {
|
|
|
|
inherit (nixosTests) tandoor-recipes;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = common.meta // {
|
|
|
|
description = ''
|
|
|
|
Application for managing recipes, planning meals, building shopping lists
|
|
|
|
and much much more!
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|