aboutsummaryrefslogtreecommitdiff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2019-09-15 11:38:08 -0500
committerGitHub <noreply@github.com>2019-09-15 11:38:08 -0500
commitedc033a6165f4bb8f64799e285edce16700d3d21 (patch)
tree45b2e03d5cd99c16dd66bd1947a661cbb4011569 /pkgs/development/tools
parent3857d3d6f996b53e063dc15a0fc604a1b8582681 (diff)
parent0e04dfdccb50c3e0a8f43429a638a2239a1e494d (diff)
Merge pull request #67905 from marsam/add-pgformatter
pgformatter: init at 4.0
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/pgformatter/default.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/pkgs/development/tools/pgformatter/default.nix b/pkgs/development/tools/pgformatter/default.nix
new file mode 100644
index 00000000000..5d8376acdb3
--- /dev/null
+++ b/pkgs/development/tools/pgformatter/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, perlPackages, fetchFromGitHub, shortenPerlShebang }:
+
+perlPackages.buildPerlPackage rec {
+ pname = "pgformatter";
+ version = "4.0";
+
+ src = fetchFromGitHub {
+ owner = "darold";
+ repo = "pgFormatter";
+ rev = "v${version}";
+ sha256 = "09p242s406mf469p66zp1jmp9pxcim2vk1v6qsxnrbzicchsn5i2";
+ };
+
+ 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";
+ maintainers = [ maintainers.marsam ];
+ license = [ licenses.postgresql licenses.artistic2 ];
+ };
+}