mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
[Nix] Some steps towards cross-compilation support
This commit is contained in:
parent
c722f34ef3
commit
8b3b1f4c57
56
default.nix
56
default.nix
@ -1,10 +1,60 @@
|
|||||||
let
|
let
|
||||||
pkgs = import (fetchTarball {
|
nixpkgsFn = import (fetchTarball {
|
||||||
url = https://github.com/NixOS/nixpkgs/archive/642499faefb17c3d36e074cf35b189f75ba43ee2.tar.gz;
|
url = https://github.com/NixOS/nixpkgs/archive/642499faefb17c3d36e074cf35b189f75ba43ee2.tar.gz;
|
||||||
sha256 = "16j7gl3gg839fy54z5v4aap8lgf1ffih5swmfk62zskk30nwzfbi";
|
sha256 = "16j7gl3gg839fy54z5v4aap8lgf1ffih5swmfk62zskk30nwzfbi";
|
||||||
}) {};
|
});
|
||||||
|
|
||||||
|
# nixcrpkgs = import (fetchTarball {
|
||||||
|
# url = https://github.com/DavidEGrayson/nixcrpkgs/archive/606e5fac74204643c8ca48dd73ce239b2f821d69.tar.gz;
|
||||||
|
# sha256 = "19dn7i200xsv8s92kxymv3nd87jncmp3ki8pw77v2rxfvn8ldg34";
|
||||||
|
# }) {};
|
||||||
|
|
||||||
|
nixpkgs = nixpkgsFn {};
|
||||||
|
|
||||||
|
targets = {
|
||||||
|
windows = {
|
||||||
|
config = "x86_64-pc-mingw32";
|
||||||
|
libc = "msvcrt";
|
||||||
|
platform = {};
|
||||||
|
openssl.system = "mingw";
|
||||||
|
};
|
||||||
|
|
||||||
|
iphone = {
|
||||||
|
config = "aarch64-apple-ios";
|
||||||
|
# config = "aarch64-apple-darwin14";
|
||||||
|
sdkVer = "10.2";
|
||||||
|
xcodeVer = "8.2";
|
||||||
|
xcodePlatform = "iPhoneOS";
|
||||||
|
useiOSPrebuilt = true;
|
||||||
|
platform = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
android = {
|
||||||
|
config = "armv7a-unknown-linux-androideabi";
|
||||||
|
sdkVer = "24";
|
||||||
|
ndkVer = "18b";
|
||||||
|
platform = nixpkgs.platforms.armv7a-android;
|
||||||
|
useAndroidPrebuilt = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
raspberryPi = rec {
|
||||||
|
config = "armv6l-unknown-linux-gnueabihf";
|
||||||
|
platform = nixpkgs.platforms.raspberrypi;
|
||||||
|
};
|
||||||
|
|
||||||
|
raspberryPi2 = {
|
||||||
|
config = "armv7l-unknown-linux-gnueabihf";
|
||||||
|
platform = nixpkgs.platforms.armv7l-hf-multiplatform;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nimbus = pkgs: pkgs.callPackage ./nix/nimbus.nix {};
|
||||||
|
|
||||||
|
mapAttrs = nixpkgs.lib.attrsets.mapAttrs;
|
||||||
|
crossPackages = mapAttrs (target: conf: nixpkgsFn { crossSystem = conf; }) targets;
|
||||||
|
crossBulds = mapAttrs (target: packages: nimbus packages) crossPackages;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
import ./nix/nimbus.nix { inherit pkgs; }
|
(nimbus nixpkgs) // crossBulds
|
||||||
|
|
||||||
|
13
nix/nim.nix
13
nix/nim.nix
@ -1,4 +1,5 @@
|
|||||||
{ stdenv, lib, makeWrapper, git, nodejs, openssl, pcre, readline, sqlite }:
|
{ stdenv, lib, makeWrapper, git, clang, nodejs, openssl, pcre, readline, sqlite }:
|
||||||
|
|
||||||
let
|
let
|
||||||
csources = fetchTarball {
|
csources = fetchTarball {
|
||||||
url = https://github.com/nim-lang/csources/archive/b56e49bbedf62db22eb26388f98262e2948b2cbc.tar.gz;
|
url = https://github.com/nim-lang/csources/archive/b56e49bbedf62db22eb26388f98262e2948b2cbc.tar.gz;
|
||||||
@ -46,7 +47,7 @@ in stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
makeWrapper nodejs
|
makeWrapper nodejs
|
||||||
openssl pcre readline sqlite git
|
clang openssl pcre readline sqlite git
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@ -56,11 +57,11 @@ in stdenv.mkDerivation rec {
|
|||||||
cp -r ${csources} csources
|
cp -r ${csources} csources
|
||||||
chmod 755 $(find csources dist/nimble -type d)
|
chmod 755 $(find csources dist/nimble -type d)
|
||||||
cd csources
|
cd csources
|
||||||
sh build.sh
|
CC="clang" LD="clang" sh build.sh
|
||||||
cd ..
|
cd ..
|
||||||
bin/nim c -d:release koch.nim
|
bin/nim c --cc:clang -d:release koch.nim
|
||||||
./koch boot -d:release
|
./koch boot --cc:clang -d:release
|
||||||
./koch tools -d:release
|
./koch tools --cc:clang -d:release
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
{ pkgs ? import <nixpkgs> { } }:
|
{ stdenv, callPackage, sqlite, clang, rocksdb }:
|
||||||
|
|
||||||
let
|
let
|
||||||
stdenv = pkgs.stdenv;
|
nim = callPackage ./nim.nix {};
|
||||||
nim = pkgs.callPackage ./nim.nix {};
|
|
||||||
makeLibraryPath = stdenv.lib.makeLibraryPath;
|
makeLibraryPath = stdenv.lib.makeLibraryPath;
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -15,11 +14,11 @@ stdenv.mkDerivation rec {
|
|||||||
description = "An Ethereum 2.0 Sharding Client for Resource-Restricted Devices";
|
description = "An Ethereum 2.0 Sharding Client for Resource-Restricted Devices";
|
||||||
homepage = https://github.com/status-im/nimbus;
|
homepage = https://github.com/status-im/nimbus;
|
||||||
license = [licenses.asl20];
|
license = [licenses.asl20];
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix ++ platforms.windows;
|
||||||
};
|
};
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
buildInputs = [pkgs.clang nim pkgs.rocksdb pkgs.sqlite];
|
buildInputs = [clang nim rocksdb sqlite];
|
||||||
LD_LIBRARY_PATH = "${makeLibraryPath buildInputs}";
|
LD_LIBRARY_PATH = "${makeLibraryPath buildInputs}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user