{ lib , buildPythonPackage , fetchFromGitHub , fetchYarnDeps , mkYarnPackage , taxjar , gocardless-pro , plaid-python , unidecode , pycountry , python-youtube , tweepy , redisearch , googlemaps , python-stdnum , frappe }: let frappe-version = "14.36.1"; erpnext-version = "14.24.3"; in buildPythonPackage rec { pname = "erpnext"; version = erpnext-version; format = "flit"; src = fetchFromGitHub { owner = "frappe"; repo = pname; rev = "v${erpnext-version}"; sha256 = "sha256-zovdbpTp9fTpY7kAs4J8EiPh+EjqUOtVUk+rDYMfYDk="; }; propagatedBuildInputs = [ taxjar gocardless-pro plaid-python unidecode pycountry python-youtube tweepy redisearch googlemaps python-stdnum frappe ]; frappe-assets = mkYarnPackage { pname = "frappe-assets"; version = frappe-version; src = fetchFromGitHub { owner = "frappe"; repo = "frappe"; rev = "v${frappe-version}"; hash = "sha256-eee6IS/Ep/DSDCPdnyrqBea/ag0kNnN5Id3YQMNz5js="; }; packageJSON = ../frappe-package.json; yarnFlags = [ "--production" ]; offlineCache = fetchYarnDeps { yarnLock = src + "/yarn.lock"; hash = "sha256-PBdMUz9gJIoQaqQYbdk+xnd8CyZPmdeyz/9WznCb4Ss="; }; buildPhase = '' runHook preBuild # Yarn writes cache directories etc to $HOME. export HOME=$PWD/yarn_home # The upstream build script reads sites/apps.txt to define what assets to build # A list of assets is written to sites/assets/assets.json mkdir -p apps sites/assets echo -e "erpnext\nfrappe\n" > sites/apps.txt cp -r ${src} apps/erpnext chmod u+rw apps/erpnext cp -r ${erpnext-modules}/node_modules apps/erpnext/node_modules chmod u+rw apps/erpnext #ln -s ${frappe-assets.src} apps/frappe yarn --offline production mv sites deps/ runHook postBuild ''; # Do not attempt generating a tarball doDist = false; meta = with lib; { description = "Assets for frappe"; homepage = "https://github.com/frappe/frappe"; license = licenses.mit; maintainers = with maintainers; [ axeman teutat3s ]; }; }; erpnext-modules = mkYarnPackage { pname = "erpnext-modules"; version = erpnext-version; src = fetchFromGitHub { owner = "frappe"; repo = "erpnext"; rev = "v${erpnext-version}"; hash = "sha256-zovdbpTp9fTpY7kAs4J8EiPh+EjqUOtVUk+rDYMfYDk="; }; packageJSON = ../erpnext-package.json; yarnFlags = [ "--production" ]; offlineCache = fetchYarnDeps { yarnLock = ../erpnext-yarn.lock; hash = "sha256-Vho4BSbxcsVYExLvUaeoc3xIpbXoCUP/4jw4RwGnWGY="; }; configurePhase = '' ln -s $node_modules node_modules ''; installPhase = '' ls -alh mkdir $out cp -r node_modules $out/ ls -alh $out/ ''; # We only need node_modules dontBuild = true; # Do not attempt generating a tarball doDist = false; meta = with lib; { description = "Node modules for erpnext"; homepage = "https://github.com/frappe/erpnext"; license = licenses.mit; maintainers = with maintainers; [ axeman teutat3s ]; }; }; postInstall = '' mkdir -p $out/test/frappe $out/test/erpnext ln -s ${frappe-assets} $out/test/frappe ln -s ${erpnext-modules} $out/test/erpnext ''; }