Skip to content

Commit 8bd1437

Browse files
committed
fix: Fix static postgresql-12+
This fixes a string of errors when building static postgresql: x86_64-unknown-linux-musl-ld: (.text+0xc73): undefined reference to `pg_xyz'
1 parent 6883a93 commit 8bd1437

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

flake.nix

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,6 @@
4444
builtins.attrValues inputs.iohkNix.overlays ++
4545
[ inputs.haskellNix.overlay
4646

47-
(final: prev: with final; {
48-
# Required in order to build postgresql for musl
49-
postgresql = (final.postgresql_11
50-
.overrideAttrs (_: lib.optionalAttrs (stdenv.hostPlatform.isMusl) {
51-
dontDisableStatic = true;
52-
NIX_LDFLAGS = "--push-state --as-needed -lstdc++ --pop-state";
53-
# without this collate.icu.utf8, and foreign_data will fail.
54-
LC_CTYPE = "C";
55-
}))
56-
.override {
57-
enableSystemd = stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isMusl;
58-
gssSupport = stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isMusl;
59-
};
60-
})
61-
6247
(final: prev: {
6348
inherit (project.hsPkgs.cardano-node.components.exes) cardano-node;
6449
inherit (project.hsPkgs.cardano-cli.components.exes) cardano-cli;
@@ -264,6 +249,21 @@
264249
postgresTest;
265250
})
266251

252+
(pkgs.lib.mkIf pkgs.hostPlatform.isMusl
253+
(let
254+
ghcOptions = [
255+
"-L${pkgs.postgresql}/lib"
256+
"-optl-Wl,-lpgport"
257+
"-optl-Wl,-lpgcommon"
258+
];
259+
in {
260+
packages.cardano-chain-gen.ghcOptions = ghcOptions;
261+
packages.cardano-db-sync.ghcOptions = ghcOptions;
262+
packages.cardano-db.ghcOptions = ghcOptions;
263+
packages.cardano-db-tool.ghcOptions = ghcOptions;
264+
packages.cardano-smash-server.ghcOptions = ghcOptions;
265+
}))
266+
267267
({
268268
packages.double-conversion.ghcOptions = [
269269
# stop putting U __gxx_personality_v0 into the library!

0 commit comments

Comments
 (0)