erpnext-nix/node/frappe-erpnext-assets.nix

33 lines
837 B
Nix

{ runCommand
, yarn
, frappe-app
, erpnext-app
}:
runCommand "frappe-erpnext-apps-sites" {buildInputs = [yarn]; } ''
mkdir -p sites apps
# Cannot symlink because the code which traverses path to find sites
# directory gets confused.
cp -r ${frappe-app}/share/apps/frappe apps/frappe
cp -r ${erpnext-app}/share/apps/erpnext apps/erpnext
cat > sites/apps.txt <<EOF
frappe
erpnext
EOF
pushd apps/frappe > /dev/null
yarn --offline production
popd > /dev/null
symlinkPublic() {
find $1/share/apps/$2/$2/public -type d -mindepth 1 -maxdepth 1 | xargs -I '{}' bash -c "ln -s {} sites/assets/$2/"'$(basename {})'
}
symlinkPublic ${frappe-app} frappe
symlinkPublic ${erpnext-app} erpnext
mkdir -p $out/share/sites
cp -r sites/assets $out/share/sites/assets
''