From 4eee509d25d5af666f05986a349ae8639c0adfcc Mon Sep 17 00:00:00 2001 From: Karolin Schlegel Date: Thu, 24 Aug 2023 22:04:40 +0200 Subject: [PATCH] odoo15: init at 15.0-20230720 This contribution adds `odoo15` as a fixed version. To allow reusing the existing test for Odoo, I made the package attribute configurable. To reference the test for `odoo15` in `passthru` I added it to `all-tests.nix`. --- nixos/tests/all-tests.nix | 1 + nixos/tests/odoo.nix | 3 +- pkgs/applications/finance/odoo/odoo15.nix | 128 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 1 + 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/finance/odoo/odoo15.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 19aaac694594..a102e6d5399b 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -349,6 +349,7 @@ in { invidious = handleTest ./invidious.nix {}; oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {}; odoo = handleTest ./odoo.nix {}; + odoo15 = handleTest ./odoo.nix { package = pkgs.odoo15; }; # 9pnet_virtio used to mount /nix partition doesn't support # hibernation. This test happens to work on x86_64-linux but # not on other platforms. diff --git a/nixos/tests/odoo.nix b/nixos/tests/odoo.nix index 7c2cf31370f9..00ae4a2137d1 100644 --- a/nixos/tests/odoo.nix +++ b/nixos/tests/odoo.nix @@ -1,4 +1,4 @@ -import ./make-test-python.nix ({ pkgs, lib, ...} : { +import ./make-test-python.nix ({ pkgs, lib, package ? pkgs.odoo, ...} : { name = "odoo"; meta.maintainers = with lib.maintainers; [ mkg20001 ]; @@ -11,6 +11,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { services.odoo = { enable = true; + package = package; domain = "localhost"; }; }; diff --git a/pkgs/applications/finance/odoo/odoo15.nix b/pkgs/applications/finance/odoo/odoo15.nix new file mode 100644 index 000000000000..1ed0cf316088 --- /dev/null +++ b/pkgs/applications/finance/odoo/odoo15.nix @@ -0,0 +1,128 @@ +{ stdenv, lib, fetchFromGitHub, fetchurl, python310, nodePackages, wkhtmltopdf +, nixosTests }: + +let + python = python310.override { + packageOverrides = self: super: { + pypdf2 = super.pypdf2.overridePythonAttrs (old: rec { + version = "1.28.6"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "py-pdf"; + repo = "pypdf"; + rev = version; + fetchSubmodules = true; + hash = "sha256-WnRbsy/PJcotZqY9mJPLadrYqkXykOVifLIbDyNf4s4="; + }; + + nativeBuildInputs = [ ]; + + nativeCheckInputs = with self; [ pytestCheckHook pillow ]; + }); + flask = super.flask.overridePythonAttrs (old: rec { + version = "2.1.3"; + src = old.src.override { + inherit version; + hash = "sha256-FZcuUBffBXXD1sCQuhaLbbkCWeYgrI1+qBOjlrrVtss="; + }; + }); + werkzeug = super.werkzeug.overridePythonAttrs (old: rec { + version = "2.1.2"; + src = old.src.override { + inherit version; + hash = "sha256-HOCOgJPtZ9Y41jh5/Rujc1gX96gN42dNKT9ZhPJftuY="; + }; + }); + }; + }; + + odoo_version = "15.0"; + odoo_release = "20230720"; +in python.pkgs.buildPythonApplication rec { + pname = "odoo15"; + version = "${odoo_version}.${odoo_release}"; + + format = "setuptools"; + + # latest release is at https://github.com/odoo/docker/blob/master/15.0/Dockerfile + src = fetchurl { + url = + "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.tar.gz"; + name = "${pname}-${version}"; + hash = "sha256-XH4cN2OrPvMjN3VcDJFxCacNxKkrN65jwhUN1dnGwgo="; # odoo + }; + + unpackPhase = '' + tar xfz $src + cd odoo* + ''; + + # needs some investigation + doCheck = false; + + makeWrapperArgs = [ + "--prefix" + "PATH" + ":" + "${lib.makeBinPath [ wkhtmltopdf nodePackages.rtlcss ]}" + ]; + + propagatedBuildInputs = with python.pkgs; [ + babel + chardet + decorator + docutils + ebaysdk + freezegun + gevent + greenlet + idna + jinja2 + libsass + lxml + markupsafe + mock + num2words + ofxparse + passlib + pillow + polib + psutil + psycopg2 + pydot + pyopenssl + pypdf2 + pyserial + python-dateutil + python-ldap + python-stdnum + pytz + pyusb + qrcode + reportlab + requests + setuptools + vobject + werkzeug + xlrd + xlsxwriter + xlwt + zeep + ]; + + # takes 5+ minutes and there are not files to strip + dontStrip = true; + + passthru = { + updateScript = ./update.sh; + tests = { inherit (nixosTests) odoo15; }; + }; + + meta = with lib; { + description = "Open Source ERP and CRM"; + homepage = "https://www.odoo.com/"; + license = licenses.lgpl3Only; + maintainers = with maintainers; [ mkg20001 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e00fbc33de82..db8d2e1f3d48 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6091,6 +6091,7 @@ with pkgs; }; odoo = callPackage ../applications/finance/odoo { }; + odoo15 = callPackage ../applications/finance/odoo/odoo15.nix { }; odafileconverter = libsForQt5.callPackage ../applications/graphics/odafileconverter { };