about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/compilers/gcc/10/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/8/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/9/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/10/libc++/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/10/libc++abi.nix3
-rw-r--r--pkgs/development/compilers/llvm/10/libunwind.nix4
-rw-r--r--pkgs/development/compilers/llvm/11/libc++/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/11/libc++abi.nix3
-rw-r--r--pkgs/development/compilers/llvm/11/libunwind.nix4
-rw-r--r--pkgs/development/compilers/llvm/7/libc++/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/7/libc++abi.nix3
-rw-r--r--pkgs/development/compilers/llvm/8/libc++/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/8/libc++abi.nix3
-rw-r--r--pkgs/development/compilers/llvm/8/libunwind.nix4
-rw-r--r--pkgs/development/compilers/llvm/9/libc++/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/9/libc++abi.nix3
-rw-r--r--pkgs/development/compilers/llvm/9/libunwind.nix4
-rw-r--r--pkgs/development/libraries/arrow-cpp/default.nix3
-rw-r--r--pkgs/development/libraries/audiofile/default.nix2
-rw-r--r--pkgs/development/libraries/boost/generic.nix2
-rw-r--r--pkgs/development/libraries/fmt/default.nix4
-rw-r--r--pkgs/development/libraries/gflags/default.nix4
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix5
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix3
-rw-r--r--pkgs/development/libraries/libbacktrace/default.nix5
-rw-r--r--pkgs/development/libraries/libexecinfo/default.nix5
-rw-r--r--pkgs/development/libraries/libiberty/default.nix4
-rw-r--r--pkgs/development/libraries/libiconv/default.nix4
-rw-r--r--pkgs/development/libraries/libjpeg-turbo/default.nix5
-rw-r--r--pkgs/development/libraries/libpfm/default.nix4
-rw-r--r--pkgs/development/libraries/libxml2/default.nix2
-rw-r--r--pkgs/development/libraries/libxsmm/default.nix2
-rw-r--r--pkgs/development/libraries/ncurses/default.nix2
-rw-r--r--pkgs/development/libraries/neon/default.nix4
-rw-r--r--pkgs/development/libraries/openssl/default.nix2
-rw-r--r--pkgs/development/libraries/rocksdb/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/mkl/default.nix5
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix4
-rw-r--r--pkgs/development/libraries/thrift/default.nix4
-rw-r--r--pkgs/development/libraries/zlib/default.nix10
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix2
-rw-r--r--pkgs/development/tools/parsing/tree-sitter/default.nix4
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix4
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix2
-rw-r--r--pkgs/os-specific/linux/libcap/default.nix20
-rw-r--r--pkgs/servers/gobetween/default.nix4
-rw-r--r--pkgs/tools/compression/bzip2/default.nix2
-rw-r--r--pkgs/tools/compression/lz4/default.nix3
-rw-r--r--pkgs/tools/compression/xz/default.nix4
-rw-r--r--pkgs/tools/filesystems/nixpart/0.4/parted.nix4
-rw-r--r--pkgs/tools/graphics/optipng/default.nix3
-rw-r--r--pkgs/tools/misc/hdf5/default.nix2
-rw-r--r--pkgs/tools/misc/parted/default.nix2
-rw-r--r--pkgs/tools/misc/toybox/default.nix2
-rw-r--r--pkgs/tools/networking/dropbear/default.nix2
-rw-r--r--pkgs/tools/package-management/nix/default.nix2
-rw-r--r--pkgs/tools/system/ipmitool/default.nix2
-rw-r--r--pkgs/tools/system/pciutils/default.nix2
-rw-r--r--pkgs/top-level/static.nix112
63 files changed, 136 insertions, 189 deletions
diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix
index 0e9d4338d7663..7a8aa29207906 100644
--- a/pkgs/development/compilers/gcc/10/default.nix
+++ b/pkgs/development/compilers/gcc/10/default.nix
@@ -7,7 +7,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , perl ? null # optional, for texi2pod (then pod2man)
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 213d0c91ff34c..a413ed1c778cf 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -7,7 +7,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , perl ? null # optional, for texi2pod (then pod2man); required for Java
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 98d4b61648e37..05ab2d1fd113e 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -7,7 +7,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , perl ? null # optional, for texi2pod (then pod2man); required for Java
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index a2f034a4827fd..6fe953e163fbe 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -8,7 +8,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , flex
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 6d066044ec1ee..fd2961f3c93ec 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -6,7 +6,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , perl ? null # optional, for texi2pod (then pod2man)
diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix
index 970896d81f125..b29d4597ac573 100644
--- a/pkgs/development/compilers/gcc/8/default.nix
+++ b/pkgs/development/compilers/gcc/8/default.nix
@@ -6,7 +6,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , perl ? null # optional, for texi2pod (then pod2man)
diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix
index c64a9dcc3f57f..22ab4f61da163 100644
--- a/pkgs/development/compilers/gcc/9/default.nix
+++ b/pkgs/development/compilers/gcc/9/default.nix
@@ -8,7 +8,7 @@
 , profiledCompiler ? false
 , langJit ? false
 , staticCompiler ? false
-, enableShared ? true
+, enableShared ? !stdenv.targetPlatform.isStatic
 , enableLTO ? true
 , texinfo ? null
 , perl ? null # optional, for texi2pod (then pod2man)
diff --git a/pkgs/development/compilers/llvm/10/libc++/default.nix b/pkgs/development/compilers/llvm/10/libc++/default.nix
index 95711903932e8..3511783be896e 100644
--- a/pkgs/development/compilers/llvm/10/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/10/libc++/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++";
diff --git a/pkgs/development/compilers/llvm/10/libc++abi.nix b/pkgs/development/compilers/llvm/10/libc++abi.nix
index 00371b862adb6..7335d06e4fe39 100644
--- a/pkgs/development/compilers/llvm/10/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/10/libc++abi.nix
@@ -1,5 +1,6 @@
 { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++abi";
diff --git a/pkgs/development/compilers/llvm/10/libunwind.nix b/pkgs/development/compilers/llvm/10/libunwind.nix
index b13bacb363801..75e42260b7fa5 100644
--- a/pkgs/development/compilers/llvm/10/libunwind.nix
+++ b/pkgs/development/compilers/llvm/10/libunwind.nix
@@ -1,4 +1,6 @@
-{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }:
+{ stdenv, version, fetch, cmake, fetchpatch
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   pname = "libunwind";
diff --git a/pkgs/development/compilers/llvm/11/libc++/default.nix b/pkgs/development/compilers/llvm/11/libc++/default.nix
index 1ce879cccb67a..5c3ec87617c91 100644
--- a/pkgs/development/compilers/llvm/11/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/11/libc++/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++";
diff --git a/pkgs/development/compilers/llvm/11/libc++abi.nix b/pkgs/development/compilers/llvm/11/libc++abi.nix
index edf83197d2ca2..d173b1735cbe4 100644
--- a/pkgs/development/compilers/llvm/11/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/11/libc++abi.nix
@@ -1,5 +1,6 @@
 { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++abi";
diff --git a/pkgs/development/compilers/llvm/11/libunwind.nix b/pkgs/development/compilers/llvm/11/libunwind.nix
index 5a4492e803f6c..b22da214417f4 100644
--- a/pkgs/development/compilers/llvm/11/libunwind.nix
+++ b/pkgs/development/compilers/llvm/11/libunwind.nix
@@ -1,4 +1,6 @@
-{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }:
+{ stdenv, version, fetch, cmake, fetchpatch
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   pname = "libunwind";
diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix
index 76baadf1c6e97..ed4192a232e3a 100644
--- a/pkgs/development/compilers/llvm/7/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/7/libc++/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
-, enableShared ? ! stdenv.hostPlatform.isMusl }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++";
diff --git a/pkgs/development/compilers/llvm/7/libc++abi.nix b/pkgs/development/compilers/llvm/7/libc++abi.nix
index 7f2ec528f3c1b..4c46aeaa19108 100644
--- a/pkgs/development/compilers/llvm/7/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/7/libc++abi.nix
@@ -1,7 +1,8 @@
 { stdenv, cmake, fetch, libcxx, llvm, version
 , standalone ? false
   # on musl the shared objects don't build
-, enableShared ? ! stdenv.hostPlatform.isMusl }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++abi";
diff --git a/pkgs/development/compilers/llvm/8/libc++/default.nix b/pkgs/development/compilers/llvm/8/libc++/default.nix
index 01e0d8e008cb8..2ed54a22069b9 100644
--- a/pkgs/development/compilers/llvm/8/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/8/libc++/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++";
diff --git a/pkgs/development/compilers/llvm/8/libc++abi.nix b/pkgs/development/compilers/llvm/8/libc++abi.nix
index 590872aaab649..50a38dfa967ba 100644
--- a/pkgs/development/compilers/llvm/8/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/8/libc++abi.nix
@@ -1,5 +1,6 @@
 { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++abi";
diff --git a/pkgs/development/compilers/llvm/8/libunwind.nix b/pkgs/development/compilers/llvm/8/libunwind.nix
index 646cd3c3ca4a7..3295d3922034d 100644
--- a/pkgs/development/compilers/llvm/8/libunwind.nix
+++ b/pkgs/development/compilers/llvm/8/libunwind.nix
@@ -1,4 +1,6 @@
-{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }:
+{ stdenv, version, fetch, cmake, fetchpatch
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libunwind";
diff --git a/pkgs/development/compilers/llvm/9/libc++/default.nix b/pkgs/development/compilers/llvm/9/libc++/default.nix
index c9f0e6254ab46..f5c3d21e7f1a3 100644
--- a/pkgs/development/compilers/llvm/9/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/9/libc++/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++";
diff --git a/pkgs/development/compilers/llvm/9/libc++abi.nix b/pkgs/development/compilers/llvm/9/libc++abi.nix
index 5b63560282c04..13f033091be2d 100644
--- a/pkgs/development/compilers/llvm/9/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/9/libc++abi.nix
@@ -1,5 +1,6 @@
 { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation {
   pname = "libc++abi";
diff --git a/pkgs/development/compilers/llvm/9/libunwind.nix b/pkgs/development/compilers/llvm/9/libunwind.nix
index 883c36baf0627..98df98838f132 100644
--- a/pkgs/development/compilers/llvm/9/libunwind.nix
+++ b/pkgs/development/compilers/llvm/9/libunwind.nix
@@ -1,4 +1,6 @@
-{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }:
+{ stdenv, version, fetch, cmake, fetchpatch
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   pname = "libunwind";
diff --git a/pkgs/development/libraries/arrow-cpp/default.nix b/pkgs/development/libraries/arrow-cpp/default.nix
index 1d9a528b4c6a4..a9e738f7e9a1b 100644
--- a/pkgs/development/libraries/arrow-cpp/default.nix
+++ b/pkgs/development/libraries/arrow-cpp/default.nix
@@ -1,7 +1,8 @@
 { stdenv, lib, fetchurl, fetchFromGitHub, fetchpatch, fixDarwinDylibNames
 , autoconf, boost, brotli, cmake, flatbuffers, gflags, glog, gtest, lz4
 , perl, python3, rapidjson, snappy, thrift, utf8proc, which, zlib, zstd
-, enableShared ? true }:
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 let
   arrow-testing = fetchFromGitHub {
diff --git a/pkgs/development/libraries/audiofile/default.nix b/pkgs/development/libraries/audiofile/default.nix
index 9f945b15dec2a..86531a6ad25d8 100644
--- a/pkgs/development/libraries/audiofile/default.nix
+++ b/pkgs/development/libraries/audiofile/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   #
   # There might be a more sensible way to do this with autotools, but I am not
   # smart enough to discover it.
-  preBuild = lib.optionalString stdenv.targetPlatform.isStatic ''
+  preBuild = lib.optionalString stdenv.hostPlatform.isStatic ''
     make -C libaudiofile $makeFlags
     sed -i "s/dependency_libs=.*/dependency_libs=' -lstdc++'/" libaudiofile/libaudiofile.la
   '';
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index b3950cb0d3012..ec3a28e2b1a38 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -8,7 +8,7 @@
 , enableDebug ? false
 , enableSingleThreaded ? false
 , enableMultiThreaded ? true
-, enableShared ? !(stdenv.hostPlatform.libc == "msvcrt") # problems for now
+, enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now
 , enableStatic ? !enableShared
 , enablePython ? false
 , enableNumpy ? false
diff --git a/pkgs/development/libraries/fmt/default.nix b/pkgs/development/libraries/fmt/default.nix
index 8eac88df796c6..2f490891433b9 100644
--- a/pkgs/development/libraries/fmt/default.nix
+++ b/pkgs/development/libraries/fmt/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, enableShared ? true }:
+{ stdenv, fetchFromGitHub, fetchpatch, cmake
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 let
   generic = { version, sha256, patches ? [ ] }:
diff --git a/pkgs/development/libraries/gflags/default.nix b/pkgs/development/libraries/gflags/default.nix
index 733a572ac61b0..51c13f974336b 100644
--- a/pkgs/development/libraries/gflags/default.nix
+++ b/pkgs/development/libraries/gflags/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchFromGitHub, cmake, enableShared ? true}:
+{ stdenv, fetchFromGitHub, cmake
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   pname = "gflags";
diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index a027d58de3964..a514934e96458 100644
--- a/pkgs/development/libraries/gmp/5.1.x.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -1,4 +1,7 @@
-{ stdenv, fetchurl, m4, cxx ? true, withStatic ? true }:
+{ stdenv, fetchurl, m4
+, cxx ? true
+, withStatic ? stdenv.hostPlatform.isStatic
+}:
 
 let inherit (stdenv.lib) optional; in
 
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index 10e63f733a2d1..522976d3ab2c6 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -1,7 +1,8 @@
 { stdenv, fetchurl, m4
 , cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm
 , buildPackages
-, withStatic ? false }:
+, withStatic ? stdenv.hostPlatform.isStatic
+}:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
diff --git a/pkgs/development/libraries/libbacktrace/default.nix b/pkgs/development/libraries/libbacktrace/default.nix
index 0032941f870e1..ea7f4eb9fa8a8 100644
--- a/pkgs/development/libraries/libbacktrace/default.nix
+++ b/pkgs/development/libraries/libbacktrace/default.nix
@@ -1,4 +1,7 @@
-{ stdenv, callPackage, fetchFromGitHub, enableStatic ? false, enableShared ? true }:
+{ stdenv, callPackage, fetchFromGitHub
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 let
   yesno = b: if b then "yes" else "no";
 in stdenv.mkDerivation rec {
diff --git a/pkgs/development/libraries/libexecinfo/default.nix b/pkgs/development/libraries/libexecinfo/default.nix
index 9c649c223c122..feee754590b67 100644
--- a/pkgs/development/libraries/libexecinfo/default.nix
+++ b/pkgs/development/libraries/libexecinfo/default.nix
@@ -1,4 +1,7 @@
-{ stdenv, fetchurl, fetchpatch, enableStatic ? true, enableShared ? true }:
+{ stdenv, fetchurl, fetchpatch
+, enableStatic ? true
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   pname = "libexecinfo";
diff --git a/pkgs/development/libraries/libiberty/default.nix b/pkgs/development/libraries/libiberty/default.nix
index ff26c1029ef52..c7babb3038d3c 100644
--- a/pkgs/development/libraries/libiberty/default.nix
+++ b/pkgs/development/libraries/libiberty/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, buildPackages, staticBuild ? false }:
+{ stdenv, buildPackages
+, staticBuild ? stdenv.hostPlatform.isStatic
+}:
 
 let inherit (buildPackages.buildPackages) gcc; in
 
diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix
index 87969d6b2c7bf..35d01cd3e820d 100644
--- a/pkgs/development/libraries/libiconv/default.nix
+++ b/pkgs/development/libraries/libiconv/default.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, lib
-, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
-, enableShared ? !stdenv.hostPlatform.useAndroidPrebuilt
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
 # assert !stdenv.hostPlatform.isLinux || stdenv.hostPlatform != stdenv.buildPlatform; # TODO: improve on cross
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index 6aa4e049e4c32..c4e81d034fc9d 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -1,4 +1,7 @@
-{ stdenv, fetchFromGitHub, cmake, nasm, enableStatic ? false, enableShared ? true }:
+{ stdenv, fetchFromGitHub, cmake, nasm
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
 
diff --git a/pkgs/development/libraries/libpfm/default.nix b/pkgs/development/libraries/libpfm/default.nix
index b29aeb2930a77..63b826258ae6e 100644
--- a/pkgs/development/libraries/libpfm/default.nix
+++ b/pkgs/development/libraries/libpfm/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, enableShared ? true }:
+{ stdenv, fetchurl
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation (rec {
   version = "4.11.0";
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index 5949288768889..10ad110d24e51 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, fetchurl, fetchpatch
 , zlib, xz, libintl, python, gettext, ncurses, findXMLCatalogs
-, pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform
+, pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform
 , icuSupport ? false, icu ? null
 , enableShared ? stdenv.hostPlatform.libc != "msvcrt"
 , enableStatic ? !enableShared,
diff --git a/pkgs/development/libraries/libxsmm/default.nix b/pkgs/development/libraries/libxsmm/default.nix
index 30f060405f089..5e4a56a6d4de3 100644
--- a/pkgs/development/libraries/libxsmm/default.nix
+++ b/pkgs/development/libraries/libxsmm/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, coreutils, gfortran, gnused
 , python3, util-linux, which
 
-, enableStatic ? false
+, enableStatic ? stdenv.hostPlatform.isStatic
 }:
 
 let
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 0e75bfbd5b518..17a924e6e74c5 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -3,7 +3,7 @@
 , abiVersion ? "6"
 , mouseSupport ? false
 , unicode ? true
-, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
+, enableStatic ? stdenv.hostPlatform.isStatic
 , enableShared ? !enableStatic
 , withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt
 
diff --git a/pkgs/development/libraries/neon/default.nix b/pkgs/development/libraries/neon/default.nix
index c9a2621f44003..e9ce6ee18b4fa 100644
--- a/pkgs/development/libraries/neon/default.nix
+++ b/pkgs/development/libraries/neon/default.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, libxml2, pkgconfig, perl
 , compressionSupport ? true, zlib ? null
 , sslSupport ? true, openssl ? null
-, static ? false
-, shared ? true
+, static ? stdenv.hostPlatform.isStatic
+, shared ? !stdenv.hostPlatform.isStatic
 }:
 
 assert compressionSupport -> zlib != null;
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index fcd12ba587d04..2570c7cdb25a6 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -2,7 +2,7 @@
 , withCryptodev ? false, cryptodev
 , enableSSL2 ? false
 , enableSSL3 ? false
-, static ? false
+, static ? stdenv.hostPlatform.isStatic
 }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
diff --git a/pkgs/development/libraries/rocksdb/default.nix b/pkgs/development/libraries/rocksdb/default.nix
index f17a114216bd4..12a731385ffe7 100644
--- a/pkgs/development/libraries/rocksdb/default.nix
+++ b/pkgs/development/libraries/rocksdb/default.nix
@@ -10,7 +10,7 @@
 , zstd
 , enableJemalloc ? false, jemalloc
 , enableLite ? false
-, enableShared ? true
+, enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/development/libraries/science/math/mkl/default.nix b/pkgs/development/libraries/science/math/mkl/default.nix
index 1887d53e30663..b631def3bb2e9 100644
--- a/pkgs/development/libraries/science/math/mkl/default.nix
+++ b/pkgs/development/libraries/science/math/mkl/default.nix
@@ -1,11 +1,12 @@
-{ callPackage
+{ stdenv
+, callPackage
 , stdenvNoCC
 , fetchurl
 , rpmextract
 , undmg
 , darwin
 , validatePkgConfig
-, enableStatic ? false
+, enableStatic ? stdenv.hostPlatform.isStatic
 }:
 
 /*
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index d670a40f321d3..8df04e80ceb38 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -15,8 +15,8 @@
 # Select a specific optimization target (other than the default)
 # See https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
 , target ? null
-, enableStatic ? false
-, enableShared ? true
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
 with stdenv.lib;
diff --git a/pkgs/development/libraries/thrift/default.nix b/pkgs/development/libraries/thrift/default.nix
index 1879cac96c188..f5c8f64633bbd 100644
--- a/pkgs/development/libraries/thrift/default.nix
+++ b/pkgs/development/libraries/thrift/default.nix
@@ -1,5 +1,7 @@
 { stdenv, fetchurl, fetchpatch, boost, zlib, libevent, openssl, python, cmake, pkgconfig
-, bison, flex, twisted, static ? false }:
+, bison, flex, twisted
+, static ? stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   pname = "thrift";
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index 98746968146d9..b780fcda3930a 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -1,17 +1,19 @@
 { stdenv
 , fetchurl
-# Note: If `{ static = false; shared = false; }`, upstream's default is used
-#       (which is building both static and shared as of zlib 1.2.11).
-, shared ? true
+, shared ? !stdenv.hostPlatform.isStatic
 , static ? true
 # If true, a separate .static ouput is created and the .a is moved there.
 # In this case `pkg-config` auto detection does not currently work if the
 # .static output is given as `buildInputs` to another package (#66461), because
 # the `.pc` file lists only the main output's lib dir.
 # If false, and if `{ static = true; }`, the .a stays in the main output.
-, splitStaticOutput ? static
+, splitStaticOutput ? shared && static
 }:
 
+# Without either the build will actually still succeed because the build
+# system makes an arbitrary choice, but we shouldn't be so indecisive.
+assert shared || static;
+
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
 # cgit) that are needed here should be included directly in Nixpkgs as
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index fb3293aee4418..5592685214606 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -2,7 +2,7 @@
 , fetchFromGitHub, fetchurl, zlib, autoreconfHook, gettext
 # Enabling all targets increases output size to a multiple.
 , withAllTargets ? false, libbfd, libopcodes
-, enableShared ? true
+, enableShared ? !stdenv.hostPlatform.isStatic
 , noSysDirs
 , gold ? !stdenv.buildPlatform.isDarwin || stdenv.hostPlatform == stdenv.targetPlatform
 , bison ? null
diff --git a/pkgs/development/tools/parsing/tree-sitter/default.nix b/pkgs/development/tools/parsing/tree-sitter/default.nix
index 72150b5ac0bf7..78fb3b7f937f2 100644
--- a/pkgs/development/tools/parsing/tree-sitter/default.nix
+++ b/pkgs/development/tools/parsing/tree-sitter/default.nix
@@ -5,8 +5,8 @@
 , Security
 , callPackage
 
-, enableShared ? true
-, enableStatic ? false
+, enableShared ? !stdenv.hostPlatform.isStatic
+, enableStatic ? stdenv.hostPlatform.isStatic
 , webUISupport ? false
 }:
 
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
index 0532c88b66b9f..72ef086f59909 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
@@ -1,6 +1,6 @@
 { stdenv, appleDerivation, lib
-, enableStatic ? stdenv.targetPlatform.isiOS
-, enableShared ? !stdenv.targetPlatform.isiOS
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
 appleDerivation {
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index 026ea6fd2e8e4..99909e6262efa 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, buildPackages, fetchurl, fetchFromGitLab
-, enableStatic ? false
+, enableStatic ? stdenv.hostPlatform.isStatic
 , enableMinimal ? false
 # Allow forcing musl without switching stdenv itself, e.g. for our bootstrapping:
 # nix build -f pkgs/top-level/release.nix stdenvBootstrapTools.x86_64-linux.dist
diff --git a/pkgs/os-specific/linux/libcap/default.nix b/pkgs/os-specific/linux/libcap/default.nix
index 713c4b5d13d96..ab78a3a33d8fa 100644
--- a/pkgs/os-specific/linux/libcap/default.nix
+++ b/pkgs/os-specific/linux/libcap/default.nix
@@ -1,5 +1,9 @@
-{ stdenv, lib, buildPackages, fetchurl, attr, perl, pam
-, static ? stdenv.targetPlatform.isStatic }:
+{ stdenv, lib, buildPackages, fetchurl, attr, perl
+, usePam ? !isStatic, pam ? null
+, isStatic ? stdenv.hostPlatform.isStatic
+}:
+
+assert usePam -> pam != null;
 
 stdenv.mkDerivation rec {
   pname = "libcap";
@@ -10,21 +14,21 @@ stdenv.mkDerivation rec {
     sha256 = "1qf80lifygbnxwvqjf8jz5j24n6fqqx4ixnkbf76xs2vrmcq664j";
   };
 
-  patches = lib.optional static ./no-shared-lib.patch;
+  patches = lib.optional isStatic ./no-shared-lib.patch;
 
   outputs = [ "out" "dev" "lib" "man" "doc" ]
-    ++ lib.optional (pam != null) "pam";
+    ++ lib.optional usePam "pam";
 
   depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ perl ];
 
-  buildInputs = [ pam ];
+  buildInputs = lib.optional usePam pam;
 
   propagatedBuildInputs = [ attr ];
 
   makeFlags = [
     "lib=lib"
-    "PAM_CAP=${if pam == null then "no" else "yes"}"
+    "PAM_CAP=${if usePam then "yes" else "no"}"
     "BUILD_CC=$(CC_FOR_BUILD)"
     "CC:=$(CC)"
   ];
@@ -48,10 +52,10 @@ stdenv.mkDerivation rec {
   installFlags = [ "RAISE_SETFCAP=no" ];
 
   postInstall = ''
-    ${lib.optionalString (!static) ''rm "$lib"/lib/*.a''}
+    ${lib.optionalString (!isStatic) ''rm "$lib"/lib/*.a''}
     mkdir -p "$doc/share/doc/${pname}-${version}"
     cp License "$doc/share/doc/${pname}-${version}/"
-  '' + stdenv.lib.optionalString (pam != null) ''
+  '' + stdenv.lib.optionalString usePam ''
     mkdir -p "$pam/lib/security"
     mv "$lib"/lib/security "$pam/lib"
   '';
diff --git a/pkgs/servers/gobetween/default.nix b/pkgs/servers/gobetween/default.nix
index 9f28a89f51eba..f429f9ad385b6 100644
--- a/pkgs/servers/gobetween/default.nix
+++ b/pkgs/servers/gobetween/default.nix
@@ -1,4 +1,6 @@
-{ buildGoModule, fetchFromGitHub, lib, enableStatic ? false }:
+{ stdenv, buildGoModule, fetchFromGitHub, lib
+, enableStatic ? stdenv.hostPlatform.isStatic
+}:
 
 buildGoModule rec {
   pname = "gobetween";
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index 3e20258cbbeeb..96d560145df73 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl
-, linkStatic ? (stdenv.hostPlatform.system == "i686-cygwin")
+, linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin
 , autoreconfHook
 }:
 
diff --git a/pkgs/tools/compression/lz4/default.nix b/pkgs/tools/compression/lz4/default.nix
index 0124a0b3d63b7..7fceb3854ebcd 100644
--- a/pkgs/tools/compression/lz4/default.nix
+++ b/pkgs/tools/compression/lz4/default.nix
@@ -1,5 +1,6 @@
 { stdenv, fetchFromGitHub, valgrind, fetchpatch
-, enableStatic ? false, enableShared ? true
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/tools/compression/xz/default.nix b/pkgs/tools/compression/xz/default.nix
index 0b6082bb57809..161619a048362 100644
--- a/pkgs/tools/compression/xz/default.nix
+++ b/pkgs/tools/compression/xz/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, enableStatic ? false }:
+{ stdenv, fetchurl
+, enableStatic ? stdenv.hostPlatform.isStatic
+}:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
diff --git a/pkgs/tools/filesystems/nixpart/0.4/parted.nix b/pkgs/tools/filesystems/nixpart/0.4/parted.nix
index 7fe1b74546687..d3fc9ce96f58d 100644
--- a/pkgs/tools/filesystems/nixpart/0.4/parted.nix
+++ b/pkgs/tools/filesystems/nixpart/0.4/parted.nix
@@ -1,5 +1,7 @@
 { stdenv, fetchurl, fetchpatch, lvm2, libuuid, gettext, readline
-, util-linux, check, enableStatic ? false }:
+, util-linux, check
+, enableStatic ? stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   name = "parted-3.1";
diff --git a/pkgs/tools/graphics/optipng/default.nix b/pkgs/tools/graphics/optipng/default.nix
index 93c2f2c350256..571e89297c789 100644
--- a/pkgs/tools/graphics/optipng/default.nix
+++ b/pkgs/tools/graphics/optipng/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, libpng, static ? false
+{ stdenv, fetchurl, libpng
+, static ? stdenv.hostPlatform.isStatic
 }:
 
 # This package comes with its own copy of zlib, libpng and pngxtern
diff --git a/pkgs/tools/misc/hdf5/default.nix b/pkgs/tools/misc/hdf5/default.nix
index e56108767aba9..891fadac12ac6 100644
--- a/pkgs/tools/misc/hdf5/default.nix
+++ b/pkgs/tools/misc/hdf5/default.nix
@@ -6,7 +6,7 @@
 , zlib ? null
 , szip ? null
 , mpi ? null
-, enableShared ? true
+, enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
 # cpp and mpi options are mutually exclusive
diff --git a/pkgs/tools/misc/parted/default.nix b/pkgs/tools/misc/parted/default.nix
index b00a0836021f8..2b21b2f1427c1 100644
--- a/pkgs/tools/misc/parted/default.nix
+++ b/pkgs/tools/misc/parted/default.nix
@@ -11,7 +11,7 @@
 , python3
 , util-linux
 , check
-, enableStatic ? false
+, enableStatic ? stdenv.hostPlatform.isStatic
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/tools/misc/toybox/default.nix b/pkgs/tools/misc/toybox/default.nix
index e7a08877e90f3..5ae211bd23761 100644
--- a/pkgs/tools/misc/toybox/default.nix
+++ b/pkgs/tools/misc/toybox/default.nix
@@ -1,7 +1,7 @@
 {
   stdenv, lib, fetchFromGitHub, which,
   buildPackages,
-  enableStatic ? false,
+  enableStatic ? stdenv.hostPlatform.isStatic,
   enableMinimal ? false,
   extraConfig ? ""
 }:
diff --git a/pkgs/tools/networking/dropbear/default.nix b/pkgs/tools/networking/dropbear/default.nix
index 88217302915e7..605e95c9392a9 100644
--- a/pkgs/tools/networking/dropbear/default.nix
+++ b/pkgs/tools/networking/dropbear/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, glibc, zlib
-, enableStatic ? false
+, enableStatic ? stdenv.hostPlatform.isStatic
 , sftpPath ? "/run/current-system/sw/libexec/sftp-server"
 }:
 
diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix
index 06f5a651f69e4..868be79c1a49e 100644
--- a/pkgs/tools/package-management/nix/default.nix
+++ b/pkgs/tools/package-management/nix/default.nix
@@ -22,7 +22,7 @@ common =
   , confDir
   , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp
   , withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp
-  , enableStatic ? false
+  , enableStatic ? stdenv.hostPlatform.isStatic
   , name, suffix ? "", src, patches ? []
 
   }:
diff --git a/pkgs/tools/system/ipmitool/default.nix b/pkgs/tools/system/ipmitool/default.nix
index b5da2db67fe8b..196e59953fe73 100644
--- a/pkgs/tools/system/ipmitool/default.nix
+++ b/pkgs/tools/system/ipmitool/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, openssl, fetchpatch, static ? false }:
+{ stdenv, lib, fetchurl, openssl, fetchpatch, static ? stdenv.hostPlatform.isStatic }:
 
 let
   pkgname = "ipmitool";
diff --git a/pkgs/tools/system/pciutils/default.nix b/pkgs/tools/system/pciutils/default.nix
index cf6616417ed06..c062e1f3bd086 100644
--- a/pkgs/tools/system/pciutils/default.nix
+++ b/pkgs/tools/system/pciutils/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, zlib, kmod, which
-, static ? stdenv.targetPlatform.isStatic
+, static ? stdenv.hostPlatform.isStatic
 , darwin ? null
 }:
 
diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix
index 6720a019cbced..f1d3ea2a1598c 100644
--- a/pkgs/top-level/static.nix
+++ b/pkgs/top-level/static.nix
@@ -112,87 +112,23 @@ in {
     enableApp = false;
   };
 
-  ncurses = super.ncurses.override {
-    enableStatic = true;
-  };
-  libxml2 = super.libxml2.override ({
-    enableShared = false;
-    enableStatic = true;
-  } // optionalAttrs super.stdenv.hostPlatform.isDarwin {
-    pythonSupport = false;
-  });
   zlib = super.zlib.override {
-    static = true;
-    shared = false;
-    splitStaticOutput = false;
-
     # Don’t use new stdenv zlib because
     # it doesn’t like the --disable-shared flag
     stdenv = super.stdenv;
   };
-  xz = super.xz.override {
-    enableStatic = true;
-  };
-  busybox = super.busybox.override {
-    enableStatic = true;
-  };
-  libiberty = super.libiberty.override {
-    staticBuild = true;
-  };
-  libpfm = super.libpfm.override {
-    enableShared = false;
-  };
-  ipmitool = super.ipmitool.override {
-    static = true;
-  };
-  neon = super.neon.override {
-    static = true;
-    shared = false;
-  };
-  fmt = super.fmt.override {
-    enableShared = false;
-  };
   gifsicle = super.gifsicle.override {
     static = true;
   };
-  bzip2 = super.bzip2.override {
-    linkStatic = true;
-  };
-  optipng = super.optipng.override {
-    static = true;
-  };
-  openblas = super.openblas.override {
-    enableStatic = true;
-    enableShared = false;
-  };
-  mkl = super.mkl.override { enableStatic = true; };
-  nix = super.nix.override { enableStatic = true; };
-  nixUnstable = super.nixUnstable.override { enableStatic = true; };
-  openssl = (super.openssl_1_1.override { static = true; }).overrideAttrs (o: {
+  openssl = super.openssl_1_1.overrideAttrs (o: {
     # OpenSSL doesn't like the `--enable-static` / `--disable-shared` flags.
     configureFlags = (removeUnknownConfigureFlags o.configureFlags);
   });
-  arrow-cpp = super.arrow-cpp.override {
-    enableShared = false;
-  };
   boost = super.boost.override {
-    enableStatic = true;
-    enableShared = false;
-
     # Don’t use new stdenv for boost because it doesn’t like the
     # --disable-shared flag
     stdenv = super.stdenv;
   };
-  thrift = super.thrift.override {
-    static = true;
-    twisted = null;
-  };
-  gmp = super.gmp.override {
-    withStatic = true;
-  };
-  gflags = super.gflags.override {
-    enableShared = false;
-  };
   cdo = super.cdo.override {
     enable_all_static = true;
   };
@@ -202,13 +138,6 @@ in {
   crc32c = super.crc32c.override {
     staticOnly = true;
   };
-  parted = super.parted.override {
-    enableStatic = true;
-  };
-  libiconvReal = super.libiconvReal.override {
-    enableShared = false;
-    enableStatic = true;
-  };
   perl = super.perl.override {
     # Don’t use new stdenv zlib because
     # it doesn’t like the --disable-shared flag
@@ -220,24 +149,9 @@ in {
   snappy = super.snappy.override {
     static = true;
   };
-  lz4 = super.lz4.override {
-    enableShared = false;
-    enableStatic = true;
-  };
   libressl = super.libressl.override {
     buildShared = false;
   };
-  libjpeg_turbo = super.libjpeg_turbo.override {
-    enableStatic = true;
-    enableShared = false;
-  };
-
-  darwin = super.darwin // {
-    libiconv = super.darwin.libiconv.override {
-      enableShared = false;
-      enableStatic = true;
-    };
-  };
 
   kmod = super.kmod.override {
     withStatic = true;
@@ -260,21 +174,6 @@ in {
     static = true;
   };
 
-  llvmPackages_8 = super.llvmPackages_8 // {
-    libraries = super.llvmPackages_8.libraries // rec {
-      libcxxabi = super.llvmPackages_8.libraries.libcxxabi.override {
-        enableShared = false;
-      };
-      libcxx = super.llvmPackages_8.libraries.libcxx.override {
-        enableShared = false;
-        inherit libcxxabi;
-      };
-      libunwind = super.llvmPackages_8.libraries.libunwind.override {
-        enableShared = false;
-      };
-    };
-  };
-
   ocaml-ng = self.lib.mapAttrs (_: set:
     if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set
   ) super.ocaml-ng;
@@ -289,13 +188,6 @@ in {
   # Note: -static doesn’t work on darwin
   libev = super.libev.override { static = !super.stdenv.hostPlatform.isDarwin; };
 
-  libexecinfo = super.libexecinfo.override { enableShared = false; };
-
-  tree-sitter = super.tree-sitter.override {
-    enableShared = false;
-    enableStatic = true;
-  };
-
   xorg = super.xorg.overrideScope' (xorgself: xorgsuper: {
     libX11 = xorgsuper.libX11.overrideAttrs (attrs: {
       depsBuildBuild = attrs.depsBuildBuild ++ [ (self.buildPackages.stdenv.cc.libc.static or null) ];
@@ -319,6 +211,4 @@ in {
       configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
     });
   });
-
-  libcap = super.libcap.override { pam = null; };
 }