16 url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
17 sha256 = "sha256-S//Rfi8IiBo+lL0BCFVBw+hy2Tw37B349Gcpq2knqSM=";
20 yarnDeps = mkYarnModules {
21 pname = "${pname}-yarn-deps";
23 packageJSON = ./package.json;
24 yarnLock = ./yarn.lock;
28 # move buildDeps here to easily pass to test suite
29 buildDeps = with pythonPackages; [
68 azure-mgmt-subscription
74 # keep the scope, as it is used throughout the derivation and tests
75 # this also makes potential future overrides easier
76 pythonPackages = python3.pkgs.overrideScope (final: prev: rec {
77 # flask 2.2 is incompatible with pgadmin 6.15
78 # https://redmine.postgresql.org/issues/7651
79 flask = prev.flask.overridePythonAttrs (oldAttrs: rec {
81 src = oldAttrs.src.override {
83 sha256 = "sha256-FZcuUBffBXXD1sCQuhaLbbkCWeYgrI1+qBOjlrrVtss=";
86 # pgadmin 6.15 is incompatible with the major flask-security-too update to 5.0.x
87 flask-security-too = prev.flask-security-too.overridePythonAttrs (oldAttrs: rec {
89 src = oldAttrs.src.override {
91 sha256 = "sha256-98jKcHDv/+mls7QVWeGvGcmoYOGCspxM7w5/2RjJxoM=";
93 propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
94 final.pythonPackages.flask_mail
95 final.pythonPackages.pyqrcode
102 pythonPackages.buildPythonApplication rec {
103 inherit pname version src;
106 CPPFLAGS = "-DPNG_ARM_NEON_OPT=0";
108 format = "setuptools";
111 # Expose setup.py for later use
112 ./expose-setup.py.patch
116 # patching Makefile, so it doesn't try to build sphinx documentation here
118 substituteInPlace Makefile \
119 --replace 'LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 $(MAKE) -C docs/en_US -f Makefile.sphinx html' "true"
121 # fix document which refers a non-existing document and fails
122 substituteInPlace docs/en_US/contributions.rst \
123 --replace "code_snippets" ""
127 sed 's|==|>=|g' -i requirements.txt
128 # don't use Server Mode (can be overridden later)
129 substituteInPlace pkg/pip/setup_pip.py \
130 --replace "req = req.replace('psycopg2', 'psycopg2-binary')" "req = req" \
131 --replace "builtins.SERVER_MODE = None" "builtins.SERVER_MODE = False"
135 # Adapted from pkg/pip/build.sh
136 echo Creating required directories...
137 mkdir -p pip-build/pgadmin4/docs
139 # build the documentation
141 sphinx-build -W -b html -d _build/doctrees . _build/html
143 # Build the clean tree
145 cp -r * ../pip-build/pgadmin4
147 cp -r * ../pip-build/pgadmin4/docs
148 for DIR in `ls -d ??_??/`
150 if [ -d ''${DIR}_build/html ]; then
151 mkdir -p ../pip-build/pgadmin4/docs/''${DIR}_build
152 cp -Rv ''${DIR}_build/html ../pip-build/pgadmin4/docs/''${DIR}_build
157 cp -r ${yarnDeps}/* pip-build/pgadmin4
159 echo Creating distro config...
160 echo HELP_PATH = \'../../docs/en_US/_build/html/\' > pip-build/pgadmin4/config_distro.py
161 echo MINIFY_HTML = False >> pip-build/pgadmin4/config_distro.py
163 echo Creating manifest...
164 echo recursive-include pgadmin4 \* > pip-build/MANIFEST.in
166 echo Building wheel...
168 # copy non-standard setup.py to local directory
169 # so setuptools-build-hook can call it
170 cp -v ../pkg/pip/setup_pip.py setup.py
173 nativeBuildInputs = with pythonPackages; [ cython pip sphinx ];
179 # tests need an own data, log directory
180 # and a working and correctly setup postgres database
181 # checks will be run through nixos/tests
184 # speaklater3 is seperate because when passing buildDeps
185 # to the test, it fails there due to a collision with speaklater
186 propagatedBuildInputs = buildDeps ++ [ pythonPackages.speaklater3 ];
189 standalone = nixosTests.pgadmin4-standalone;
190 # regression and function tests of the package itself
191 package = import ../../../../nixos/tests/pgadmin4.nix { inherit pkgs buildDeps; pythonEnv = pythonPackages; };
195 description = "Administration and development platform for PostgreSQL";
196 homepage = "https://www.pgadmin.org/";
197 license = licenses.mit;
198 changelog = "https://www.pgadmin.org/docs/pgadmin4/latest/release_notes_${lib.versions.major version}_${lib.versions.minor version}.html";
199 maintainers = with maintainers; [ gador ];
200 mainProgram = "pgadmin4";