depot/pkgs/development/tools/misc/sqitch/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

49 lines
1.2 KiB
Nix

{ stdenv
, lib
, perlPackages
, makeWrapper
, shortenPerlShebang
, mysqlSupport ? false
, postgresqlSupport ? false
, templateToolkitSupport ? false
}:
let
sqitch = perlPackages.AppSqitch;
modules = with perlPackages; [ AlgorithmBackoff ]
++ lib.optional mysqlSupport DBDmysql
++ lib.optional postgresqlSupport DBDPg
++ lib.optional templateToolkitSupport TemplateToolkit;
in
stdenv.mkDerivation {
pname = "sqitch";
version = sqitch.version;
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.hostPlatform.isDarwin shortenPerlShebang;
src = sqitch;
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
if [ -e ${sqitch}/$d ]; then
ln -s ${sqitch}/$d $out/$d
fi
done
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
shortenPerlShebang $out/bin/sqitch
'';
dontStrip = true;
postFixup = ''
wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${lib.escapeShellArg (perlPackages.makeFullPerlPath modules)}
'';
meta = {
inherit (sqitch.meta) description homepage license platforms;
mainProgram = "sqitch";
};
}