2019-09-01 23:20:00 +02:00
|
|
|
{ stdenv, perlPackages, fetchFromGitHub, shortenPerlShebang }:
|
|
|
|
|
|
|
|
perlPackages.buildPerlPackage rec {
|
|
|
|
pname = "pgformatter";
|
2020-01-26 11:00:00 +01:00
|
|
|
version = "4.2";
|
2019-09-01 23:20:00 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "darold";
|
|
|
|
repo = "pgFormatter";
|
|
|
|
rev = "v${version}";
|
2020-01-26 11:00:00 +01:00
|
|
|
sha256 = "1fqhbs7q3nxda7acbcx8dyjh99d0mv485dpmiczxia7cy1xqi63g";
|
2019-09-01 23:20:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" ];
|
|
|
|
|
|
|
|
makeMakerFlags = [ "INSTALLDIRS=vendor" ];
|
|
|
|
|
|
|
|
# Makefile.PL only accepts DESTDIR and INSTALLDIRS, but we need to set more to make this work for NixOS.
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace pg_format \
|
|
|
|
--replace "#!/usr/bin/env perl" "#!/usr/bin/perl"
|
|
|
|
substituteInPlace Makefile.PL \
|
|
|
|
--replace "'DESTDIR' => \$DESTDIR," "'DESTDIR' => '$out/'," \
|
|
|
|
--replace "'INSTALLDIRS' => \$INSTALLDIRS," "'INSTALLDIRS' => \$INSTALLDIRS, 'INSTALLVENDORLIB' => 'bin/lib', 'INSTALLVENDORBIN' => 'bin', 'INSTALLVENDORSCRIPT' => 'bin', 'INSTALLVENDORMAN1DIR' => 'share/man/man1', 'INSTALLVENDORMAN3DIR' => 'share/man/man3',"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin shortenPerlShebang;
|
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
shortenPerlShebang $out/bin/pg_format
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI";
|
|
|
|
homepage = "https://github.com/darold/pgFormatter";
|
2020-01-26 11:00:00 +01:00
|
|
|
changelog = "https://github.com/darold/pgFormatter/releases/tag/v${version}";
|
2019-09-01 23:20:00 +02:00
|
|
|
maintainers = [ maintainers.marsam ];
|
|
|
|
license = [ licenses.postgresql licenses.artistic2 ];
|
|
|
|
};
|
|
|
|
}
|