From 52c34f626ca54b8d664dbba925bd5cfc959f9dc7 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Fri, 16 Dec 2016 12:19:59 +0100 Subject: [PATCH] liquibase: improve external jar integration (#20818) This replaces the upstream wrapper script with one tailored for nixpkgs. We gain the ability to selectively enable/disable jdbc backends. --- .../tools/database/liquibase/default.nix | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/database/liquibase/default.nix b/pkgs/development/tools/database/liquibase/default.nix index 5305297a27af..b49719ae0b96 100644 --- a/pkgs/development/tools/database/liquibase/default.nix +++ b/pkgs/development/tools/database/liquibase/default.nix @@ -1,4 +1,13 @@ -{ stdenv, fetchurl, jre, makeWrapper }: +{ stdenv, fetchurl, writeText, jre, makeWrapper, fetchMavenArtifact +, mysqlSupport ? true, mysql_jdbc ? null }: + +assert mysqlSupport -> mysql_jdbc != null; + +with stdenv.lib; +let + extraJars = optional mysqlSupport mysql_jdbc; + +in stdenv.mkDerivation rec { name = "${pname}-${version}"; @@ -16,18 +25,38 @@ stdenv.mkDerivation rec { tar xfz ${src} ''; - installPhase = '' - mkdir -p $out/{bin,lib,sdk} - mv ./* $out/ - wrapProgram $out/liquibase --prefix PATH ":" ${jre}/bin --set LIQUIBASE_HOME $out; - ln -s $out/liquibase $out/bin/liquibase + installPhase = + let addJars = dir: '' + for jar in ${dir}/*.jar; do + CP="\$CP":"\$jar" + done + ''; + in '' + mkdir -p $out/{bin,lib,sdk} + mv ./* $out/ + + # we provide our own script + rm $out/liquibase + + # there’s a lot of escaping, but I’m not sure how to improve that + cat > $out/bin/liquibase <