nixpkgs/pkgs/by-name/li/liquibase/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

99 lines
2.6 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
stdenv,
fetchurl,
gitUpdater,
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.optionals redshiftSupport [
redshift_jdbc
liquibase_redshift_extension
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "liquibase";
version = "4.29.2";
src = fetchurl {
url = "https://github.com/liquibase/liquibase/releases/download/v${finalAttrs.version}/liquibase-${finalAttrs.version}.tar.gz";
hash = "sha256-HQF6IGqVqzB2pS9mBnnC2AufIXSULLBxXjXVOTHiDuk=";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jre ];
sourceRoot = ".";
installPhase =
let
addJars = dir: ''
for jar in ${dir}/*.jar; do
CP="\$CP":"\$jar"
done
'';
in
''
mkdir -p $out
mv ./{lib,licenses} $out/
mkdir -p $out/internal/lib
mv ./internal/lib/*.jar $out/internal/lib/
mkdir -p $out/share/doc/liquibase-${finalAttrs.version}
mv LICENSE.txt \
README.txt \
ABOUT.txt \
changelog.txt \
$out/share/doc/liquibase-${finalAttrs.version}
mkdir -p $out/bin
# theres a lot of escaping, but Im not sure how to improve that
cat > $out/bin/liquibase <<EOF
#!/usr/bin/env bash
# taken from the executable script in the source
CP=""
${addJars "$out/internal/lib"}
${addJars "$out/lib"}
${addJars "$out"}
${lib.concatStringsSep "\n" (map (p: addJars "${p}/share/java") extraJars)}
${lib.getBin jre}/bin/java -cp "\$CP" \$JAVA_OPTS \
liquibase.integration.commandline.LiquibaseCommandLine \''${1+"\$@"}
EOF
chmod +x $out/bin/liquibase
'';
passthru.updateScript = gitUpdater {
url = "https://github.com/liquibase/liquibase";
rev-prefix = "v";
# The latest versions are in the 4.xx series. I am not sure where
# 10.10.10 and 5.0.0 came from, though it appears like they are
# for the commercial product.
ignoredVersions = "10.10.10|5.0.0|.*-beta.*";
};
meta = with lib; {
description = "Version Control for your database";
mainProgram = "liquibase";
homepage = "https://www.liquibase.org/";
changelog = "https://raw.githubusercontent.com/liquibase/liquibase/v${finalAttrs.version}/changelog.txt";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
maintainers = with maintainers; [ jsoo1 ];
platforms = with platforms; unix;
};
})