From 0e04dfdccb50c3e0a8f43429a638a2239a1e494d Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 1 Sep 2019 16:20:00 -0500 Subject: [PATCH] pgformatter: init at 4.0 --- .../development/tools/pgformatter/default.nix | 40 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/tools/pgformatter/default.nix diff --git a/pkgs/development/tools/pgformatter/default.nix b/pkgs/development/tools/pgformatter/default.nix new file mode 100644 index 000000000000..5d8376acdb39 --- /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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 96862f9ece8e..83f779d2eb5d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3701,6 +3701,8 @@ in pgf_graphics = callPackage ../tools/graphics/pgf { }; + pgformatter = callPackage ../development/tools/pgformatter { }; + pgloader = callPackage ../development/tools/pgloader { }; pigz = callPackage ../tools/compression/pigz { };