mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #144172 from mkg20001/odoo
This commit is contained in:
commit
f7dbaa0754
10 changed files with 300 additions and 0 deletions
|
@ -391,6 +391,7 @@
|
|||
./services/display-managers/greetd.nix
|
||||
./services/editors/emacs.nix
|
||||
./services/editors/infinoted.nix
|
||||
./services/finance/odoo.nix
|
||||
./services/games/crossfire-server.nix
|
||||
./services/games/deliantra-server.nix
|
||||
./services/games/factorio.nix
|
||||
|
|
122
nixos/modules/services/finance/odoo.nix
Normal file
122
nixos/modules/services/finance/odoo.nix
Normal file
|
@ -0,0 +1,122 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.odoo;
|
||||
format = pkgs.formats.ini {};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.odoo = {
|
||||
enable = mkEnableOption "odoo";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.odoo;
|
||||
defaultText = literalExpression "pkgs.odoo";
|
||||
description = "Odoo package to use.";
|
||||
};
|
||||
|
||||
addons = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [];
|
||||
example = literalExpression "[ pkgs.odoo_enterprise ]";
|
||||
description = "Odoo addons";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = format.type;
|
||||
default = {};
|
||||
description = ''
|
||||
Odoo configuration settings. For more details see https://www.odoo.com/documentation/15.0/administration/install/deploy.html
|
||||
'';
|
||||
};
|
||||
|
||||
domain = mkOption {
|
||||
type = with types; nullOr str;
|
||||
description = "Domain to host Odoo with nginx";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable) (let
|
||||
cfgFile = format.generate "odoo.cfg" cfg.settings;
|
||||
in {
|
||||
services.nginx = mkIf (cfg.domain != null) {
|
||||
upstreams = {
|
||||
odoo.servers = {
|
||||
"127.0.0.1:8069" = {};
|
||||
};
|
||||
|
||||
odoochat.servers = {
|
||||
"127.0.0.1:8072" = {};
|
||||
};
|
||||
};
|
||||
|
||||
virtualHosts."${cfg.domain}" = {
|
||||
extraConfig = ''
|
||||
proxy_read_timeout 720s;
|
||||
proxy_connect_timeout 720s;
|
||||
proxy_send_timeout 720s;
|
||||
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
'';
|
||||
|
||||
locations = {
|
||||
"/longpolling" = {
|
||||
proxyPass = "http://odoochat";
|
||||
};
|
||||
|
||||
"/" = {
|
||||
proxyPass = "http://odoo";
|
||||
extraConfig = ''
|
||||
proxy_redirect off;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.odoo.settings.options = {
|
||||
proxy_mode = cfg.domain != null;
|
||||
};
|
||||
|
||||
users.users.odoo = {
|
||||
isSystemUser = true;
|
||||
group = "odoo";
|
||||
};
|
||||
users.groups.odoo = {};
|
||||
|
||||
systemd.services.odoo = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "postgresql.service" ];
|
||||
|
||||
# pg_dump
|
||||
path = [ config.services.postgresql.package ];
|
||||
|
||||
requires = [ "postgresql.service" ];
|
||||
script = "HOME=$STATE_DIRECTORY ${cfg.package}/bin/odoo ${optionalString (cfg.addons != []) "--addons-path=${concatMapStringsSep "," escapeShellArg cfg.addons}"} -c ${cfgFile}";
|
||||
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
User = "odoo";
|
||||
StateDirectory = "odoo";
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
ensureUsers = [{
|
||||
name = "odoo";
|
||||
ensurePermissions = { "DATABASE odoo" = "ALL PRIVILEGES"; };
|
||||
}];
|
||||
ensureDatabases = [ "odoo" ];
|
||||
};
|
||||
});
|
||||
}
|
|
@ -172,6 +172,7 @@ in
|
|||
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
|
||||
invidious = handleTest ./invidious.nix {};
|
||||
oci-containers = handleTestOn ["x86_64-linux"] ./oci-containers.nix {};
|
||||
odoo = handleTest ./odoo.nix {};
|
||||
# 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.
|
||||
|
|
27
nixos/tests/odoo.nix
Normal file
27
nixos/tests/odoo.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
import ./make-test-python.nix ({ pkgs, lib, ...} : with lib; {
|
||||
name = "odoo";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ mkg20001 ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
server = { ... }: {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
};
|
||||
|
||||
services.odoo = {
|
||||
enable = true;
|
||||
domain = "localhost";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = { nodes, ... }:
|
||||
''
|
||||
server.wait_for_unit("odoo.service")
|
||||
server.wait_until_succeeds("curl -s http://localhost:8069/web/database/selector | grep '<title>Odoo</title>'")
|
||||
server.succeed("curl -s http://localhost/web/database/selector | grep '<title>Odoo</title>'")
|
||||
'';
|
||||
})
|
103
pkgs/applications/finance/odoo/default.nix
Normal file
103
pkgs/applications/finance/odoo/default.nix
Normal file
|
@ -0,0 +1,103 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchurl
|
||||
, python3
|
||||
, python3Packages
|
||||
, wkhtmltopdf
|
||||
}:
|
||||
|
||||
with python3Packages;
|
||||
|
||||
/*
|
||||
|
||||
TODO:
|
||||
For languages with right-to-left interface (such as Arabic or Hebrew), the package rtlcss is needed:
|
||||
$ sudo npm install -g rtlcss
|
||||
|
||||
*/
|
||||
|
||||
buildPythonApplication rec {
|
||||
pname = "odoo";
|
||||
|
||||
major = "15";
|
||||
minor = "0";
|
||||
patch = "20211029";
|
||||
|
||||
version = "${major}.${minor}.${patch}";
|
||||
|
||||
# latest release is at https://github.com/odoo/docker/blob/master/15.0/Dockerfile
|
||||
src = fetchurl {
|
||||
url = "https://nightly.odoo.com/${major}.${minor}/nightly/src/odoo_${version}.tar.gz";
|
||||
name = "${pname}-${version}";
|
||||
sha256 = "sha256-/E+bLBbiz7fRyTwP+0AMpqbuRkOpE4B4P6kREIB4m1Q=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
setuptools
|
||||
wheel
|
||||
mock
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
wkhtmltopdf
|
||||
];
|
||||
|
||||
# needs some investigation
|
||||
doCheck = false;
|
||||
|
||||
makeWrapperArgs = [ "--prefix" "PATH" ":" "${wkhtmltopdf}/bin" ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
Babel
|
||||
chardet
|
||||
decorator
|
||||
docutils
|
||||
ebaysdk
|
||||
freezegun
|
||||
gevent
|
||||
greenlet
|
||||
html2text
|
||||
idna
|
||||
jinja2
|
||||
libsass
|
||||
lxml
|
||||
markupsafe
|
||||
num2words
|
||||
ofxparse
|
||||
passlib
|
||||
pillow
|
||||
polib
|
||||
psutil
|
||||
psycopg2
|
||||
pydot
|
||||
pyopenssl
|
||||
pypdf2
|
||||
pyserial
|
||||
python-dateutil
|
||||
ldap
|
||||
python-stdnum
|
||||
pytz
|
||||
pyusb
|
||||
qrcode
|
||||
reportlab
|
||||
requests
|
||||
vobject
|
||||
werkzeug1
|
||||
xlrd
|
||||
XlsxWriter
|
||||
xlwt
|
||||
zeep
|
||||
];
|
||||
|
||||
unpackPhase = ''
|
||||
tar xfz $src
|
||||
cd odoo*
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Open Source ERP and CRM";
|
||||
homepage = "https://www.odoo.com/";
|
||||
license = licenses.lgpl3Only;
|
||||
maintainers = [ maintainers.mkg20001 ];
|
||||
};
|
||||
}
|
|
@ -232,6 +232,7 @@
|
|||
, "rimraf"
|
||||
, "rollup"
|
||||
, { "rust-analyzer-build-deps": "../../misc/vscode-extensions/rust-analyzer/build-deps" }
|
||||
, "rtlcss"
|
||||
, "s3http"
|
||||
, "sass"
|
||||
, "semver"
|
||||
|
|
31
pkgs/development/python-modules/ebaysdk/default.nix
Normal file
31
pkgs/development/python-modules/ebaysdk/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, lxml
|
||||
, requests
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "ebaysdk";
|
||||
version = "2.2.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-Lrh11wa0gfWcqN0wdFON9+UZaBT5zhLQ74RpA0Opx/M=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
lxml
|
||||
requests
|
||||
];
|
||||
|
||||
# requires network
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "eBay SDK for Python";
|
||||
homepage = "https://github.com/timotheus/ebaysdk-python";
|
||||
license = licenses.cddl;
|
||||
maintainers = [ maintainers.mkg20001 ];
|
||||
};
|
||||
}
|
|
@ -17,6 +17,11 @@ buildPythonPackage rec {
|
|||
propagatedBuildInputs = [ itsdangerous ];
|
||||
checkInputs = [ pytestCheckHook requests hypothesis pytest-timeout ];
|
||||
|
||||
postPatch = ''
|
||||
# ResourceWarning causes tests to fail
|
||||
rm tests/test_routing.py
|
||||
'';
|
||||
|
||||
disabledTests = [
|
||||
"test_save_to_pathlib_dst"
|
||||
"test_cookie_maxsize"
|
||||
|
@ -38,6 +43,9 @@ buildPythonPackage rec {
|
|||
# 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
|
||||
# E return Headers(result)
|
||||
# E ResourceWarning: unclosed file <_io.FileIO name=11 mode='rb+' closefd=True>
|
||||
"test_basic_routing"
|
||||
"test_merge_slashes_match"
|
||||
"test_merge_slashes_build"
|
||||
"TestMultiPart"
|
||||
"TestHTTPUtility"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
|
|
|
@ -3380,6 +3380,8 @@ with pkgs;
|
|||
|
||||
obinskit = callPackage ../applications/misc/obinskit {};
|
||||
|
||||
odoo = callPackage ../applications/finance/odoo {};
|
||||
|
||||
odafileconverter = libsForQt5.callPackage ../applications/graphics/odafileconverter {};
|
||||
|
||||
ossutil = callPackage ../tools/admin/ossutil {};
|
||||
|
|
|
@ -2367,6 +2367,8 @@ in {
|
|||
|
||||
easywatch = callPackage ../development/python-modules/easywatch { };
|
||||
|
||||
ebaysdk = callPackage ../development/python-modules/ebaysdk { };
|
||||
|
||||
ec2instanceconnectcli = callPackage ../tools/virtualization/ec2instanceconnectcli { };
|
||||
|
||||
eccodes = toPythonModule (pkgs.eccodes.override {
|
||||
|
@ -9815,6 +9817,8 @@ in {
|
|||
|
||||
werkzeug = callPackage ../development/python-modules/werkzeug { };
|
||||
|
||||
werkzeug1 = callPackage ../development/python-modules/werkzeug/1.nix { };
|
||||
|
||||
west = callPackage ../development/python-modules/west { };
|
||||
|
||||
wfuzz = callPackage ../development/python-modules/wfuzz { };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue