diff --git a/.gitignore b/.gitignore index b2be92b..87a3018 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ result +*.qcow2 diff --git a/flake.lock b/flake.lock index 36b91d2..cfc6cdb 100644 --- a/flake.lock +++ b/flake.lock @@ -1,78 +1,23 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1682109806, - "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=", + "lastModified": 1685655444, + "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2362848adf8def2866fabbffc50462e929d7fffb", + "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1635350005, - "narHash": "sha256-tAMJnUwfaDEB2aa31jGcu7R7bzGELM9noc91L2PbVjg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-20.09", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "pip2nix": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" - }, + "flake": false, "locked": { "lastModified": 1681921436, "narHash": "sha256-jrUOMhpOFxrgCXNgMWz475nKZdMiSQb0+nbaIqQORSM=", @@ -89,9 +34,9 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "pip2nix": "pip2nix" + "pip2nix": "pip2nix", + "systems": "systems" } }, "systems": { @@ -108,21 +53,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 5b1ae64..5971ac1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,23 +1,26 @@ { description = "Dev Setup"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.systems.url = "github:nix-systems/default"; inputs.pip2nix = { url = "github:nix-community/pip2nix"; flake = false; }; - outputs = {nixpkgs, flake-utils, pip2nix, ...}: + outputs = {nixpkgs, systems, pip2nix, ...}: let - pkgs = system: import nixpkgs { - inherit system; + eachSystem = nixpkgs.lib.genAttrs (import systems); + pkgs = import nixpkgs { + system = "x86_64-linux"; overlays = [ (import ./python-overlay.nix) (import ./overlay.nix) ]; }; - packages = flake-utils.lib.eachDefaultSystem (system: rec { + in + { + packages = eachSystem (system: { devEnv = pkgs.buildEnv { name = "erpnext-nix-dev-env"; paths = [ @@ -33,11 +36,10 @@ }); nixosConfigurations = { test-vm = nixpkgs.lib.nixosSystem { - pkgs = pkgs "x86_64-linux"; + inherit pkgs; system = "x86_64-linux"; modules = [./test-vm/configuration.nix]; }; }; - in {inherit packages nixosConfigurations;}; - + }; } diff --git a/frappe-tilde-versions b/frappe-tilde-versions deleted file mode 100644 index 6bbe071..0000000 --- a/frappe-tilde-versions +++ /dev/null @@ -1,61 +0,0 @@ -Babel 2.12.1 -Click 8.1.3 -filelock 3.8.0 -filetype 1.2.0 -GitPython 3.1.30 -Jinja2 3.1.2 -Pillow 9.3.0 -PyJWT 2.4.0 -PyPDF2 2.1.0 -PyPika 0.48.9 -PyQRCode 1.2.1 -PyYAML 6.0 -RestrictedPython 6.0 -Werkzeug 2.2.2 -Whoosh 2.7.4 -beautifulsoup4 4.9.3 -bleach-allowlist 1.0.3 -bleach 3.3.0 -chardet 4.0.0 -croniter 1.3.5 -cryptography 39.0.1 -email-reply-parser 0.5.12 -git-url-parse 1.2.2 -gunicorn 20.1.0 -html5lib 1.1 -ipython 8.10.0 -ldap3 2.9 -markdown2 2.4.0 -num2words 0.5.10 -oauthlib 3.2.1 -openpyxl 3.0.7 -passlib 1.7.4 -pdfkit 1.0.0 -premailer 3.8.0 -psutil 5.9.1 -psycopg2-binary 2.9.1 -pyOpenSSL 23.0.0 -pycryptodome 3.10.1 -pydantic 1.10.2 -pyotp 2.6.0 -python-dateutil 2.8.1 -rauth 0.7.3 -redis 4.5.4 -hiredis 2.0.0 -requests-oauthlib 1.3.0 -requests 2.27.1 -rq 1.11.1 -semantic-version 2.10.0 -sqlparse 0.4.1 -tenacity 8.0.1 -terminaltables 3.1.0 -traceback-with-variables 2.0.4 -xlrd 2.0.1 -zxcvbn 4.4.28 -markdownify 0.11.2 -boto3 1.18.49 -dropbox 11.7.0 -google-api-python-client 2.2.0 -google-auth-oauthlib 0.4.4 -google-auth 1.29.0 -posthog 3.0.1 diff --git a/node/erpnext-app.nix b/node/erpnext-app.nix index 2c12d3b..4357496 100644 --- a/node/erpnext-app.nix +++ b/node/erpnext-app.nix @@ -7,7 +7,17 @@ , nodePackages }: let - src = import ../srcs/erpnext.nix {inherit fetchFromGitHub; }; + pinData = import ../srcs/pin.nix; + inherit (pinData) erpnextVersion; + inherit (pinData.hashes) erpnextSrcHash; + + src = fetchFromGitHub { + owner = "frappe"; + repo = "erpnext"; + rev = "v${erpnextVersion}"; + hash = erpnextSrcHash; + }; + offlineCache = fetchYarnDeps { yarnLock = "${src}/yarn.lock"; sha256 = "sha256-Vho4BSbxcsVYExLvUaeoc3xIpbXoCUP/4jw4RwGnWGY="; diff --git a/node/frappe-app.nix b/node/frappe-app.nix index ea96248..117d6fb 100644 --- a/node/frappe-app.nix +++ b/node/frappe-app.nix @@ -7,7 +7,17 @@ , nodePackages }: let - src = import ../srcs/frappe.nix {inherit fetchFromGitHub; }; + pinData = import ../srcs/pin.nix; + inherit (pinData) frappeVersion; + inherit (pinData.hashes) frappeSrcHash; + + src = fetchFromGitHub { + owner = "frappe"; + repo = "frappe"; + rev = "v${frappeVersion}"; + hash = frappeSrcHash; + }; + offlineCache = fetchYarnDeps { yarnLock = "${src}/yarn.lock"; sha256 = "sha256-PBdMUz9gJIoQaqQYbdk+xnd8CyZPmdeyz/9WznCb4Ss="; diff --git a/node/frappe-erpnext-assets.nix b/node/frappe-erpnext-assets.nix index cfd89f5..1f40f02 100644 --- a/node/frappe-erpnext-assets.nix +++ b/node/frappe-erpnext-assets.nix @@ -29,4 +29,6 @@ runCommand "frappe-erpnext-apps-sites" {buildInputs = [yarn]; } '' mkdir -p $out/share/sites cp -r sites/assets $out/share/sites/assets + ln -s ${frappe-app}/share/apps/frappe/node_modules $out/share/sites/assets/frappe/node_modules + ln -s ${erpnext-app}/share/apps/erpnext/node_modules $out/share/sites/assets/erpnext/node_modules '' diff --git a/python-overlay.nix b/python-overlay.nix index da76514..88dac61 100644 --- a/python-overlay.nix +++ b/python-overlay.nix @@ -22,14 +22,14 @@ self: super: { taxjar = pyself.callPackage ./python/taxjar.nix {}; traceback-with-variables = pyself.callPackage ./python/traceback-with-variables.nix {}; - barcodenumber = pysuper.barcodenumber.overridePythonAttrs (oldAttrs: (rec { - version = "0.5.0"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-VZfHLwSF9aDoy5L1x4O2mu8/f2ijYKgyjCrQ1KKY5Ho="; - }; - })); + #barcodenumber = pysuper.barcodenumber.overridePythonAttrs (oldAttrs: (rec { + # version = "0.5.0"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-VZfHLwSF9aDoy5L1x4O2mu8/f2ijYKgyjCrQ1KKY5Ho="; + # }; + #})); bleach = pysuper.bleach.overridePythonAttrs (oldAttrs: (rec { version = "3.3.1"; src = pysuper.fetchPypi { @@ -38,14 +38,14 @@ self: super: { sha256 = "sha256-MGSDpal5VHQWCtV/zj3dG1BVHpge7Y4VpYLTTO8oqvo="; }; })); - phonenumbers = pysuper.phonenumbers.overridePythonAttrs (oldAttrs: (rec { - version = "8.12.40"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-APKVWkVrRY+barDSQykEnD5zWMRN/Bl5/kkIztQPHrg="; - }; - })); + #phonenumbers = pysuper.phonenumbers.overridePythonAttrs (oldAttrs: (rec { + # version = "8.12.40"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-APKVWkVrRY+barDSQykEnD5zWMRN/Bl5/kkIztQPHrg="; + # }; + #})); plaid-python = pysuper.plaid-python.overridePythonAttrs (oldAttrs: (rec { version = "7.2.1"; src = pysuper.fetchPypi { @@ -58,51 +58,51 @@ self: super: { # Integration tests require API keys and internet access checkPhase = "py.test -rxs ./tests/unit"; })); - pycountry = pysuper.pycountry.overridePythonAttrs (oldAttrs: (rec { - version = "20.7.3"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-gQhKU9NFQ0TAKS3uvCD80KFIjBNtSQAxLL1GXPVSy0I="; - }; - })); - pymysql = pysuper.pymysql.overridePythonAttrs (oldAttrs: (rec { - version = "1.0.3"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-PdqUPvNpQGinXWnQcXVdvsrO4a35ofxbIGgw0rZ9Jeg="; - }; - format = "pyproject"; - buildInputs = [pysuper.setuptools]; - })); - pypng = pysuper.pypng.overridePythonAttrs (oldAttrs: (rec { - version = "0.20220715.0"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-c5xDO6lvB4MV3lTA25da7lN8vD4dCuTtmqsMoeQn4sE="; - }; - })); - pytz = pysuper.pytz.overridePythonAttrs (oldAttrs: (rec { - version = "2022.1"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-HnYOL+aoFjvAs9mhnE+ENCr6Cir/6/qoSwG5eKAuyqc="; - }; - })); - redis = pysuper.redis.overridePythonAttrs (oldAttrs: (rec { - version = "3.5.3"; - src = pysuper.fetchPypi { - inherit version; - inherit (oldAttrs) pname; - sha256 = "sha256-Dn4M/KhmDeqLfVzYxPbF4p4R8xFYwLCukaOX8A5aBaI="; - }; - pythonImportsCheck = []; - # tests require a running redis - doCheck = false; - })); + #pycountry = pysuper.pycountry.overridePythonAttrs (oldAttrs: (rec { + # version = "20.7.3"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-gQhKU9NFQ0TAKS3uvCD80KFIjBNtSQAxLL1GXPVSy0I="; + # }; + #})); + #pymysql = pysuper.pymysql.overridePythonAttrs (oldAttrs: (rec { + # version = "1.0.3"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-PdqUPvNpQGinXWnQcXVdvsrO4a35ofxbIGgw0rZ9Jeg="; + # }; + # format = "pyproject"; + # buildInputs = [pysuper.setuptools]; + #})); + #pypng = pysuper.pypng.overridePythonAttrs (oldAttrs: (rec { + # version = "0.20220715.0"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-c5xDO6lvB4MV3lTA25da7lN8vD4dCuTtmqsMoeQn4sE="; + # }; + #})); + #pytz = pysuper.pytz.overridePythonAttrs (oldAttrs: (rec { + # version = "2022.1"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-HnYOL+aoFjvAs9mhnE+ENCr6Cir/6/qoSwG5eKAuyqc="; + # }; + #})); + #redis = pysuper.redis.overridePythonAttrs (oldAttrs: (rec { + # version = "3.5.3"; + # src = pysuper.fetchPypi { + # inherit version; + # inherit (oldAttrs) pname; + # sha256 = "sha256-Dn4M/KhmDeqLfVzYxPbF4p4R8xFYwLCukaOX8A5aBaI="; + # }; + # pythonImportsCheck = []; + # # tests require a running redis + # doCheck = false; + #})); tweepy = pysuper.tweepy.overridePythonAttrs (oldAttrs: (rec { version = "3.10.0"; src = pysuper.fetchPypi { @@ -113,14 +113,14 @@ self: super: { doCheck = false; pythonImportsCheck = []; })); - unidecode = pysuper.unidecode.overridePythonAttrs (oldAttrs: (rec { - version = "1.2.0"; - src = pysuper.fetchPypi { - inherit version; - pname = "Unidecode"; - sha256 = "sha256-jXOpfTh6lWkiNE9rdCQ8LGdxWUZZd4dEstvarY9rcn0="; - }; - })); + #unidecode = pysuper.unidecode.overridePythonAttrs (oldAttrs: (rec { + # version = "1.2.0"; + # src = pysuper.fetchPypi { + # inherit version; + # pname = "Unidecode"; + # sha256 = "sha256-jXOpfTh6lWkiNE9rdCQ8LGdxWUZZd4dEstvarY9rcn0="; + # }; + #})); }; }; } diff --git a/python/bench.nix b/python/bench.nix index d3a3217..a0f3a9a 100644 --- a/python/bench.nix +++ b/python/bench.nix @@ -15,16 +15,31 @@ , setuptools , tomli }: +let + pinData = import ../srcs/pin.nix; + inherit (pinData) benchVersion; + inherit (pinData.hashes) benchSrcHash; +in buildPythonPackage rec { pname = "frappe-bench"; version = "5.16.2"; + + src = fetchFromGitHub { + owner = "frappe"; + repo = "bench"; + rev = "v${benchVersion}"; + hash = benchSrcHash; + }; + format = "pyproject"; - src = import ../srcs/bench.nix {inherit fetchFromGitHub; }; + nativeBuildInputs = [ pythonRelaxDepsHook ]; pythonRelaxDeps = [ "jinja2" "python-crontab" "semantic-version" ]; + buildInputs = [ hatchling ]; + propagatedBuildInputs = [ click gitpython diff --git a/python/erpnext.nix b/python/erpnext.nix index 1a06ca1..14fb430 100644 --- a/python/erpnext.nix +++ b/python/erpnext.nix @@ -1,5 +1,6 @@ { lib , buildPythonPackage +, pythonRelaxDepsHook , fetchFromGitHub , taxjar @@ -13,12 +14,32 @@ , googlemaps , python-stdnum , frappe +, bench }: +let + pinData = import ../srcs/pin.nix; + inherit (pinData) erpnextVersion; + inherit (pinData.hashes) erpnextSrcHash; +in buildPythonPackage rec { pname = "erpnext"; - version = "14.24.3"; + version = erpnextVersion; + + src = fetchFromGitHub { + owner = "frappe"; + repo = pname; + rev = "v${erpnextVersion}"; + hash = erpnextSrcHash; + }; + format = "flit"; - src = import ../srcs/erpnext.nix {inherit fetchFromGitHub; }; + + nativeBuildInputs = [ pythonRelaxDepsHook ]; + pythonRelaxDeps = [ + "pycountry" + "Unidecode" + ]; + propagatedBuildInputs = [ taxjar gocardless-pro @@ -32,4 +53,10 @@ buildPythonPackage rec { python-stdnum frappe ]; + #nativeCheckInputs = [ + # bench + #]; + #checkPhase = '' + # bench --site test_site run-tests --app erpnext + #''; } diff --git a/python/frappe.nix b/python/frappe.nix index 0bc10ea..0ec195d 100644 --- a/python/frappe.nix +++ b/python/frappe.nix @@ -1,6 +1,6 @@ { lib , buildPythonPackage -, fetchPypi +, pythonRelaxDepsHook , fetchFromGitHub # core dependencies @@ -47,8 +47,9 @@ , psutil , psycopg2-binary , pyasn1 -, pyopenssl +, pycountry , pycryptodome +, pyopenssl , pyotp , pypng , python-dateutil @@ -69,8 +70,9 @@ , xlrd , zxcvbn , markdownify +, bench - # integration dependencie + # integration dependencies , boto3 , dropbox , google-api-python-client @@ -79,11 +81,56 @@ , google-auth , posthog }: +let + pinData = import ../srcs/pin.nix; + inherit (pinData) frappeVersion; + inherit (pinData.hashes) frappeSrcHash; +in buildPythonPackage rec { pname = "frappe"; - version = "14.36.1"; + version = frappeVersion; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = "v${frappeVersion}"; + hash = frappeSrcHash; + }; + format = "flit"; - src = import ../srcs/frappe.nix { inherit fetchFromGitHub; } ; + + nativeBuildInputs = [ pythonRelaxDepsHook ]; + pythonRelaxDeps = [ + "Babel" + "beautifulsoup4" + "boto3" + "cairocffi" + "Click" + "cryptography" + "filelock" + "google-api-python-client" + "google-auth" + "hiredis" + "ipython" + "openpyxl" + "phonenumbers" + "Pillow" + "premailer" + "pyasn1" + "pycountry" + "pycryptodome" + "PyJWT" + "PyMySQL" + "pyOpenSSL" + "pyotp" + "pypng" + "pytz" + "redis" + "rq" + "tenacity" + "WeasyPrint" + ]; + propagatedBuildInputs = [ babel click @@ -128,8 +175,9 @@ buildPythonPackage rec { psutil psycopg2-binary pyasn1 - pyopenssl + pycountry pycryptodome + pyopenssl pyotp pypng python-dateutil @@ -160,4 +208,17 @@ buildPythonPackage rec { google-auth posthog ]; + + #nativeCheckInputs = [ + # bench + # redis + #]; + #checkPhase = '' + # tmp=$(mktemp -d) + # cd $tmp + # bench -v init frappe-bench --skip-assets + # cd frappe-bench + # mkdir -p sites/test_site + # bench --site test_site run-tests --app frappe + #''; } diff --git a/python/redisearch.nix b/python/redisearch.nix index 049cb17..7c0c7a1 100644 --- a/python/redisearch.nix +++ b/python/redisearch.nix @@ -1,9 +1,10 @@ -{ - buildPythonPackage, - fetchPypi, - redis, - rejson, - hiredis +{ buildPythonPackage +, fetchPypi +, pythonRelaxDepsHook +, unittestCheckHook +, redis +, rejson +, hiredis }: buildPythonPackage rec { pname = "redisearch"; @@ -12,9 +13,16 @@ buildPythonPackage rec { inherit pname version; sha256 = "sha256-V1rNWhOhB/8AXUVyoTa1A7Evpb8mr8N70R9qkj8exzw="; }; + nativeBuildInputs = [ pythonRelaxDepsHook ]; + pythonRelaxDeps = [ + "redis" + ]; propagatedBuildInputs = [ redis rejson hiredis ]; + nativeCheckInputs = [ + unittestCheckHook + ]; } diff --git a/python/rejson.nix b/python/rejson.nix index 25eff3e..3e72a45 100644 --- a/python/rejson.nix +++ b/python/rejson.nix @@ -1,8 +1,9 @@ -{ - buildPythonPackage, - fetchPypi, - redis, - six +{ buildPythonPackage +, pythonRelaxDepsHook +, unittestCheckHook +, fetchPypi +, redis +, six }: buildPythonPackage rec { pname = "rejson"; @@ -11,8 +12,13 @@ buildPythonPackage rec { inherit pname version; sha256 = "sha256-vs3hNSAAUAi3ls5WyxKOsiUC18addIJv81HNQ79zvJc="; }; + nativeBuildInputs = [ pythonRelaxDepsHook ]; + pythonRelaxDeps = [ + "redis" + ]; propagatedBuildInputs = [ redis six ]; + doCheck = false; } diff --git a/srcs/bench.nix b/srcs/bench.nix deleted file mode 100644 index da5ebc9..0000000 --- a/srcs/bench.nix +++ /dev/null @@ -1,7 +0,0 @@ -{fetchFromGitHub}: -fetchFromGitHub { - owner = "frappe"; - repo = "bench"; - rev = "v5.16.2"; - sha256 = "sha256-SF/RwY54OKXTDIYz4LsQIR03QoCKPIGey60DO8TdonY="; -} diff --git a/srcs/erpnext.nix b/srcs/erpnext.nix deleted file mode 100644 index b7ff5d2..0000000 --- a/srcs/erpnext.nix +++ /dev/null @@ -1,7 +0,0 @@ -{fetchFromGitHub}: -fetchFromGitHub { - owner = "frappe"; - repo = "erpnext"; - rev = "v14.24.3"; - sha256 = "sha256-zovdbpTp9fTpY7kAs4J8EiPh+EjqUOtVUk+rDYMfYDk="; -} diff --git a/srcs/frappe.nix b/srcs/frappe.nix deleted file mode 100644 index 17b4502..0000000 --- a/srcs/frappe.nix +++ /dev/null @@ -1,8 +0,0 @@ -{fetchFromGitHub}: - -fetchFromGitHub { - owner = "akshaymankar"; - repo = "frappe"; - rev = "d4d3cbc12d3e40f104500866a2bf468d128e2e32"; - sha256 = "sha256-+z/IeK3bFGYxnvWCR6GTgik25lSReJvRCbV7MsoUA/g="; -} diff --git a/srcs/pin.nix b/srcs/pin.nix new file mode 100644 index 0000000..7388e3c --- /dev/null +++ b/srcs/pin.nix @@ -0,0 +1,10 @@ +{ + frappeVersion = "14.37.0"; + erpnextVersion = "14.26.0"; + benchVersion = "5.16.2"; + hashes = { + "benchSrcHash" = "sha256-SF/RwY54OKXTDIYz4LsQIR03QoCKPIGey60DO8TdonY="; + "erpnextSrcHash" = "sha256-hPOgHADkrylc6OCbDyXCQfSYe5wliIhNcXpLE0hxmJ0="; + "frappeSrcHash" = "sha256-f0BkNByKtqXaG6L4+llwy9kmI8gbjvZdKzkzrbA6PI4="; + }; +} diff --git a/test-vm/configuration.nix b/test-vm/configuration.nix index 202fbdf..2f4be5e 100644 --- a/test-vm/configuration.nix +++ b/test-vm/configuration.nix @@ -64,69 +64,102 @@ with lib; group = "erpnext"; isSystemUser = true; }; + #users = { + # users.${user} = { + # uid = 327; + # group = group; + # home = server.workDir; + # }; + # groups.${group}.gid = 327; + #}; systemd.services.erpnext = + let + name = "worker1"; + user = "erpnext"; + group = "erpnext"; + server = { + bind = "127.0.0.1:9090"; + workDir = "/var/lib/erpnext"; + }; + in { + enable = true; + wantedBy = [ "multi-user.target" ]; + after = [ "mysql.service" "redis.service" "redis-socketio.service" ]; + description = "ERPNext"; + + environment = let - penv = python3.buildEnv.override { + penv = pkgs.python3.buildEnv.override { extraLibs = [ - python3.pkgs.frappe - python3.pkgs.erpnext - python3.pkgs.bench + pkgs.python3.pkgs.frappe + pkgs.python3.pkgs.erpnext + pkgs.python3.pkgs.bench ]; }; - in - { - enable = true; - wantedBy = [ "multi-user.target" ]; - after = [ "mysql.service" "redis.service" "redis-socketio.service" ]; - description = "ERPNext"; - confinement = { - enable = true; - packages = [ ]; - }; - script = '' - export PYTHON_PATH=${penv}/${python3.sitePackages} + in { + PYTHONPATH = "${penv}/${pkgs.python3.sitePackages}/"; + }; - cat > /frappe-bench/sites/apps.txt </frape-bench/sites/common_site_config.json < ${server.workDir}/sites/apps.txt < ${server.workDir}/sites/common_site_config.json <