diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-02-09 12:01:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-09 12:01:30 +0000 |
commit | c76e040c19b29c37473fda47c1cb3540d705674b (patch) | |
tree | 36b9de4e1296304b9b19c0a178260bc1f7fed41f /pkgs/tools/admin | |
parent | 73fe6149d4cdd6a07b366c7d36d7daf9f9d6df3e (diff) | |
parent | 724bfc0892363087709bd3a5a1666296759154b1 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/tools/admin')
-rw-r--r-- | pkgs/tools/admin/afterburn/default.nix | 8 | ||||
-rw-r--r-- | pkgs/tools/admin/pgadmin/check-system-config-dir.patch | 17 | ||||
-rw-r--r-- | pkgs/tools/admin/pgadmin/default.nix | 172 |
3 files changed, 130 insertions, 67 deletions
diff --git a/pkgs/tools/admin/afterburn/default.nix b/pkgs/tools/admin/afterburn/default.nix index 8bee8a2e7a533..ddbcaf051825f 100644 --- a/pkgs/tools/admin/afterburn/default.nix +++ b/pkgs/tools/admin/afterburn/default.nix @@ -2,16 +2,16 @@ rustPlatform.buildRustPackage rec { pname = "afterburn"; - version = "5.3.0"; + version = "5.4.0"; src = fetchFromGitHub { owner = "coreos"; repo = "afterburn"; rev = "v${version}"; - sha256 = "sha256-yX95qmcyouSSjEHorMpRJjZyrxIjQorwTpGtGZN4s6s="; + sha256 = "sha256-Y9Z2PdQU7yHTlEXW+/C6v9k+5TkeQMagbC/gGG+JssQ="; }; - cargoSha256 = "sha256-DweJ608aJChn2ezAM7Ly0cwtLAvM1DZ5gc4WUVyKIco="; + cargoHash = "sha256-ZDyB/s2ig3aklEeB1JzNHat+roQniKrMcw4rvy9Z5pk="; nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl ]; @@ -32,6 +32,6 @@ rustPlatform.buildRustPackage rec { description = "This is a small utility, typically used in conjunction with Ignition, which reads metadata from a given cloud-provider and applies it to the system."; license = licenses.asl20; maintainers = [ maintainers.arianvp ]; - platforms = [ "x86_64-linux" ]; + platforms = platforms.linux; }; } diff --git a/pkgs/tools/admin/pgadmin/check-system-config-dir.patch b/pkgs/tools/admin/pgadmin/check-system-config-dir.patch new file mode 100644 index 0000000000000..f614bab64e6fd --- /dev/null +++ b/pkgs/tools/admin/pgadmin/check-system-config-dir.patch @@ -0,0 +1,17 @@ +diff --git a/web/config.py b/web/config.py +index 4774043..5b73fd3 100644 +--- a/web/config.py ++++ b/web/config.py +@@ -884,6 +884,12 @@ if os.path.exists(system_config_dir + '/config_system.py'): + user_config_settings.update(config_system_settings) + except ImportError: + pass ++ except PermissionError: ++ print(f"Permission denied to open {str(system_config_dir + '/config_system.py')}. \n \ ++ If you are running pgadmin4-desktopmode please make sure you disable \n \ ++ the pgadmin NixOS module first. If you rely on settings in \n \ ++ {str(system_config_dir + '/config_system.py')}, please check the correct permissions.") ++ pass + + # Update settings for 'LOG_FILE', 'SQLITE_PATH', 'SESSION_DB_PATH', + # 'AZURE_CREDENTIAL_CACHE_DIR', 'KERBEROS_CCACHE_DIR', 'STORAGE_DIR' \ No newline at end of file diff --git a/pkgs/tools/admin/pgadmin/default.nix b/pkgs/tools/admin/pgadmin/default.nix index d00b61744dc15..a83d96779de6a 100644 --- a/pkgs/tools/admin/pgadmin/default.nix +++ b/pkgs/tools/admin/pgadmin/default.nix @@ -7,6 +7,9 @@ , nixosTests , pkgs , fetchPypi +, postgresqlTestHook +, postgresql +, server-mode ? true }: let @@ -26,54 +29,6 @@ let yarnNix = ./yarn.nix; }; - # move buildDeps here to easily pass to test suite - buildDeps = with pythonPackages; [ - flask - flask-gravatar - flask-login - flask_mail - flask_migrate - flask-sqlalchemy - flask-wtf - 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 - azure-mgmt-subscription - azure-mgmt-rdbms - azure-mgmt-resource - azure-identity - sphinxcontrib-youtube - dnspython - greenlet - ]; # keep the scope, as it is used throughout the derivation and tests # this also makes potential future overrides easier @@ -134,6 +89,8 @@ pythonPackages.buildPythonApplication rec { patches = [ # Expose setup.py for later use ./expose-setup.py.patch + # check for permission of /etc/pgadmin/config_system and don't fail + ./check-system-config-dir.patch ]; postPatch = '' @@ -149,10 +106,12 @@ pythonPackages.buildPythonApplication rec { # relax dependencies sed 's|==|>=|g' -i requirements.txt - # 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" + --replace "req = req.replace('psycopg2', 'psycopg2-binary')" "req = req" + ${lib.optionalString (!server-mode) '' + substituteInPlace web/config.py \ + --replace "SERVER_MODE = True" "SERVER_MODE = False" + ''} ''; preBuild = '' @@ -200,23 +159,110 @@ pythonPackages.buildPythonApplication rec { pythonPackages.wheel ]; - # tests need an own data, log directory - # and a working and correctly setup postgres database - # checks will be run through nixos/tests - doCheck = false; - - # speaklater3 is separate because when passing buildDeps - # to the test, it fails there due to a collision with speaklater - propagatedBuildInputs = buildDeps ++ [ pythonPackages.speaklater3 ]; + propagatedBuildInputs = with pythonPackages; [ + flask + flask-gravatar + flask-login + flask_mail + flask_migrate + flask-sqlalchemy + flask-wtf + 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 + azure-mgmt-subscription + azure-mgmt-rdbms + azure-mgmt-resource + azure-identity + sphinxcontrib-youtube + dnspython + greenlet + speaklater3 + ]; passthru.tests = { - standalone = nixosTests.pgadmin4-standalone; - # regression and function tests of the package itself - package = import ../../../../nixos/tests/pgadmin4.nix { inherit pkgs buildDeps; pythonEnv = pythonPackages; }; + inherit (nixosTests) pgadmin4; }; + nativeCheckInputs = [ + postgresqlTestHook + postgresql + pythonPackages.testscenarios + pythonPackages.selenium + ]; + + checkPhase = '' + runHook preCheck + + ## Setup ## + + # pgadmin needs a home directory to save the configuration + export HOME=$TMPDIR + cd pgadmin4 + + # set configuration for postgresql test + # also ensure Server Mode is set to false. If not, the tests will fail, since pgadmin expects read/write permissions + # in /var/lib/pgadmin and /var/log/pgadmin + # see https://github.com/pgadmin-org/pgadmin4/blob/fd1c26408bbf154fa455a49ee5c12895933833a3/web/regression/runtests.py#L217-L226 + cp -v regression/test_config.json.in regression/test_config.json + substituteInPlace regression/test_config.json --replace "localhost" "$PGHOST" + substituteInPlace regression/runtests.py --replace "builtins.SERVER_MODE = None" "builtins.SERVER_MODE = False" + + ## Browser test ## + + # don't bother to test kerberos authentication + python regression/runtests.py --pkg browser --exclude browser.tests.test_kerberos_with_mocking + + ## Reverse engineered SQL test ## + + python regression/runtests.py --pkg resql + + runHook postCheck + ''; + meta = with lib; { - description = "Administration and development platform for PostgreSQL"; + description = "Administration and development platform for PostgreSQL${optionalString (!server-mode) ". Desktop Mode"}"; + longDescription = '' + pgAdmin 4 is designed to meet the needs of both novice and experienced Postgres users alike, + providing a powerful graphical interface that simplifies the creation, maintenance and use of database objects. + ${if server-mode then '' + This version is build with SERVER_MODE set to True (the default). It will require access to `/var/lib/pgadmin` + and `/var/log/pgadmin`. This is the default version for the NixOS module `services.pgadmin`. + This should NOT be used in combination with the `pgadmin4-desktopmode` package as they will interfere. + '' else '' + This version is build with SERVER_MODE set to False. It will require access to `~/.pgadmin/`. This version is suitable + for single-user deployment or where access to `/var/lib/pgadmin` cannot be granted or the NixOS module cannot be used. + This should NOT be used in combination with the NixOS module `pgadmin` as they will interfere. + ''} + ''; homepage = "https://www.pgadmin.org/"; license = licenses.mit; changelog = "https://www.pgadmin.org/docs/pgadmin4/latest/release_notes_${lib.versions.major version}_${lib.versions.minor version}.html"; |