2020-12-25 13:55:36 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, perlPackages
|
|
|
|
, makeWrapper
|
|
|
|
, shortenPerlShebang
|
|
|
|
, mysqlSupport ? false
|
|
|
|
, postgresqlSupport ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
sqitch = perlPackages.AppSqitch;
|
|
|
|
modules = with perlPackages; [ ]
|
|
|
|
++ lib.optional mysqlSupport DBDmysql
|
|
|
|
++ lib.optional postgresqlSupport DBDPg;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2020-12-25 13:55:36 +00:00
|
|
|
pname = "sqitch";
|
|
|
|
version = sqitch.version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin shortenPerlShebang;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
src = sqitch;
|
2020-04-24 23:36:52 +00:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
for d in bin/sqitch etc lib share ; do
|
|
|
|
# make sure dest alreay exists before symlink
|
|
|
|
# this prevents installing a broken link into the path
|
2020-12-25 13:55:36 +00:00
|
|
|
if [ -e ${sqitch}/$d ]; then
|
|
|
|
ln -s ${sqitch}/$d $out/$d
|
2020-04-24 23:36:52 +00:00
|
|
|
fi
|
|
|
|
done
|
2020-12-25 13:55:36 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
shortenPerlShebang $out/bin/sqitch
|
|
|
|
'';
|
|
|
|
dontStrip = true;
|
2020-12-25 13:55:36 +00:00
|
|
|
postFixup = ''
|
2022-05-18 14:49:53 +00:00
|
|
|
wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${lib.escapeShellArg (perlPackages.makeFullPerlPath modules)}
|
2020-12-25 13:55:36 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
2020-12-25 13:55:36 +00:00
|
|
|
inherit (sqitch.meta) description homepage license platforms;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|