2022-04-27 09:35:20 +00:00
|
|
|
{ lib
|
2022-03-05 16:20:37 +00:00
|
|
|
, python3
|
|
|
|
, fetchurl
|
|
|
|
, zlib
|
|
|
|
, mkYarnModules
|
|
|
|
, sphinx
|
|
|
|
, nixosTests
|
2022-04-27 09:35:20 +00:00
|
|
|
, pkgs
|
2022-03-05 16:20:37 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "pgadmin";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "6.18";
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
|
2023-01-11 07:51:40 +00:00
|
|
|
sha256 = "sha256-qqilmJLpJ3XNd8dwk7bDAAPxt8sou5zydFMPcJGcGoo=";
|
2022-03-05 16:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
yarnDeps = mkYarnModules {
|
|
|
|
pname = "${pname}-yarn-deps";
|
|
|
|
inherit version;
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
};
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
# move buildDeps here to easily pass to test suite
|
|
|
|
buildDeps = with pythonPackages; [
|
|
|
|
flask
|
|
|
|
flask-gravatar
|
2022-10-21 18:38:19 +00:00
|
|
|
flask-login
|
2022-04-27 09:35:20 +00:00
|
|
|
flask_mail
|
|
|
|
flask_migrate
|
2022-08-12 12:06:08 +00:00
|
|
|
flask-sqlalchemy
|
2022-06-16 17:23:12 +00:00
|
|
|
flask-wtf
|
2022-04-27 09:35:20 +00:00
|
|
|
flask-compress
|
|
|
|
passlib
|
|
|
|
pytz
|
|
|
|
simplejson
|
|
|
|
sqlparse
|
|
|
|
wtforms
|
|
|
|
flask-paranoid
|
|
|
|
psutil
|
|
|
|
psycopg2
|
|
|
|
python-dateutil
|
|
|
|
sqlalchemy
|
|
|
|
itsdangerous
|
|
|
|
flask-security-too
|
|
|
|
bcrypt
|
|
|
|
cryptography
|
|
|
|
sshtunnel
|
|
|
|
ldap3
|
|
|
|
flask-babelex
|
|
|
|
flask-babel
|
|
|
|
gssapi
|
|
|
|
flask-socketio
|
|
|
|
eventlet
|
|
|
|
httpagentparser
|
|
|
|
user-agents
|
|
|
|
wheel
|
|
|
|
authlib
|
|
|
|
qrcode
|
|
|
|
pillow
|
|
|
|
pyotp
|
|
|
|
botocore
|
|
|
|
boto3
|
2022-07-18 16:21:45 +00:00
|
|
|
azure-mgmt-subscription
|
|
|
|
azure-mgmt-rdbms
|
|
|
|
azure-mgmt-resource
|
|
|
|
azure-identity
|
2022-04-27 09:35:20 +00:00
|
|
|
];
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# keep the scope, as it is used throughout the derivation and tests
|
|
|
|
# this also makes potential future overrides easier
|
2022-04-27 09:35:20 +00:00
|
|
|
pythonPackages = python3.pkgs.overrideScope (final: prev: rec {
|
2023-01-11 07:51:40 +00:00
|
|
|
# flask 2.2 is incompatible with pgadmin 6.18
|
2022-09-30 11:47:45 +00:00
|
|
|
# https://redmine.postgresql.org/issues/7651
|
|
|
|
flask = prev.flask.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.1.3";
|
2022-04-27 09:35:20 +00:00
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2022-09-30 11:47:45 +00:00
|
|
|
sha256 = "sha256-FZcuUBffBXXD1sCQuhaLbbkCWeYgrI1+qBOjlrrVtss=";
|
2022-04-27 09:35:20 +00:00
|
|
|
};
|
|
|
|
});
|
2023-01-20 10:41:00 +00:00
|
|
|
# flask 2.1.3 is incompatible with flask-sqlalchemy > 3
|
|
|
|
flask-sqlalchemy = prev.flask-sqlalchemy.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.5.1";
|
|
|
|
format = "setuptools";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-K9pEtD58rLFdTgX/PMH4vJeTbMRkYjQkECv8LDXpWRI=";
|
|
|
|
};
|
|
|
|
});
|
2023-01-11 07:51:40 +00:00
|
|
|
# pgadmin 6.18 is incompatible with the major flask-security-too update to 5.0.x
|
2022-10-06 18:32:54 +00:00
|
|
|
flask-security-too = prev.flask-security-too.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "4.1.5";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "sha256-98jKcHDv/+mls7QVWeGvGcmoYOGCspxM7w5/2RjJxoM=";
|
|
|
|
};
|
|
|
|
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
|
|
|
|
final.pythonPackages.flask_mail
|
|
|
|
final.pythonPackages.pyqrcode
|
|
|
|
];
|
|
|
|
});
|
2022-04-27 09:35:20 +00:00
|
|
|
});
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
in
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
pythonPackages.buildPythonApplication rec {
|
2022-03-05 16:20:37 +00:00
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
# from Dockerfile
|
|
|
|
CPPFLAGS = "-DPNG_ARM_NEON_OPT=0";
|
|
|
|
|
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Expose setup.py for later use
|
|
|
|
./expose-setup.py.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# patching Makefile, so it doesn't try to build sphinx documentation here
|
|
|
|
# (will do so later)
|
2022-06-16 17:23:12 +00:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 $(MAKE) -C docs/en_US -f Makefile.sphinx html' "true"
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
# fix document which refers a non-existing document and fails
|
2022-06-16 17:23:12 +00:00
|
|
|
substituteInPlace docs/en_US/contributions.rst \
|
|
|
|
--replace "code_snippets" ""
|
2022-03-05 16:20:37 +00:00
|
|
|
patchShebangs .
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
# relax dependencies
|
2022-08-12 12:06:08 +00:00
|
|
|
sed 's|==|>=|g' -i requirements.txt
|
2022-03-05 16:20:37 +00:00
|
|
|
# don't use Server Mode (can be overridden later)
|
|
|
|
substituteInPlace pkg/pip/setup_pip.py \
|
|
|
|
--replace "req = req.replace('psycopg2', 'psycopg2-binary')" "req = req" \
|
|
|
|
--replace "builtins.SERVER_MODE = None" "builtins.SERVER_MODE = False"
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
# Adapted from pkg/pip/build.sh
|
|
|
|
echo Creating required directories...
|
|
|
|
mkdir -p pip-build/pgadmin4/docs
|
|
|
|
|
|
|
|
# build the documentation
|
|
|
|
cd docs/en_US
|
2022-09-30 11:47:45 +00:00
|
|
|
sphinx-build -W -b html -d _build/doctrees . _build/html
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
# Build the clean tree
|
|
|
|
cd ../../web
|
|
|
|
cp -r * ../pip-build/pgadmin4
|
|
|
|
cd ../docs
|
|
|
|
cp -r * ../pip-build/pgadmin4/docs
|
|
|
|
for DIR in `ls -d ??_??/`
|
|
|
|
do
|
|
|
|
if [ -d ''${DIR}_build/html ]; then
|
|
|
|
mkdir -p ../pip-build/pgadmin4/docs/''${DIR}_build
|
2023-01-11 07:51:40 +00:00
|
|
|
cp -R ''${DIR}_build/html ../pip-build/pgadmin4/docs/''${DIR}_build
|
2022-03-05 16:20:37 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd ../
|
|
|
|
|
|
|
|
cp -r ${yarnDeps}/* pip-build/pgadmin4
|
|
|
|
|
|
|
|
echo Creating distro config...
|
|
|
|
echo HELP_PATH = \'../../docs/en_US/_build/html/\' > pip-build/pgadmin4/config_distro.py
|
|
|
|
echo MINIFY_HTML = False >> pip-build/pgadmin4/config_distro.py
|
|
|
|
|
|
|
|
echo Creating manifest...
|
|
|
|
echo recursive-include pgadmin4 \* > pip-build/MANIFEST.in
|
|
|
|
|
|
|
|
echo Building wheel...
|
|
|
|
cd pip-build
|
|
|
|
# copy non-standard setup.py to local directory
|
|
|
|
# so setuptools-build-hook can call it
|
|
|
|
cp -v ../pkg/pip/setup_pip.py setup.py
|
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = with pythonPackages; [ cython pip sphinx ];
|
2022-03-05 16:20:37 +00:00
|
|
|
buildInputs = [
|
|
|
|
zlib
|
2022-04-27 09:35:20 +00:00
|
|
|
pythonPackages.wheel
|
2022-03-05 16:20:37 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# tests need an own data, log directory
|
|
|
|
# and a working and correctly setup postgres database
|
|
|
|
# checks will be run through nixos/tests
|
|
|
|
doCheck = false;
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
# speaklater3 is separate because when passing buildDeps
|
2022-04-27 09:35:20 +00:00
|
|
|
# to the test, it fails there due to a collision with speaklater
|
|
|
|
propagatedBuildInputs = buildDeps ++ [ pythonPackages.speaklater3 ];
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
passthru.tests = {
|
|
|
|
standalone = nixosTests.pgadmin4-standalone;
|
|
|
|
# regression and function tests of the package itself
|
2022-06-16 17:23:12 +00:00
|
|
|
package = import ../../../../nixos/tests/pgadmin4.nix { inherit pkgs buildDeps; pythonEnv = pythonPackages; };
|
2022-03-05 16:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Administration and development platform for PostgreSQL";
|
|
|
|
homepage = "https://www.pgadmin.org/";
|
|
|
|
license = licenses.mit;
|
2022-04-27 09:35:20 +00:00
|
|
|
changelog = "https://www.pgadmin.org/docs/pgadmin4/latest/release_notes_${lib.versions.major version}_${lib.versions.minor version}.html";
|
2022-03-05 16:20:37 +00:00
|
|
|
maintainers = with maintainers; [ gador ];
|
2022-06-16 17:23:12 +00:00
|
|
|
mainProgram = "pgadmin4";
|
2022-03-05 16:20:37 +00:00
|
|
|
};
|
|
|
|
}
|