diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 0e9d4338d76..7a8aa292079 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 213d0c91ff3..a413ed1c778 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 98d4b61648e..05ab2d1fd11 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 a2f034a4827..6fe953e163f 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 6d066044ec1..fd2961f3c93 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 970896d81f1..b29d4597ac5 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 c64a9dcc3f5..22ab4f61da1 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 95711903932..3511783be89 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 00371b862ad..7335d06e4fe 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 b13bacb3638..75e42260b7f 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 1ce879cccb6..5c3ec87617c 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 edf83197d2c..d173b1735cb 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 5a4492e803f..b22da214417 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 76baadf1c6e..ed4192a232e 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 7f2ec528f3c..4c46aeaa191 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 01e0d8e008c..2ed54a22069 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 590872aaab6..50a38dfa967 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 646cd3c3ca4..3295d392203 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 c9f0e6254ab..f5c3d21e7f1 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 5b63560282c..13f033091be 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 883c36baf06..98df98838f1 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 1d9a528b4c6..a9e738f7e9a 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 9f945b15dec..86531a6ad25 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 b3950cb0d30..ec3a28e2b1a 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 8eac88df796..2f490891433 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 733a572ac61..51c13f97433 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 a027d58de39..a514934e964 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 10e63f733a2..522976d3ab2 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 0032941f870..ea7f4eb9fa8 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 9c649c223c1..feee754590b 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 ff26c1029ef..c7babb3038d 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 87969d6b2c7..35d01cd3e82 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 6aa4e049e4c..c4e81d034fc 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 b29aeb2930a..63b826258ae 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 59492887688..10ad110d24e 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 30f060405f0..5e4a56a6d4d 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 0e75bfbd5b5..17a924e6e74 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 c9a2621f440..e9ce6ee18b4 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 fcd12ba587d..2570c7cdb25 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 f17a114216b..12a731385ff 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 1887d53e306..b631def3bb2 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 d670a40f321..8df04e80ceb 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 1879cac96c1..f5c8f64633b 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 98746968146..b780fcda393 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 fb3293aee44..55926852146 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 72150b5ac0b..78fb3b7f937 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 0532c88b66b..72ef086f599 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 026ea6fd2e8..99909e6262e 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 713c4b5d13d..ab78a3a33d8 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 9f28a89f51e..f429f9ad385 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 3e20258cbbe..96d560145df 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 0124a0b3d63..7fceb3854eb 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 0b6082bb578..161619a0483 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 7fe1b745466..d3fc9ce96f5 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 93c2f2c3502..571e89297c7 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 e56108767ab..891fadac12a 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 b00a0836021..2b21b2f1427 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 e7a08877e90..5ae211bd237 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 88217302915..605e95c9392 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 06f5a651f69..868be79c1a4 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 b5da2db67fe..196e59953fe 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 cf6616417ed..c062e1f3bd0 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 6720a019cbc..f1d3ea2a159 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; }; }