nixpkgs/pkgs/development/tools/misc/sqitch/default.nix

47 lines
1.1 KiB
Nix
Raw Normal View History

2020-12-16 02:05:38 +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
2015-03-18 13:32:46 +00:00
stdenv.mkDerivation {
2020-12-16 02:05:38 +00:00
pname = "sqitch";
version = sqitch.version;
2020-12-16 02:05:38 +00:00
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin shortenPerlShebang;
2020-12-16 02:05:38 +00:00
src = sqitch;
dontBuild = true;
2015-03-18 13:32:46 +00:00
installPhase = ''
2015-03-15 13:59:41 +00:00
mkdir -p $out/bin
2015-03-15 15:06:01 +00:00
for d in bin/sqitch etc lib share ; do
2017-10-14 07:10:35 +00:00
# make sure dest alreay exists before symlink
# this prevents installing a broken link into the path
2020-12-16 02:05:38 +00:00
if [ -e ${sqitch}/$d ]; then
ln -s ${sqitch}/$d $out/$d
2017-10-14 07:10:35 +00:00
fi
2015-03-15 15:06:01 +00:00
done
2020-12-16 02:05:38 +00:00
'' + lib.optionalString stdenv.isDarwin ''
2019-12-18 09:20:00 +00:00
shortenPerlShebang $out/bin/sqitch
2015-03-15 13:59:41 +00:00
'';
2015-03-18 13:32:46 +00:00
dontStrip = true;
2020-12-16 02:05:38 +00:00
postFixup = ''
wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${perlPackages.makeFullPerlPath modules}
'';
meta = {
2020-12-16 02:05:38 +00:00
inherit (sqitch.meta) description homepage license platforms;
};
2015-03-15 13:59:41 +00:00
}