Merge pull request #108350 from Ericson2314/no-static-overlay

treewide: Inline more of the static overlay

Changed files
+64 -106
pkgs
development
interpreters
python
cpython
libraries
cdo
crc32c
gsm
libev
libressl
nghttp2
snappy
web
woff2
os-specific
linux
servers
x11
tools
compression
brotli
zstd
filesystems
e2fsprogs
graphics
gifsicle
networking
top-level
+1 -1
pkgs/development/interpreters/python/cpython/default.nix
···
, rebuildBytecode ? true
, stripBytecode ? false
, includeSiteCustomize ? true
-
, static ? false
+
, static ? stdenv.hostPlatform.isStatic
# Not using optimizations on Darwin
# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found.
, enableOptimizations ? (!stdenv.isDarwin)
+6 -3
pkgs/development/libraries/cdo/default.nix
···
{ stdenv, fetchurl, curl, hdf5, netcdf
-
, enable_cdi_lib ? false # build, install and link to a CDI library [default=no]
-
, enable_all_static ? false # build a completely statically linked CDO binary [default=no]
-
, enable_cxx ? false # Use CXX as default compiler [default=no]
+
, # build, install and link to a CDI library [default=no]
+
enable_cdi_lib ? false
+
, # build a completely statically linked CDO binary
+
enable_all_static ? stdenv.hostPlatform.isStatic
+
, # Use CXX as default compiler [default=no]
+
enable_cxx ? false
}:
stdenv.mkDerivation rec {
+2 -1
pkgs/development/libraries/crc32c/default.nix
···
{ stdenv, lib, fetchFromGitHub, cmake, gflags
-
, staticOnly ? false }:
+
, staticOnly ? stdenv.hostPlatform.isStatic
+
}:
stdenv.mkDerivation rec {
pname = "crc32c";
+2 -1
pkgs/development/libraries/gsm/default.nix
···
{ stdenv, fetchurl
-
, staticSupport ? false # Compile statically (support for packages that look for the static object)
+
, # Compile statically (support for packages that look for the static object)
+
staticSupport ? stdenv.hostPlatform.isStatic
}:
let
+4 -1
pkgs/development/libraries/libev/default.nix
···
-
{ stdenv, fetchurl, static ? false }:
+
{ stdenv, fetchurl
+
, # Note: -static hasn’t work on darwin
+
static ? with stdenv.hostPlatform; isStatic && !isDarwin
+
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
+3 -1
pkgs/development/libraries/libressl/default.nix
···
-
{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch, buildShared ? true }:
+
{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch
+
, buildShared ? !stdenv.hostPlatform.isStatic
+
}:
let
+1 -1
pkgs/development/libraries/nghttp2/default.nix
···
, enableAsioLib ? false, boost ? null
, enableGetAssets ? false, libxml2 ? null
, enableJemalloc ? false, jemalloc ? null
-
, enableApp ? !stdenv.hostPlatform.isWindows
+
, enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic
, enablePython ? false, python ? null, cython ? null, ncurses ? null, setuptools ? null
}:
+3 -1
pkgs/development/libraries/snappy/default.nix
···
-
{ stdenv, fetchFromGitHub, cmake, static ? false }:
+
{ stdenv, fetchFromGitHub, cmake
+
, static ? stdenv.hostPlatform.isStatic
+
}:
stdenv.mkDerivation rec {
pname = "snappy";
+3 -1
pkgs/development/web/woff2/default.nix
···
-
{ brotli, cmake, pkgconfig, fetchFromGitHub, stdenv, static ? false }:
+
{ brotli, cmake, pkgconfig, fetchFromGitHub, stdenv
+
, static ? stdenv.hostPlatform.isStatic
+
}:
stdenv.mkDerivation rec {
pname = "woff2";
+2 -1
pkgs/os-specific/linux/kmod/default.nix
···
{ stdenv, lib, fetchurl, autoreconfHook, pkgconfig
, libxslt, xz, elf-header
-
, withStatic ? false }:
+
, withStatic ? stdenv.hostPlatform.isStatic
+
}:
let
systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ];
+24 -9
pkgs/servers/x11/xorg/overrides.nix
···
mkfontdir = self.mkfontscale;
libxcb = super.libxcb.overrideAttrs (attrs: {
-
configureFlags = [ "--enable-xkb" "--enable-xinput" ];
+
configureFlags = [ "--enable-xkb" "--enable-xinput" ]
+
++ stdenv.lib.optional stdenv.hostPlatform.isStatic "--disable-shared";
outputs = [ "out" "dev" "man" "doc" ];
});
···
outputs = [ "out" "dev" "man" ];
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
-
depsBuildBuild = [ buildPackages.stdenv.cc ];
+
depsBuildBuild = [
+
buildPackages.stdenv.cc
+
] ++ stdenv.lib.optionals stdenv.hostPlatform.isStatic [
+
(self.buildPackages.stdenv.cc.libc.static or null)
+
];
preConfigure = ''
sed 's,^as_dummy.*,as_dummy="\$PATH",' -i configure
'';
-
postInstall =
-
''
-
# Remove useless DocBook XML files.
-
rm -rf $out/share/doc
-
'';
+
postInstall = ''
+
# Remove useless DocBook XML files.
+
rm -rf $out/share/doc
+
'';
CPP = stdenv.lib.optionalString stdenv.isDarwin "clang -E -";
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xorgproto ];
});
···
xdpyinfo = super.xdpyinfo.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
+
preConfigure = attrs.preConfigure or ""
+
# missing transitive dependencies
+
+ stdenv.lib.optionalString stdenv.hostPlatform.isStatic ''
+
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lXau -lXdmcp"
+
'';
});
# Propagate some build inputs because of header file dependencies.
···
libXi = super.libXi.overrideAttrs (attrs: {
outputs = [ "out" "dev" "man" "doc" ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXfixes ];
-
configureFlags = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
-
"xorg_cv_malloc0_returns_null=no";
+
configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+
"xorg_cv_malloc0_returns_null=no"
+
] ++ stdenv.lib.optional stdenv.hostPlatform.isStatic "--disable-shared";
});
libXinerama = super.libXinerama.overrideAttrs (attrs: {
···
xauth = super.xauth.overrideAttrs (attrs: {
doCheck = false; # fails
+
preConfigure = attrs.preConfigure or ""
+
# missing transitive dependencies
+
+ stdenv.lib.optionalString stdenv.hostPlatform.isStatic ''
+
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lxcb -lXau -lXdmcp"
+
'';
});
xcursorthemes = super.xcursorthemes.overrideAttrs (attrs: {
+3 -1
pkgs/tools/compression/brotli/default.nix
···
-
{ stdenv, fetchFromGitHub, cmake, fetchpatch, staticOnly ? false }:
+
{ stdenv, fetchFromGitHub, cmake, fetchpatch
+
, staticOnly ? stdenv.hostPlatform.isStatic
+
}:
# ?TODO: there's also python lib in there
+1 -1
pkgs/tools/compression/zstd/default.nix
···
, fixDarwinDylibNames
, file
, legacySupport ? false
-
, static ? false
+
, static ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
+3 -1
pkgs/tools/filesystems/e2fsprogs/default.nix
···
-
{ stdenv, buildPackages, fetchurl, fetchpatch, pkgconfig, libuuid, gettext, texinfo, shared ? true }:
+
{ stdenv, buildPackages, fetchurl, fetchpatch, pkgconfig, libuuid, gettext, texinfo
+
, shared ? !stdenv.hostPlatform.isStatic
+
}:
stdenv.mkDerivation rec {
pname = "e2fsprogs";
+4 -1
pkgs/tools/graphics/gifsicle/default.nix
···
-
{ stdenv, fetchurl, xorgproto, libXt, libX11, gifview ? false, static ? false }:
+
{ stdenv, fetchurl, xorgproto, libXt, libX11
+
, gifview ? false
+
, static ? stdenv.hostPlatform.isStatic
+
}:
with stdenv.lib;
+2 -1
pkgs/tools/networking/curl/default.nix
···
, gnutlsSupport ? false, gnutls ? null
, wolfsslSupport ? false, wolfssl ? null
, scpSupport ? zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin, libssh2 ? null
-
, gssSupport ? !stdenv.hostPlatform.isWindows, libkrb5 ? null
+
, # a very sad story re static: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039
+
gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic, libkrb5 ? null
, c-aresSupport ? false, c-ares ? null
, brotliSupport ? false, brotli ? null
}:
-80
pkgs/top-level/static.nix
···
haskellStaticAdapter;
};
-
nghttp2 = super.nghttp2.override {
-
enableApp = false;
-
};
-
zlib = super.zlib.override {
# Don’t use new stdenv zlib because
# it doesn’t like the --disable-shared flag
stdenv = super.stdenv;
};
-
gifsicle = super.gifsicle.override {
-
static = true;
-
};
openssl = super.openssl_1_1.overrideAttrs (o: {
# OpenSSL doesn't like the `--enable-static` / `--disable-shared` flags.
configureFlags = (removeUnknownConfigureFlags o.configureFlags);
···
# --disable-shared flag
stdenv = super.stdenv;
};
-
cdo = super.cdo.override {
-
enable_all_static = true;
-
};
-
gsm = super.gsm.override {
-
staticSupport = true;
-
};
-
crc32c = super.crc32c.override {
-
staticOnly = true;
-
};
perl = super.perl.override {
# Don’t use new stdenv zlib because
# it doesn’t like the --disable-shared flag
stdenv = super.stdenv;
};
-
woff2 = super.woff2.override {
-
static = true;
-
};
-
snappy = super.snappy.override {
-
static = true;
-
};
-
libressl = super.libressl.override {
-
buildShared = false;
-
};
-
-
kmod = super.kmod.override {
-
withStatic = true;
-
};
-
-
curl = super.curl.override {
-
# a very sad story: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039
-
gssSupport = false;
-
};
-
-
e2fsprogs = super.e2fsprogs.override {
-
shared = false;
-
};
-
-
brotli = super.brotli.override {
-
staticOnly = true;
-
};
-
-
zstd = super.zstd.override {
-
static = true;
-
};
ocaml-ng = self.lib.mapAttrs (_: set:
if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set
) super.ocaml-ng;
-
-
python27 = super.python27.override { static = true; };
-
python36 = super.python36.override { static = true; };
-
python37 = super.python37.override { static = true; };
-
python38 = super.python38.override { static = true; };
-
python39 = super.python39.override { static = true; };
-
python3Minimal = super.python3Minimal.override { static = true; };
-
-
# Note: -static doesn’t work on darwin
-
libev = super.libev.override { static = !super.stdenv.hostPlatform.isDarwin; };
-
-
xorg = super.xorg.overrideScope' (xorgself: xorgsuper: {
-
libX11 = xorgsuper.libX11.overrideAttrs (attrs: {
-
depsBuildBuild = attrs.depsBuildBuild ++ [ (self.buildPackages.stdenv.cc.libc.static or null) ];
-
});
-
xauth = xorgsuper.xauth.overrideAttrs (attrs: {
-
# missing transitive dependencies
-
preConfigure = attrs.preConfigure or "" + ''
-
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lxcb -lXau -lXdmcp"
-
'';
-
});
-
xdpyinfo = xorgsuper.xdpyinfo.overrideAttrs (attrs: {
-
# missing transitive dependencies
-
preConfigure = attrs.preConfigure or "" + ''
-
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lXau -lXdmcp"
-
'';
-
});
-
libxcb = xorgsuper.libxcb.overrideAttrs (attrs: {
-
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
-
});
-
libXi= xorgsuper.libXi.overrideAttrs (attrs: {
-
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
-
});
-
});
}