···3737 };
38383939 initialEmail = mkOption {
4040- description = lib.mdDoc "Initial email for the pgAdmin account.";
4040+ description = lib.mdDoc "Initial email for the pgAdmin account";
4141 type = types.str;
4242 };
43434444 initialPasswordFile = mkOption {
4545 description = lib.mdDoc ''
4646 Initial password file for the pgAdmin account.
4747- NOTE: Should be string not a store path, to prevent the password from being world readable.
4747+ NOTE: Should be string not a store path, to prevent the password from being world readable
4848 '';
4949 type = types.path;
5050 };
51515252+ emailServer = {
5353+ enable = mkOption {
5454+ description = lib.mdDoc ''
5555+ Enable SMTP email server. This is necessary, if you want to use password recovery or change your own password
5656+ '';
5757+ type = types.bool;
5858+ default = false;
5959+ };
6060+ address = mkOption {
6161+ description = lib.mdDoc "SMTP server for email delivery";
6262+ type = types.str;
6363+ default = "localhost";
6464+ };
6565+ port = mkOption {
6666+ description = lib.mdDoc "SMTP server port for email delivery";
6767+ type = types.port;
6868+ default = 25;
6969+ };
7070+ useSSL = mkOption {
7171+ description = lib.mdDoc "SMTP server should use SSL";
7272+ type = types.bool;
7373+ default = false;
7474+ };
7575+ useTLS = mkOption {
7676+ description = lib.mdDoc "SMTP server should use TLS";
7777+ type = types.bool;
7878+ default = false;
7979+ };
8080+ username = mkOption {
8181+ description = lib.mdDoc "SMTP server username for email delivery";
8282+ type = types.nullOr types.str;
8383+ default = null;
8484+ };
8585+ sender = mkOption {
8686+ description = lib.mdDoc ''
8787+ SMTP server sender email for email delivery. Some servers require this to be a valid email address from that server
8888+ '';
8989+ type = types.str;
9090+ example = "noreply@example.com";
9191+ };
9292+ passwordFile = mkOption {
9393+ description = lib.mdDoc ''
9494+ Password for SMTP email account.
9595+ NOTE: Should be string not a store path, to prevent the password from being world readable
9696+ '';
9797+ type = types.path;
9898+ };
9999+ };
100100+52101 openFirewall = mkEnableOption (lib.mdDoc "firewall passthrough for pgadmin4");
5310254103 settings = mkOption {
55104 description = lib.mdDoc ''
56105 Settings for pgadmin4.
5757- [Documentation](https://www.pgadmin.org/docs/pgadmin4/development/config_py.html).
106106+ [Documentation](https://www.pgadmin.org/docs/pgadmin4/development/config_py.html)
58107 '';
59108 type = pyType;
6060- default= {};
109109+ default = { };
61110 };
62111 };
63112···69118 SERVER_MODE = true;
70119 } // (optionalAttrs cfg.openFirewall {
71120 DEFAULT_SERVER = mkDefault "::";
121121+ }) // (optionalAttrs cfg.emailServer.enable {
122122+ MAIL_SERVER = cfg.emailServer.address;
123123+ MAIL_PORT = cfg.emailServer.port;
124124+ MAIL_USE_SSL = cfg.emailServer.useSSL;
125125+ MAIL_USE_TLS = cfg.emailServer.useTLS;
126126+ MAIL_USERNAME = cfg.emailServer.username;
127127+ SECURITY_EMAIL_SENDER = cfg.emailServer.sender;
72128 });
7312974130 systemd.services.pgadmin = {
···115171 group = "pgadmin";
116172 };
117173118118- users.groups.pgadmin = {};
174174+ users.groups.pgadmin = { };
119175120176 environment.etc."pgadmin/config_system.py" = {
121121- text = formatPy cfg.settings;
177177+ text = lib.optionalString cfg.emailServer.enable ''
178178+ with open("${cfg.emailServer.passwordFile}") as f:
179179+ pw = f.read()
180180+ MAIL_PASSWORD = pw
181181+ '' + formatPy cfg.settings;
122182 mode = "0600";
123183 user = "pgadmin";
124184 group = "pgadmin";
+9-10
nixos/tests/pgadmin4.nix
···106106 && sed -i 's|driver_local.maximize_window()||' web/regression/runtests.py"
107107 )
108108109109- # don't bother to test LDAP authentification
110110- # exclude resql test due to recent postgres 14.4 update
111111- # see bugreport here https://redmine.postgresql.org/issues/7527
109109+ # Don't bother to test LDAP or kerberos authentification
110110+ # For now deactivate change_password API test. Current bug report at https://redmine.postgresql.org/issues/7648
111111+ # Password change works from the UI, if email SMTP is configured.
112112 with subtest("run browser test"):
113113 machine.succeed(
114114 'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \
115115 && python regression/runtests.py \
116116 --pkg browser \
117117- --exclude browser.tests.test_ldap_login.LDAPLoginTestCase,browser.tests.test_ldap_login,resql'
117117+ --exclude browser.tests.test_ldap_login.LDAPLoginTestCase,browser.tests.test_ldap_login,browser.tests.test_kerberos_with_mocking,browser.tests.test_change_password'
118118 )
119119120120 # fontconfig is necessary for chromium to run
···126126 && python regression/runtests.py --pkg feature_tests'
127127 )
128128129129- # reactivate this test again, when the postgres 14.4 test has been fixed
130130- # with subtest("run resql test"):
131131- # machine.succeed(
132132- # 'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \
133133- # && python regression/runtests.py --pkg resql'
134134- # )
129129+ with subtest("run resql test"):
130130+ machine.succeed(
131131+ 'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \
132132+ && python regression/runtests.py --pkg resql'
133133+ )
135134 '';
136135 })
+11-8
pkgs/tools/admin/pgadmin/default.nix
···10101111let
1212 pname = "pgadmin";
1313- version = "6.12";
1313+ version = "6.13";
14141515 src = fetchurl {
1616 url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
1717- sha256 = "sha256-cO7GdZDfJ0pq1jpMyrVy0UM49WhrKOIJOmMJauSkbyo=";
1717+ sha256 = "sha256-vLItmE76R1IzgMYEGEvIeOmbfQQac5WK12AkkZknTFU=";
1818 };
19192020 yarnDeps = mkYarnModules {
···7272 azure-identity
7373 ];
74747575- # override necessary on pgadmin4 6.12
7575+ # keep the scope, as it is used throughout the derivation and tests
7676+ # this also makes potential future overrides easier
7677 pythonPackages = python3.pkgs.overrideScope (final: prev: rec {
7777- werkzeug = prev.werkzeug.overridePythonAttrs (oldAttrs: rec {
7878- version = "2.0.3";
7878+ # flask 2.2 is incompatible with pgadmin 6.13
7979+ # https://redmine.postgresql.org/issues/7651
8080+ flask = prev.flask.overridePythonAttrs (oldAttrs: rec {
8181+ version = "2.1.3";
7982 src = oldAttrs.src.override {
8083 inherit version;
8181- sha256 = "sha256-uGP4/wV8UiFktgZ8niiwQRYbS+W6TQ2s7qpQoWOCLTw=";
8484+ sha256 = "sha256-FZcuUBffBXXD1sCQuhaLbbkCWeYgrI1+qBOjlrrVtss=";
8285 };
8386 });
8487 });
···124127125128 # build the documentation
126129 cd docs/en_US
127127- ${sphinx}/bin/sphinx-build -W -b html -d _build/doctrees . _build/html
130130+ sphinx-build -W -b html -d _build/doctrees . _build/html
128131129132 # Build the clean tree
130133 cd ../../web
···156159 cp -v ../pkg/pip/setup_pip.py setup.py
157160 '';
158161159159- nativeBuildInputs = with pythonPackages; [ cython pip ];
162162+ nativeBuildInputs = with pythonPackages; [ cython pip sphinx ];
160163 buildInputs = [
161164 zlib
162165 pythonPackages.wheel