Skip to content

Commit 72d4ffd

Browse files
committed
flake: fix static build on amd64
1 parent 049c5aa commit 72d4ffd

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

flake.nix

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
}))
4141
(libff.override { enableStatic = true; })
4242
(ncurses.override { enableStatic = true; })
43+
] ++ lib.optionals (pkgs.stdenv.hostPlatform.isLinux && pkgs.stdenv.hostPlatform.isx86_64) [
44+
# FIXME: work around wrong libdw / libelf linking on musl builds on x86_64
45+
(lib.getLib xz)
46+
(lib.getLib bzip2)
47+
(lib.getLib zstd)
4348
] ++ lib.optionals (!pkgs.stdenv.hostPlatform.isDarwin) [
4449
# darwin provides these
4550
(zlib.override { static = true; shared = false; })
@@ -69,11 +74,23 @@
6974

7075
echidna-static = with pkgsGHC; lib.pipe
7176
(echidna pkgsGHC)
72-
[
77+
([
7378
(haskell.lib.compose.appendConfigureFlags
7479
(map (drv: "--extra-lib-dirs=${stripDylib drv}/lib") dependencies-static))
7580
(haskell.lib.compose.enableCabalFlag "static")
76-
];
81+
] ++ lib.optionals (pkgs.stdenv.hostPlatform.isLinux && pkgs.stdenv.hostPlatform.isx86_64) [
82+
# FIXME: work around wrong libdw / libelf linking on musl builds on x86_64
83+
(haskell.lib.compose.appendConfigureFlags [
84+
"--ghc-option=-optl-Wl,--start-group"
85+
"--ghc-option=-optl-lelf"
86+
"--ghc-option=-optl-ldw"
87+
"--ghc-option=-optl-lzstd"
88+
"--ghc-option=-optl-lz"
89+
"--ghc-option=-optl-lbz2"
90+
"--ghc-option=-optl-llzma"
91+
"--ghc-option=-optl-Wl,--end-group"
92+
])
93+
]);
7794

7895
# "static" binary for distribution
7996
# on linux this is actually a real fully static binary

0 commit comments

Comments
 (0)