summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorConnor Feeley <git@cfeeley.org>2023-11-19 13:57:26 -0500
committerCole Helbling <cole.e.helbling@outlook.com>2023-11-20 17:19:05 -0800
commit6d50b4ba87d53263521395a01f893ab148545597 (patch)
treebcc0631bfe1d89d82aa8efbd8ac831375eb3d192 /pkgs
parent042dce1f6815b11d1af84bbdc79789698479825f (diff)
pgbadger: fix build on darwin
The pgbadger build was failing on darwin due to an error while trying to
generate the package's documentation.

The pgbadger script is executed during the build to dump the help text.
The script's shebang line is too long on Darwin and needs to be
shortened using 'shortenPerlShebang' for it to execute.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/tools/misc/pgbadger/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/tools/misc/pgbadger/default.nix b/pkgs/tools/misc/pgbadger/default.nix
index ed1646c04f824..b335f644312ab 100644
--- a/pkgs/tools/misc/pgbadger/default.nix
+++ b/pkgs/tools/misc/pgbadger/default.nix
@@ -1,4 +1,4 @@
-{ buildPerlPackage, stdenv, lib, fetchFromGitHub, which, bzip2, PodMarkdown, JSONXS
+{ buildPerlPackage, shortenPerlShebang, stdenv, lib, fetchFromGitHub, which, bzip2, PodMarkdown, JSONXS
 , TextCSV_XS }:
 buildPerlPackage rec {
   pname = "pgbadger";
@@ -14,11 +14,19 @@ buildPerlPackage rec {
     patchShebangs ./pgbadger
   '';
 
+  # pgbadger has too many `-Idir` flags on its shebang line on Darwin,
+  # causing the build to fail when trying to generate the documentation.
+  # Rewrite the -I flags in `use lib` form.
+  preBuild = lib.optionalString stdenv.isDarwin ''
+    shortenPerlShebang ./pgbadger
+  '';
+
   outputs = [ "out" ];
 
   PERL_MM_OPT = "INSTALL_BASE=${placeholder "out"}";
 
   buildInputs = [ PodMarkdown JSONXS TextCSV_XS ];
+  nativeBuildInputs = lib.optionals stdenv.isDarwin [ shortenPerlShebang ];
 
   nativeCheckInputs = [ which bzip2 ];
 
@@ -28,6 +36,5 @@ buildPerlPackage rec {
     changelog = "https://github.com/darold/pgbadger/raw/v${version}/ChangeLog";
     license = lib.licenses.postgresql;
     maintainers = lib.teams.determinatesystems.members;
-    broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/pgbadger.x86_64-darwin
   };
 }