From 54c158cb8415fc64567042041f06aaaec9a2c821 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 20 Oct 2006 11:49:47 +0000 Subject: [PATCH] * Function `makeStaticBinaries' that augments stdenv to produce statically linked binaries. svn path=/nixpkgs/trunk/; revision=6787 --- pkgs/top-level/all-packages.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5da0627b7ac..99c586a5702 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -104,6 +104,18 @@ rec { isDietLibC = true; }; + # Return a modified stdenv that tries to build statically linked + # binaries. + makeStaticBinaries = stdenv: stdenv // + { mkDerivation = args: stdenv.mkDerivation (args // { + NIX_CFLAGS_LINK = "-static"; + + configureFlags = + (if args ? configureFlags then args.configureFlags else "") + + " --disable-shared"; # brrr... + }); + }; + # Applying this to an attribute set will cause nix-env to look # inside the set for derivations. recurseIntoAttrs = attrs: attrs // {recurseForDerivations = true;};