@@ -28,6 +28,7 @@
2828, stripTkinter ? false
2929, rebuildBytecode ? true
3030, stripBytecode ? false
31+, static ? false
3132}:
3233
3334assert x11Support -> tcl != null
@@ -130,7 +131,7 @@ in with passthru; stdenv.mkDerivation {
130131 CPPFLAGS = concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs);
131132 LDFLAGS = concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs);
132133 LIBS = "${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}";
133− NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s";
134+ NIX_LDFLAGS = optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "-lgcc_s" + optionalString stdenv.hostPlatform.isMusl "-lgcc_eh";
134135 # Determinism: We fix the hashes of str, bytes and datetime objects.
135136 PYTHONHASHSEED=0;
136137
@@ -169,7 +170,7 @@ in with passthru; stdenv.mkDerivation {
169170 # Never even try to use lchmod on linux,
170171 # don't rely on detecting glibc-isms.
171172 "ac_cv_func_lchmod=no"
172− ];
173+ ] ++ optional static "LDFLAGS=-static";
173174
174175 preConfigure = ''
175176 for i in /usr /sw /opt /pkg; do # improve purity
@@ -262,7 +263,7 @@ in with passthru; stdenv.mkDerivation {
262263 # Enforce that we don't have references to the OpenSSL -dev package, which we
263264 # explicitly specify in our configure flags above.
264265 disallowedReferences =
265− stdenv.lib.optionals (openssl != null) [ openssl.dev ]
266+ stdenv.lib.optionals (openssl != null && !static) [ openssl.dev ]
266267 ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
267268 # Ensure we don't have references to build-time packages.
268269 # These typically end up in shebangs.