Merge pull request #144172 from mkg20001/odoo

authored by

Maciej Krüger and committed by
GitHub
f7dbaa07 fc98560b

+300
+1
nixos/modules/module-list.nix
··· 391 391 ./services/display-managers/greetd.nix 392 392 ./services/editors/emacs.nix 393 393 ./services/editors/infinoted.nix 394 + ./services/finance/odoo.nix 394 395 ./services/games/crossfire-server.nix 395 396 ./services/games/deliantra-server.nix 396 397 ./services/games/factorio.nix
+122
nixos/modules/services/finance/odoo.nix
··· 1 + { config, pkgs, lib, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.services.odoo; 7 + format = pkgs.formats.ini {}; 8 + in 9 + { 10 + options = { 11 + services.odoo = { 12 + enable = mkEnableOption "odoo"; 13 + 14 + package = mkOption { 15 + type = types.package; 16 + default = pkgs.odoo; 17 + defaultText = literalExpression "pkgs.odoo"; 18 + description = "Odoo package to use."; 19 + }; 20 + 21 + addons = mkOption { 22 + type = with types; listOf package; 23 + default = []; 24 + example = literalExpression "[ pkgs.odoo_enterprise ]"; 25 + description = "Odoo addons"; 26 + }; 27 + 28 + settings = mkOption { 29 + type = format.type; 30 + default = {}; 31 + description = '' 32 + Odoo configuration settings. For more details see https://www.odoo.com/documentation/15.0/administration/install/deploy.html 33 + ''; 34 + }; 35 + 36 + domain = mkOption { 37 + type = with types; nullOr str; 38 + description = "Domain to host Odoo with nginx"; 39 + default = null; 40 + }; 41 + }; 42 + }; 43 + 44 + config = mkIf (cfg.enable) (let 45 + cfgFile = format.generate "odoo.cfg" cfg.settings; 46 + in { 47 + services.nginx = mkIf (cfg.domain != null) { 48 + upstreams = { 49 + odoo.servers = { 50 + "127.0.0.1:8069" = {}; 51 + }; 52 + 53 + odoochat.servers = { 54 + "127.0.0.1:8072" = {}; 55 + }; 56 + }; 57 + 58 + virtualHosts."${cfg.domain}" = { 59 + extraConfig = '' 60 + proxy_read_timeout 720s; 61 + proxy_connect_timeout 720s; 62 + proxy_send_timeout 720s; 63 + 64 + proxy_set_header X-Forwarded-Host $host; 65 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 66 + proxy_set_header X-Forwarded-Proto $scheme; 67 + proxy_set_header X-Real-IP $remote_addr; 68 + ''; 69 + 70 + locations = { 71 + "/longpolling" = { 72 + proxyPass = "http://odoochat"; 73 + }; 74 + 75 + "/" = { 76 + proxyPass = "http://odoo"; 77 + extraConfig = '' 78 + proxy_redirect off; 79 + ''; 80 + }; 81 + }; 82 + }; 83 + }; 84 + 85 + services.odoo.settings.options = { 86 + proxy_mode = cfg.domain != null; 87 + }; 88 + 89 + users.users.odoo = { 90 + isSystemUser = true; 91 + group = "odoo"; 92 + }; 93 + users.groups.odoo = {}; 94 + 95 + systemd.services.odoo = { 96 + wantedBy = [ "multi-user.target" ]; 97 + after = [ "network.target" "postgresql.service" ]; 98 + 99 + # pg_dump 100 + path = [ config.services.postgresql.package ]; 101 + 102 + requires = [ "postgresql.service" ]; 103 + script = "HOME=$STATE_DIRECTORY ${cfg.package}/bin/odoo ${optionalString (cfg.addons != []) "--addons-path=${concatMapStringsSep "," escapeShellArg cfg.addons}"} -c ${cfgFile}"; 104 + 105 + serviceConfig = { 106 + DynamicUser = true; 107 + User = "odoo"; 108 + StateDirectory = "odoo"; 109 + }; 110 + }; 111 + 112 + services.postgresql = { 113 + enable = true; 114 + 115 + ensureUsers = [{ 116 + name = "odoo"; 117 + ensurePermissions = { "DATABASE odoo" = "ALL PRIVILEGES"; }; 118 + }]; 119 + ensureDatabases = [ "odoo" ]; 120 + }; 121 + }); 122 + }
+1
nixos/tests/all-tests.nix
··· 172 172 installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {}); 173 173 invidious = handleTest ./invidious.nix {}; 174 174 oci-containers = handleTestOn ["x86_64-linux"] ./oci-containers.nix {}; 175 + odoo = handleTest ./odoo.nix {}; 175 176 # 9pnet_virtio used to mount /nix partition doesn't support 176 177 # hibernation. This test happens to work on x86_64-linux but 177 178 # not on other platforms.
+27
nixos/tests/odoo.nix
··· 1 + import ./make-test-python.nix ({ pkgs, lib, ...} : with lib; { 2 + name = "odoo"; 3 + meta = with pkgs.lib.maintainers; { 4 + maintainers = [ mkg20001 ]; 5 + }; 6 + 7 + nodes = { 8 + server = { ... }: { 9 + services.nginx = { 10 + enable = true; 11 + recommendedProxySettings = true; 12 + }; 13 + 14 + services.odoo = { 15 + enable = true; 16 + domain = "localhost"; 17 + }; 18 + }; 19 + }; 20 + 21 + testScript = { nodes, ... }: 22 + '' 23 + server.wait_for_unit("odoo.service") 24 + server.wait_until_succeeds("curl -s http://localhost:8069/web/database/selector | grep '<title>Odoo</title>'") 25 + server.succeed("curl -s http://localhost/web/database/selector | grep '<title>Odoo</title>'") 26 + ''; 27 + })
+103
pkgs/applications/finance/odoo/default.nix
··· 1 + { stdenv 2 + , lib 3 + , fetchurl 4 + , python3 5 + , python3Packages 6 + , wkhtmltopdf 7 + }: 8 + 9 + with python3Packages; 10 + 11 + /* 12 + 13 + TODO: 14 + For languages with right-to-left interface (such as Arabic or Hebrew), the package rtlcss is needed: 15 + $ sudo npm install -g rtlcss 16 + 17 + */ 18 + 19 + buildPythonApplication rec { 20 + pname = "odoo"; 21 + 22 + major = "15"; 23 + minor = "0"; 24 + patch = "20211029"; 25 + 26 + version = "${major}.${minor}.${patch}"; 27 + 28 + # latest release is at https://github.com/odoo/docker/blob/master/15.0/Dockerfile 29 + src = fetchurl { 30 + url = "https://nightly.odoo.com/${major}.${minor}/nightly/src/odoo_${version}.tar.gz"; 31 + name = "${pname}-${version}"; 32 + sha256 = "sha256-/E+bLBbiz7fRyTwP+0AMpqbuRkOpE4B4P6kREIB4m1Q="; 33 + }; 34 + 35 + nativeBuildInputs = [ 36 + setuptools 37 + wheel 38 + mock 39 + ]; 40 + 41 + buildInputs = [ 42 + wkhtmltopdf 43 + ]; 44 + 45 + # needs some investigation 46 + doCheck = false; 47 + 48 + makeWrapperArgs = [ "--prefix" "PATH" ":" "${wkhtmltopdf}/bin" ]; 49 + 50 + propagatedBuildInputs = [ 51 + Babel 52 + chardet 53 + decorator 54 + docutils 55 + ebaysdk 56 + freezegun 57 + gevent 58 + greenlet 59 + html2text 60 + idna 61 + jinja2 62 + libsass 63 + lxml 64 + markupsafe 65 + num2words 66 + ofxparse 67 + passlib 68 + pillow 69 + polib 70 + psutil 71 + psycopg2 72 + pydot 73 + pyopenssl 74 + pypdf2 75 + pyserial 76 + python-dateutil 77 + ldap 78 + python-stdnum 79 + pytz 80 + pyusb 81 + qrcode 82 + reportlab 83 + requests 84 + vobject 85 + werkzeug1 86 + xlrd 87 + XlsxWriter 88 + xlwt 89 + zeep 90 + ]; 91 + 92 + unpackPhase = '' 93 + tar xfz $src 94 + cd odoo* 95 + ''; 96 + 97 + meta = with lib; { 98 + description = "Open Source ERP and CRM"; 99 + homepage = "https://www.odoo.com/"; 100 + license = licenses.lgpl3Only; 101 + maintainers = [ maintainers.mkg20001 ]; 102 + }; 103 + }
+1
pkgs/development/node-packages/node-packages.json
··· 232 232 , "rimraf" 233 233 , "rollup" 234 234 , { "rust-analyzer-build-deps": "../../misc/vscode-extensions/rust-analyzer/build-deps" } 235 + , "rtlcss" 235 236 , "s3http" 236 237 , "sass" 237 238 , "semver"
+31
pkgs/development/python-modules/ebaysdk/default.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , fetchPypi 4 + , lxml 5 + , requests 6 + }: 7 + 8 + buildPythonPackage rec { 9 + pname = "ebaysdk"; 10 + version = "2.2.0"; 11 + 12 + src = fetchPypi { 13 + inherit pname version; 14 + sha256 = "sha256-Lrh11wa0gfWcqN0wdFON9+UZaBT5zhLQ74RpA0Opx/M="; 15 + }; 16 + 17 + propagatedBuildInputs = [ 18 + lxml 19 + requests 20 + ]; 21 + 22 + # requires network 23 + doCheck = false; 24 + 25 + meta = with lib; { 26 + description = "eBay SDK for Python"; 27 + homepage = "https://github.com/timotheus/ebaysdk-python"; 28 + license = licenses.cddl; 29 + maintainers = [ maintainers.mkg20001 ]; 30 + }; 31 + }
+8
pkgs/development/python-modules/werkzeug/1.nix
··· 17 17 propagatedBuildInputs = [ itsdangerous ]; 18 18 checkInputs = [ pytestCheckHook requests hypothesis pytest-timeout ]; 19 19 20 + postPatch = '' 21 + # ResourceWarning causes tests to fail 22 + rm tests/test_routing.py 23 + ''; 24 + 20 25 disabledTests = [ 21 26 "test_save_to_pathlib_dst" 22 27 "test_cookie_maxsize" ··· 38 43 # E File "/nix/store/cwv8aj4vsqvimzljw5dxsxy663vjgibj-python3.9-Werkzeug-1.0.1/lib/python3.9/site-packages/werkzeug/formparser.py", line 318, in parse_multipart_headers 39 44 # E return Headers(result) 40 45 # E ResourceWarning: unclosed file <_io.FileIO name=11 mode='rb+' closefd=True> 46 + "test_basic_routing" 47 + "test_merge_slashes_match" 48 + "test_merge_slashes_build" 41 49 "TestMultiPart" 42 50 "TestHTTPUtility" 43 51 ] ++ lib.optionals stdenv.isDarwin [
+2
pkgs/top-level/all-packages.nix
··· 3380 3380 3381 3381 obinskit = callPackage ../applications/misc/obinskit {}; 3382 3382 3383 + odoo = callPackage ../applications/finance/odoo {}; 3384 + 3383 3385 odafileconverter = libsForQt5.callPackage ../applications/graphics/odafileconverter {}; 3384 3386 3385 3387 ossutil = callPackage ../tools/admin/ossutil {};
+4
pkgs/top-level/python-packages.nix
··· 2367 2367 2368 2368 easywatch = callPackage ../development/python-modules/easywatch { }; 2369 2369 2370 + ebaysdk = callPackage ../development/python-modules/ebaysdk { }; 2371 + 2370 2372 ec2instanceconnectcli = callPackage ../tools/virtualization/ec2instanceconnectcli { }; 2371 2373 2372 2374 eccodes = toPythonModule (pkgs.eccodes.override { ··· 9814 9816 webthing = callPackage ../development/python-modules/webthing { }; 9815 9817 9816 9818 werkzeug = callPackage ../development/python-modules/werkzeug { }; 9819 + 9820 + werkzeug1 = callPackage ../development/python-modules/werkzeug/1.nix { }; 9817 9821 9818 9822 west = callPackage ../development/python-modules/west { }; 9819 9823