2020-12-25 13:55:36 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, perlPackages
|
|
|
|
, makeWrapper
|
|
|
|
, shortenPerlShebang
|
|
|
|
, mysqlSupport ? false
|
|
|
|
, postgresqlSupport ? false
|
2023-02-09 11:40:11 +00:00
|
|
|
, templateToolkitSupport ? false
|
2020-12-25 13:55:36 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
sqitch = perlPackages.AppSqitch;
|
|
|
|
modules = with perlPackages; [ ]
|
|
|
|
++ lib.optional mysqlSupport DBDmysql
|
2023-02-09 11:40:11 +00:00
|
|
|
++ lib.optional postgresqlSupport DBDPg
|
|
|
|
++ lib.optional templateToolkitSupport TemplateToolkit;
|
2020-12-25 13:55:36 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|