nixUnstable: Enable cross-compilation

Older nix versions likely aren't feasible due to the perl dependency.

authored by Ben Gamari and committed by Will Dietz 5d6e229e 94ab0da6

+6 -19
+6 -19
pkgs/tools/package-management/nix/default.nix
··· 2 2 , pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli 3 3 , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl 4 4 , libseccomp, busybox-sandbox-shell 5 - , hostPlatform 5 + , hostPlatform, buildPlatform 6 6 , storeDir ? "/nix/store" 7 7 , stateDir ? "/nix/var" 8 8 , confDir ? "/etc" ··· 52 52 "--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}" 53 53 ] ++ lib.optionals (is20 && stdenv.isLinux) [ 54 54 "--with-sandbox-shell=${sh}/bin/busybox" 55 - ]; 55 + ] 56 + ++ lib.optional ( 57 + hostPlatform != buildPlatform && hostPlatform ? nix && hostPlatform.nix ? system 58 + ) ''--with-system=${hostPlatform.nix.system}''; 56 59 57 60 makeFlags = "profiledir=$(out)/etc/profile.d"; 58 61 59 62 installFlags = "sysconfdir=$(out)/etc"; 60 63 61 - doInstallCheck = true; 64 + doInstallCheck = hostPlatform == buildPlatform; 62 65 63 66 # socket path becomes too long otherwise 64 67 preInstallCheck = lib.optional stdenv.isDarwin "export TMPDIR=/tmp"; 65 68 66 69 separateDebugInfo = stdenv.isLinux; 67 - 68 - crossAttrs = { 69 - configureFlags = 70 - '' 71 - --with-store-dir=${storeDir} --localstatedir=${stateDir} 72 - --with-dbi=${perlPackages.DBI}/${perl.libPrefix} 73 - --with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix} 74 - --with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix} 75 - --disable-init-state 76 - --enable-gc 77 - '' + stdenv.lib.optionalString ( 78 - hostPlatform ? nix && hostPlatform.nix ? system 79 - ) ''--with-system=${hostPlatform.nix.system}''; 80 - 81 - doInstallCheck = false; 82 - }; 83 70 84 71 enableParallelBuilding = true; 85 72