From e5b0ba7750d1883f4db96ec80b808a49ac4480a2 Mon Sep 17 00:00:00 2001 From: Julien Debon Date: Tue, 26 Apr 2022 09:53:03 +0200 Subject: [PATCH 1/3] redshift_jdbc: init at 2.1.0.3 --- .../java-modules/redshift_jdbc/default.nix | 28 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/development/java-modules/redshift_jdbc/default.nix diff --git a/pkgs/development/java-modules/redshift_jdbc/default.nix b/pkgs/development/java-modules/redshift_jdbc/default.nix new file mode 100644 index 000000000000..ab15b136e14c --- /dev/null +++ b/pkgs/development/java-modules/redshift_jdbc/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchMavenArtifact }: + +stdenv.mkDerivation rec { + pname = "redshift-jdbc"; + version = "2.1.0.3"; + + src = fetchMavenArtifact { + artifactId = "redshift-jdbc42"; + groupId = "com.amazon.redshift"; + sha256 = "sha256-TO/JXh/pZ7tUZGfHqkzgZx18gLnISvnPVyGavzFv6vo="; + inherit version; + }; + + installPhase = '' + runHook preInstall + install -m444 -D $src/share/java/redshift-jdbc42-${version}.jar $out/share/java/redshift-jdbc42.jar + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/aws/amazon-redshift-jdbc-driver/"; + description = + "JDBC 4.2 driver for Amazon Redshift allowing Java programs to connect to a Redshift database"; + license = licenses.asl20; + platforms = platforms.unix; + maintainers = with maintainers; [ sir4ur0n ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8372577fb5fd..03196d54ceca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22281,6 +22281,8 @@ with pkgs; postgresqlTestHook = callPackage ../build-support/setup-hooks/postgresql-test-hook { }; + redshift_jdbc = callPackage ../development/java-modules/redshift_jdbc { }; + prom2json = callPackage ../servers/monitoring/prometheus/prom2json.nix { }; prometheus = callPackage ../servers/monitoring/prometheus { }; prometheus-alertmanager = callPackage ../servers/monitoring/prometheus/alertmanager.nix { }; From a7c93695a5254a0d9fa73c6f9e7628791a9c31a9 Mon Sep 17 00:00:00 2001 From: Julien Debon Date: Tue, 26 Apr 2022 09:54:02 +0200 Subject: [PATCH 2/3] liquibase_redshift_extension: init at 4.8.0 --- .../liquibase_redshift_extension/default.nix | 27 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/development/java-modules/liquibase_redshift_extension/default.nix diff --git a/pkgs/development/java-modules/liquibase_redshift_extension/default.nix b/pkgs/development/java-modules/liquibase_redshift_extension/default.nix new file mode 100644 index 000000000000..ba15086ae0ab --- /dev/null +++ b/pkgs/development/java-modules/liquibase_redshift_extension/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchMavenArtifact }: + +stdenv.mkDerivation rec { + pname = "liquibase-redshift-extension"; + version = "4.8.0"; + + src = fetchMavenArtifact { + artifactId = "liquibase-redshift"; + groupId = "org.liquibase.ext"; + sha256 = "sha256-jZdDKAC4Cvmkih8VH84Z3Q8BzsqGO55Uefr8vOlbDAk="; + inherit version; + }; + + installPhase = '' + runHook preInstall + install -m444 -D $src/share/java/liquibase-redshift-${version}.jar $out/share/java/liquibase-redshift.jar + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/liquibase/liquibase-redshift/"; + description = "Amazon Redshift extension for Liquibase"; + license = licenses.asl20; + platforms = platforms.unix; + maintainers = with maintainers; [ sir4ur0n ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 03196d54ceca..b0c4907e3e23 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22283,6 +22283,8 @@ with pkgs; redshift_jdbc = callPackage ../development/java-modules/redshift_jdbc { }; + liquibase_redshift_extension = callPackage ../development/java-modules/liquibase_redshift_extension { }; + prom2json = callPackage ../servers/monitoring/prometheus/prom2json.nix { }; prometheus = callPackage ../servers/monitoring/prometheus { }; prometheus-alertmanager = callPackage ../servers/monitoring/prometheus/alertmanager.nix { }; From 3ffe1ccca03d732f4b5cb435ed4be7cef86a29c2 Mon Sep 17 00:00:00 2001 From: Julien Debon Date: Tue, 26 Apr 2022 09:55:14 +0200 Subject: [PATCH 3/3] liquibase: add support for Amazon Redshift The Liquibase package already provided PostgreSQL and MySQL support, this commit also adds support for Amazon Redshift. As per Liquibase Redshift documentation, 2 JARs must be added to the classpath: * Redshift JDBC * Liquibase Redshift extension JAR --- .../tools/database/liquibase/default.nix | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/database/liquibase/default.nix b/pkgs/development/tools/database/liquibase/default.nix index 87a66f9bdab7..0d7130f7def3 100644 --- a/pkgs/development/tools/database/liquibase/default.nix +++ b/pkgs/development/tools/database/liquibase/default.nix @@ -1,11 +1,25 @@ -{ lib, stdenv, fetchurl, jre, makeWrapper -, mysqlSupport ? true, mysql_jdbc -, postgresqlSupport ? true, postgresql_jdbc }: +{ lib +, stdenv +, fetchurl +, jre +, makeWrapper +, mysqlSupport ? true +, mysql_jdbc +, postgresqlSupport ? true +, postgresql_jdbc +, redshiftSupport ? true +, redshift_jdbc +, liquibase_redshift_extension +}: let extraJars = lib.optional mysqlSupport mysql_jdbc - ++ lib.optional postgresqlSupport postgresql_jdbc; + ++ lib.optional postgresqlSupport postgresql_jdbc + ++ lib.optionals redshiftSupport [ + redshift_jdbc + liquibase_redshift_extension + ]; in stdenv.mkDerivation rec { @@ -30,7 +44,8 @@ stdenv.mkDerivation rec { CP="\$CP":"\$jar" done ''; - in '' + in + '' mkdir -p $out mv ./{lib,licenses,liquibase.jar} $out/ @@ -54,7 +69,7 @@ stdenv.mkDerivation rec { liquibase.integration.commandline.Main \''${1+"\$@"} EOF chmod +x $out/bin/liquibase - ''; + ''; meta = with lib; { description = "Version Control for your database";