Skip to content

Commit

Permalink
treewide: Start to break up static overlay
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ericson2314 committed Jan 3, 2021
1 parent 0df75bc commit f52263c
Show file tree
Hide file tree
Showing 63 changed files with 136 additions and 189 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/10/default.nix
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/4.8/default.nix
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/4.9/default.nix
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/6/default.nix
Expand Up @@ -8,7 +8,7 @@
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
, enableShared ? true
, enableShared ? !stdenv.targetPlatform.isStatic
, enableLTO ? true
, texinfo ? null
, flex
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/7/default.nix
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/8/default.nix
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/9/default.nix
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion 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++";
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down
3 changes: 2 additions & 1 deletion 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++";
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down
3 changes: 2 additions & 1 deletion 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++";
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
3 changes: 2 additions & 1 deletion 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++";
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down
3 changes: 2 additions & 1 deletion 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++";
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down
3 changes: 2 additions & 1 deletion 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 {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/audiofile/default.nix
Expand Up @@ -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
'';
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/boost/generic.nix
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion 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 ? [ ] }:
Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down
5 changes: 4 additions & 1 deletion 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

Expand Down
3 changes: 2 additions & 1 deletion 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
Expand Down
5 changes: 4 additions & 1 deletion 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 {
Expand Down
5 changes: 4 additions & 1 deletion 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";
Expand Down
4 changes: 3 additions & 1 deletion 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

Expand Down
4 changes: 2 additions & 2 deletions 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
Expand Down
5 changes: 4 additions & 1 deletion 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 {

Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down
2 changes: 1 addition & 1 deletion 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,
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/ncurses/default.nix
Expand Up @@ -3,7 +3,7 @@
, abiVersion ? "6"
, mouseSupport ? false
, unicode ? true
, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !enableStatic
, withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt

Expand Down
4 changes: 2 additions & 2 deletions 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;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/openssl/default.nix
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/rocksdb/default.nix
Expand Up @@ -10,7 +10,7 @@
, zstd
, enableJemalloc ? false, jemalloc
, enableLite ? false
, enableShared ? true
, enableShared ? !stdenv.hostPlatform.isStatic
}:

stdenv.mkDerivation rec {
Expand Down
5 changes: 3 additions & 2 deletions 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
}:

/*
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/science/math/openblas/default.nix
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion 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";
Expand Down

0 comments on commit f52263c

Please sign in to comment.