Skip to content

Commit

Permalink
nix: allow static compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Sep 29, 2019
1 parent 5ea4c91 commit 03809ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions pkgs/tools/package-management/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ common =
, stateDir
, confDir
, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp
, withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp

, withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp
, enableStatic ? false
, name, suffix ? "", src, includesPerl ? false, fromGit ? false

}:
Expand Down Expand Up @@ -56,13 +56,15 @@ common =

propagatedBuildInputs = [ boehmgc ];

# Seems to be required when using std::atomic with 64-bit types
NIX_LDFLAGS = lib.optionalString (stdenv.hostPlatform.system == "armv6l-linux") "-latomic";
NIX_LDFLAGS =
lib.optionalString enableStatic "-lssl -lbrotlicommon -lssh2 -lz -lnghttp2 -lcrypto"
# Seems to be required when using std::atomic with 64-bit types
+ lib.optionalString (stdenv.hostPlatform.system == "armv6l-linux") "-latomic";

preConfigure =
# Copy libboost_context so we don't get all of Boost in our closure.
# https://github.com/NixOS/nixpkgs/issues/45462
if is20 then ''
if is20 && !enableStatic then ''
mkdir -p $out/lib
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
rm -f $out/lib/*.a
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ in {
static = true;
};
openblas = super.openblas.override { enableStatic = true; };
nix = super.nix.override { withAWS = false; };
nix = super.nix.override { enableStatic = true; };
# openssl 1.1 doesn't compile
openssl = super.openssl_1_0_2.override {
static = true;
Expand Down

0 comments on commit 03809ba

Please sign in to comment.