From 5d6e229ec0dbd99d2aba37a31c65b2e9849e9eb5 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 10 Dec 2017 01:33:27 -0500 Subject: [PATCH] nixUnstable: Enable cross-compilation Older nix versions likely aren't feasible due to the perl dependency. --- pkgs/tools/package-management/nix/default.nix | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 91844bdb9dde..ce95f31112de 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -2,7 +2,7 @@ , pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl , libseccomp, busybox-sandbox-shell -, hostPlatform +, hostPlatform, buildPlatform , storeDir ? "/nix/store" , stateDir ? "/nix/var" , confDir ? "/etc" @@ -52,35 +52,22 @@ let "--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}" ] ++ lib.optionals (is20 && stdenv.isLinux) [ "--with-sandbox-shell=${sh}/bin/busybox" - ]; + ] + ++ lib.optional ( + hostPlatform != buildPlatform && hostPlatform ? nix && hostPlatform.nix ? system + ) ''--with-system=${hostPlatform.nix.system}''; makeFlags = "profiledir=$(out)/etc/profile.d"; installFlags = "sysconfdir=$(out)/etc"; - doInstallCheck = true; + doInstallCheck = hostPlatform == buildPlatform; # socket path becomes too long otherwise preInstallCheck = lib.optional stdenv.isDarwin "export TMPDIR=/tmp"; separateDebugInfo = stdenv.isLinux; - crossAttrs = { - configureFlags = - '' - --with-store-dir=${storeDir} --localstatedir=${stateDir} - --with-dbi=${perlPackages.DBI}/${perl.libPrefix} - --with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix} - --with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix} - --disable-init-state - --enable-gc - '' + stdenv.lib.optionalString ( - hostPlatform ? nix && hostPlatform.nix ? system - ) ''--with-system=${hostPlatform.nix.system}''; - - doInstallCheck = false; - }; - enableParallelBuilding = true; meta = {