treewide: Start to break up static overlay

We can use use `stdenv.hostPlatform.isStatic` instead, and move the
logic per package. The least opionated benefit of this is that it makes
it much easier to replace packages with modified ones, as there is no
longer any issue of overlay order.

CC @FRidh @matthewbauer
This commit is contained in:
John Ericson 2020-12-20 06:11:26 +00:00
parent 0df75bc04e
commit f52263ced0
63 changed files with 136 additions and 189 deletions

View file

@ -7,7 +7,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man) , perl ? null # optional, for texi2pod (then pod2man)

View file

@ -7,7 +7,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man); required for Java , perl ? null # optional, for texi2pod (then pod2man); required for Java

View file

@ -7,7 +7,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man); required for Java , perl ? null # optional, for texi2pod (then pod2man); required for Java

View file

@ -8,7 +8,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, flex , flex

View file

@ -6,7 +6,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man) , perl ? null # optional, for texi2pod (then pod2man)

View file

@ -6,7 +6,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man) , perl ? null # optional, for texi2pod (then pod2man)

View file

@ -8,7 +8,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, langJit ? false , langJit ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true , enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man) , perl ? null # optional, for texi2pod (then pod2man)

View file

@ -1,5 +1,6 @@
{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++"; pname = "libc++";

View file

@ -1,5 +1,6 @@
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++abi"; pname = "libc++abi";

View file

@ -1,4 +1,6 @@
{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }: { stdenv, version, fetch, cmake, fetchpatch
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libunwind"; pname = "libunwind";

View file

@ -1,5 +1,6 @@
{ lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version { lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++"; pname = "libc++";

View file

@ -1,5 +1,6 @@
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++abi"; pname = "libc++abi";

View file

@ -1,4 +1,6 @@
{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }: { stdenv, version, fetch, cmake, fetchpatch
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libunwind"; pname = "libunwind";

View file

@ -1,5 +1,6 @@
{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
, enableShared ? ! stdenv.hostPlatform.isMusl }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++"; pname = "libc++";

View file

@ -1,7 +1,8 @@
{ stdenv, cmake, fetch, libcxx, llvm, version { stdenv, cmake, fetch, libcxx, llvm, version
, standalone ? false , standalone ? false
# on musl the shared objects don't build # on musl the shared objects don't build
, enableShared ? ! stdenv.hostPlatform.isMusl }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++abi"; pname = "libc++abi";

View file

@ -1,5 +1,6 @@
{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++"; pname = "libc++";

View file

@ -1,5 +1,6 @@
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++abi"; pname = "libc++abi";

View file

@ -1,4 +1,6 @@
{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }: { stdenv, version, fetch, cmake, fetchpatch
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libunwind"; pname = "libunwind";

View file

@ -1,5 +1,6 @@
{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version { lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++"; pname = "libc++";

View file

@ -1,5 +1,6 @@
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version { stdenv, cmake, fetch, libcxx, libunwind, llvm, version
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libc++abi"; pname = "libc++abi";

View file

@ -1,4 +1,6 @@
{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }: { stdenv, version, fetch, cmake, fetchpatch
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libunwind"; pname = "libunwind";

View file

@ -1,7 +1,8 @@
{ stdenv, lib, fetchurl, fetchFromGitHub, fetchpatch, fixDarwinDylibNames { stdenv, lib, fetchurl, fetchFromGitHub, fetchpatch, fixDarwinDylibNames
, autoconf, boost, brotli, cmake, flatbuffers, gflags, glog, gtest, lz4 , autoconf, boost, brotli, cmake, flatbuffers, gflags, glog, gtest, lz4
, perl, python3, rapidjson, snappy, thrift, utf8proc, which, zlib, zstd , perl, python3, rapidjson, snappy, thrift, utf8proc, which, zlib, zstd
, enableShared ? true }: , enableShared ? !stdenv.hostPlatform.isStatic
}:
let let
arrow-testing = fetchFromGitHub { arrow-testing = fetchFromGitHub {

View file

@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
# #
# There might be a more sensible way to do this with autotools, but I am not # There might be a more sensible way to do this with autotools, but I am not
# smart enough to discover it. # smart enough to discover it.
preBuild = lib.optionalString stdenv.targetPlatform.isStatic '' preBuild = lib.optionalString stdenv.hostPlatform.isStatic ''
make -C libaudiofile $makeFlags make -C libaudiofile $makeFlags
sed -i "s/dependency_libs=.*/dependency_libs=' -lstdc++'/" libaudiofile/libaudiofile.la sed -i "s/dependency_libs=.*/dependency_libs=' -lstdc++'/" libaudiofile/libaudiofile.la
''; '';

View file

@ -8,7 +8,7 @@
, enableDebug ? false , enableDebug ? false
, enableSingleThreaded ? false , enableSingleThreaded ? false
, enableMultiThreaded ? true , enableMultiThreaded ? true
, enableShared ? !(stdenv.hostPlatform.libc == "msvcrt") # problems for now , enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now
, enableStatic ? !enableShared , enableStatic ? !enableShared
, enablePython ? false , enablePython ? false
, enableNumpy ? false , enableNumpy ? false

View file

@ -1,4 +1,6 @@
{ stdenv, fetchFromGitHub, fetchpatch, cmake, enableShared ? true }: { stdenv, fetchFromGitHub, fetchpatch, cmake
, enableShared ? !stdenv.hostPlatform.isStatic
}:
let let
generic = { version, sha256, patches ? [ ] }: generic = { version, sha256, patches ? [ ] }:

View file

@ -1,4 +1,6 @@
{ stdenv, fetchFromGitHub, cmake, enableShared ? true}: { stdenv, fetchFromGitHub, cmake
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gflags"; pname = "gflags";

View file

@ -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 let inherit (stdenv.lib) optional; in

View file

@ -1,7 +1,8 @@
{ stdenv, fetchurl, m4 { stdenv, fetchurl, m4
, cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm , cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm
, buildPackages , buildPackages
, withStatic ? false }: , withStatic ? stdenv.hostPlatform.isStatic
}:
# Note: this package is used for bootstrapping fetchurl, and thus # Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or # cannot use fetchpatch! All mutable patches (generated by GitHub or

View file

@ -1,4 +1,7 @@
{ stdenv, callPackage, fetchFromGitHub, enableStatic ? false, enableShared ? true }: { stdenv, callPackage, fetchFromGitHub
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}:
let let
yesno = b: if b then "yes" else "no"; yesno = b: if b then "yes" else "no";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {

View file

@ -1,4 +1,7 @@
{ stdenv, fetchurl, fetchpatch, enableStatic ? true, enableShared ? true }: { stdenv, fetchurl, fetchpatch
, enableStatic ? true
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libexecinfo"; pname = "libexecinfo";

View file

@ -1,4 +1,6 @@
{ stdenv, buildPackages, staticBuild ? false }: { stdenv, buildPackages
, staticBuild ? stdenv.hostPlatform.isStatic
}:
let inherit (buildPackages.buildPackages) gcc; in let inherit (buildPackages.buildPackages) gcc; in

View file

@ -1,6 +1,6 @@
{ fetchurl, stdenv, lib { fetchurl, stdenv, lib
, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt , enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.useAndroidPrebuilt , enableShared ? !stdenv.hostPlatform.isStatic
}: }:
# assert !stdenv.hostPlatform.isLinux || stdenv.hostPlatform != stdenv.buildPlatform; # TODO: improve on cross # assert !stdenv.hostPlatform.isLinux || stdenv.hostPlatform != stdenv.buildPlatform; # TODO: improve on cross

View file

@ -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 { stdenv.mkDerivation rec {

View file

@ -1,4 +1,6 @@
{ stdenv, fetchurl, enableShared ? true }: { stdenv, fetchurl
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
version = "4.11.0"; version = "4.11.0";

View file

@ -1,6 +1,6 @@
{ stdenv, lib, fetchurl, fetchpatch { stdenv, lib, fetchurl, fetchpatch
, zlib, xz, libintl, python, gettext, ncurses, findXMLCatalogs , zlib, xz, libintl, python, gettext, ncurses, findXMLCatalogs
, pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform , pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform
, icuSupport ? false, icu ? null , icuSupport ? false, icu ? null
, enableShared ? stdenv.hostPlatform.libc != "msvcrt" , enableShared ? stdenv.hostPlatform.libc != "msvcrt"
, enableStatic ? !enableShared, , enableStatic ? !enableShared,

View file

@ -1,7 +1,7 @@
{ stdenv, fetchFromGitHub, coreutils, gfortran, gnused { stdenv, fetchFromGitHub, coreutils, gfortran, gnused
, python3, util-linux, which , python3, util-linux, which
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
}: }:
let let

View file

@ -3,7 +3,7 @@
, abiVersion ? "6" , abiVersion ? "6"
, mouseSupport ? false , mouseSupport ? false
, unicode ? true , unicode ? true
, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt , enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !enableStatic , enableShared ? !enableStatic
, withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt , withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt

View file

@ -1,8 +1,8 @@
{ stdenv, fetchurl, libxml2, pkgconfig, perl { stdenv, fetchurl, libxml2, pkgconfig, perl
, compressionSupport ? true, zlib ? null , compressionSupport ? true, zlib ? null
, sslSupport ? true, openssl ? null , sslSupport ? true, openssl ? null
, static ? false , static ? stdenv.hostPlatform.isStatic
, shared ? true , shared ? !stdenv.hostPlatform.isStatic
}: }:
assert compressionSupport -> zlib != null; assert compressionSupport -> zlib != null;

View file

@ -2,7 +2,7 @@
, withCryptodev ? false, cryptodev , withCryptodev ? false, cryptodev
, enableSSL2 ? false , enableSSL2 ? false
, enableSSL3 ? false , enableSSL3 ? false
, static ? false , static ? stdenv.hostPlatform.isStatic
}: }:
# Note: this package is used for bootstrapping fetchurl, and thus # Note: this package is used for bootstrapping fetchurl, and thus

View file

@ -10,7 +10,7 @@
, zstd , zstd
, enableJemalloc ? false, jemalloc , enableJemalloc ? false, jemalloc
, enableLite ? false , enableLite ? false
, enableShared ? true , enableShared ? !stdenv.hostPlatform.isStatic
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {

View file

@ -1,11 +1,12 @@
{ callPackage { stdenv
, callPackage
, stdenvNoCC , stdenvNoCC
, fetchurl , fetchurl
, rpmextract , rpmextract
, undmg , undmg
, darwin , darwin
, validatePkgConfig , validatePkgConfig
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
}: }:
/* /*

View file

@ -15,8 +15,8 @@
# Select a specific optimization target (other than the default) # Select a specific optimization target (other than the default)
# See https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt # See https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
, target ? null , target ? null
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? true , enableShared ? !stdenv.hostPlatform.isStatic
}: }:
with stdenv.lib; with stdenv.lib;

View file

@ -1,5 +1,7 @@
{ stdenv, fetchurl, fetchpatch, boost, zlib, libevent, openssl, python, cmake, pkgconfig { 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 { stdenv.mkDerivation rec {
pname = "thrift"; pname = "thrift";

View file

@ -1,17 +1,19 @@
{ stdenv { stdenv
, fetchurl , fetchurl
# Note: If `{ static = false; shared = false; }`, upstream's default is used , shared ? !stdenv.hostPlatform.isStatic
# (which is building both static and shared as of zlib 1.2.11).
, shared ? true
, static ? true , static ? true
# If true, a separate .static ouput is created and the .a is moved there. # 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 # In this case `pkg-config` auto detection does not currently work if the
# .static output is given as `buildInputs` to another package (#66461), because # .static output is given as `buildInputs` to another package (#66461), because
# the `.pc` file lists only the main output's lib dir. # the `.pc` file lists only the main output's lib dir.
# If false, and if `{ static = true; }`, the .a stays in the main output. # 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 # Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or # cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as # cgit) that are needed here should be included directly in Nixpkgs as

View file

@ -2,7 +2,7 @@
, fetchFromGitHub, fetchurl, zlib, autoreconfHook, gettext , fetchFromGitHub, fetchurl, zlib, autoreconfHook, gettext
# Enabling all targets increases output size to a multiple. # Enabling all targets increases output size to a multiple.
, withAllTargets ? false, libbfd, libopcodes , withAllTargets ? false, libbfd, libopcodes
, enableShared ? true , enableShared ? !stdenv.hostPlatform.isStatic
, noSysDirs , noSysDirs
, gold ? !stdenv.buildPlatform.isDarwin || stdenv.hostPlatform == stdenv.targetPlatform , gold ? !stdenv.buildPlatform.isDarwin || stdenv.hostPlatform == stdenv.targetPlatform
, bison ? null , bison ? null

View file

@ -5,8 +5,8 @@
, Security , Security
, callPackage , callPackage
, enableShared ? true , enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
, webUISupport ? false , webUISupport ? false
}: }:

View file

@ -1,6 +1,6 @@
{ stdenv, appleDerivation, lib { stdenv, appleDerivation, lib
, enableStatic ? stdenv.targetPlatform.isiOS , enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.targetPlatform.isiOS , enableShared ? !stdenv.hostPlatform.isStatic
}: }:
appleDerivation { appleDerivation {

View file

@ -1,5 +1,5 @@
{ stdenv, lib, buildPackages, fetchurl, fetchFromGitLab { stdenv, lib, buildPackages, fetchurl, fetchFromGitLab
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
, enableMinimal ? false , enableMinimal ? false
# Allow forcing musl without switching stdenv itself, e.g. for our bootstrapping: # 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 # nix build -f pkgs/top-level/release.nix stdenvBootstrapTools.x86_64-linux.dist

View file

@ -1,5 +1,9 @@
{ stdenv, lib, buildPackages, fetchurl, attr, perl, pam { stdenv, lib, buildPackages, fetchurl, attr, perl
, static ? stdenv.targetPlatform.isStatic }: , usePam ? !isStatic, pam ? null
, isStatic ? stdenv.hostPlatform.isStatic
}:
assert usePam -> pam != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libcap"; pname = "libcap";
@ -10,21 +14,21 @@ stdenv.mkDerivation rec {
sha256 = "1qf80lifygbnxwvqjf8jz5j24n6fqqx4ixnkbf76xs2vrmcq664j"; sha256 = "1qf80lifygbnxwvqjf8jz5j24n6fqqx4ixnkbf76xs2vrmcq664j";
}; };
patches = lib.optional static ./no-shared-lib.patch; patches = lib.optional isStatic ./no-shared-lib.patch;
outputs = [ "out" "dev" "lib" "man" "doc" ] outputs = [ "out" "dev" "lib" "man" "doc" ]
++ lib.optional (pam != null) "pam"; ++ lib.optional usePam "pam";
depsBuildBuild = [ buildPackages.stdenv.cc ]; depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl ]; nativeBuildInputs = [ perl ];
buildInputs = [ pam ]; buildInputs = lib.optional usePam pam;
propagatedBuildInputs = [ attr ]; propagatedBuildInputs = [ attr ];
makeFlags = [ makeFlags = [
"lib=lib" "lib=lib"
"PAM_CAP=${if pam == null then "no" else "yes"}" "PAM_CAP=${if usePam then "yes" else "no"}"
"BUILD_CC=$(CC_FOR_BUILD)" "BUILD_CC=$(CC_FOR_BUILD)"
"CC:=$(CC)" "CC:=$(CC)"
]; ];
@ -48,10 +52,10 @@ stdenv.mkDerivation rec {
installFlags = [ "RAISE_SETFCAP=no" ]; installFlags = [ "RAISE_SETFCAP=no" ];
postInstall = '' postInstall = ''
${lib.optionalString (!static) ''rm "$lib"/lib/*.a''} ${lib.optionalString (!isStatic) ''rm "$lib"/lib/*.a''}
mkdir -p "$doc/share/doc/${pname}-${version}" mkdir -p "$doc/share/doc/${pname}-${version}"
cp License "$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" mkdir -p "$pam/lib/security"
mv "$lib"/lib/security "$pam/lib" mv "$lib"/lib/security "$pam/lib"
''; '';

View file

@ -1,4 +1,6 @@
{ buildGoModule, fetchFromGitHub, lib, enableStatic ? false }: { stdenv, buildGoModule, fetchFromGitHub, lib
, enableStatic ? stdenv.hostPlatform.isStatic
}:
buildGoModule rec { buildGoModule rec {
pname = "gobetween"; pname = "gobetween";

View file

@ -1,5 +1,5 @@
{ stdenv, fetchurl { stdenv, fetchurl
, linkStatic ? (stdenv.hostPlatform.system == "i686-cygwin") , linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin
, autoreconfHook , autoreconfHook
}: }:

View file

@ -1,5 +1,6 @@
{ stdenv, fetchFromGitHub, valgrind, fetchpatch { stdenv, fetchFromGitHub, valgrind, fetchpatch
, enableStatic ? false, enableShared ? true , enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {

View file

@ -1,4 +1,6 @@
{ stdenv, fetchurl, enableStatic ? false }: { stdenv, fetchurl
, enableStatic ? stdenv.hostPlatform.isStatic
}:
# Note: this package is used for bootstrapping fetchurl, and thus # Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or # cannot use fetchpatch! All mutable patches (generated by GitHub or

View file

@ -1,5 +1,7 @@
{ stdenv, fetchurl, fetchpatch, lvm2, libuuid, gettext, readline { stdenv, fetchurl, fetchpatch, lvm2, libuuid, gettext, readline
, util-linux, check, enableStatic ? false }: , util-linux, check
, enableStatic ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "parted-3.1"; name = "parted-3.1";

View file

@ -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 # This package comes with its own copy of zlib, libpng and pngxtern

View file

@ -6,7 +6,7 @@
, zlib ? null , zlib ? null
, szip ? null , szip ? null
, mpi ? null , mpi ? null
, enableShared ? true , enableShared ? !stdenv.hostPlatform.isStatic
}: }:
# cpp and mpi options are mutually exclusive # cpp and mpi options are mutually exclusive

View file

@ -11,7 +11,7 @@
, python3 , python3
, util-linux , util-linux
, check , check
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {

View file

@ -1,7 +1,7 @@
{ {
stdenv, lib, fetchFromGitHub, which, stdenv, lib, fetchFromGitHub, which,
buildPackages, buildPackages,
enableStatic ? false, enableStatic ? stdenv.hostPlatform.isStatic,
enableMinimal ? false, enableMinimal ? false,
extraConfig ? "" extraConfig ? ""
}: }:

View file

@ -1,5 +1,5 @@
{ stdenv, lib, fetchurl, glibc, zlib { stdenv, lib, fetchurl, glibc, zlib
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
, sftpPath ? "/run/current-system/sw/libexec/sftp-server" , sftpPath ? "/run/current-system/sw/libexec/sftp-server"
}: }:

View file

@ -22,7 +22,7 @@ common =
, confDir , confDir
, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp
, withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp , withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp
, enableStatic ? false , enableStatic ? stdenv.hostPlatform.isStatic
, name, suffix ? "", src, patches ? [] , name, suffix ? "", src, patches ? []
}: }:

View file

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, openssl, fetchpatch, static ? false }: { stdenv, lib, fetchurl, openssl, fetchpatch, static ? stdenv.hostPlatform.isStatic }:
let let
pkgname = "ipmitool"; pkgname = "ipmitool";

View file

@ -1,5 +1,5 @@
{ stdenv, fetchurl, pkgconfig, zlib, kmod, which { stdenv, fetchurl, pkgconfig, zlib, kmod, which
, static ? stdenv.targetPlatform.isStatic , static ? stdenv.hostPlatform.isStatic
, darwin ? null , darwin ? null
}: }:

View file

@ -112,87 +112,23 @@ in {
enableApp = false; 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 { zlib = super.zlib.override {
static = true;
shared = false;
splitStaticOutput = false;
# Dont use new stdenv zlib because # Dont use new stdenv zlib because
# it doesnt like the --disable-shared flag # it doesnt like the --disable-shared flag
stdenv = super.stdenv; 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 { gifsicle = super.gifsicle.override {
static = true; static = true;
}; };
bzip2 = super.bzip2.override { openssl = super.openssl_1_1.overrideAttrs (o: {
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 doesn't like the `--enable-static` / `--disable-shared` flags. # OpenSSL doesn't like the `--enable-static` / `--disable-shared` flags.
configureFlags = (removeUnknownConfigureFlags o.configureFlags); configureFlags = (removeUnknownConfigureFlags o.configureFlags);
}); });
arrow-cpp = super.arrow-cpp.override {
enableShared = false;
};
boost = super.boost.override { boost = super.boost.override {
enableStatic = true;
enableShared = false;
# Dont use new stdenv for boost because it doesnt like the # Dont use new stdenv for boost because it doesnt like the
# --disable-shared flag # --disable-shared flag
stdenv = super.stdenv; 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 { cdo = super.cdo.override {
enable_all_static = true; enable_all_static = true;
}; };
@ -202,13 +138,6 @@ in {
crc32c = super.crc32c.override { crc32c = super.crc32c.override {
staticOnly = true; staticOnly = true;
}; };
parted = super.parted.override {
enableStatic = true;
};
libiconvReal = super.libiconvReal.override {
enableShared = false;
enableStatic = true;
};
perl = super.perl.override { perl = super.perl.override {
# Dont use new stdenv zlib because # Dont use new stdenv zlib because
# it doesnt like the --disable-shared flag # it doesnt like the --disable-shared flag
@ -220,24 +149,9 @@ in {
snappy = super.snappy.override { snappy = super.snappy.override {
static = true; static = true;
}; };
lz4 = super.lz4.override {
enableShared = false;
enableStatic = true;
};
libressl = super.libressl.override { libressl = super.libressl.override {
buildShared = false; 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 { kmod = super.kmod.override {
withStatic = true; withStatic = true;
@ -260,21 +174,6 @@ in {
static = true; 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: ocaml-ng = self.lib.mapAttrs (_: set:
if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set
) super.ocaml-ng; ) super.ocaml-ng;
@ -289,13 +188,6 @@ in {
# Note: -static doesnt work on darwin # Note: -static doesnt work on darwin
libev = super.libev.override { static = !super.stdenv.hostPlatform.isDarwin; }; 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: { xorg = super.xorg.overrideScope' (xorgself: xorgsuper: {
libX11 = xorgsuper.libX11.overrideAttrs (attrs: { libX11 = xorgsuper.libX11.overrideAttrs (attrs: {
depsBuildBuild = attrs.depsBuildBuild ++ [ (self.buildPackages.stdenv.cc.libc.static or null) ]; depsBuildBuild = attrs.depsBuildBuild ++ [ (self.buildPackages.stdenv.cc.libc.static or null) ];
@ -319,6 +211,4 @@ in {
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ]; configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
}); });
}); });
libcap = super.libcap.override { pam = null; };
} }