Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ clang 2, cmake 3, CoreFoundation 4, fetchFromGitHub 5, fetchurl 6, lib 7, lighthouse 8, nix-update-script 9, nodePackages 10, perl 11, pkg-config 12, postgresql 13, protobuf 14, rustPlatform 15, Security 16, sqlite 17, stdenv 18, SystemConfiguration 19, testers 20, unzip 21}: 22 23rustPlatform.buildRustPackage rec { 24 pname = "lighthouse"; 25 version = "4.1.0"; 26 27 # lighthouse/common/deposit_contract/build.rs 28 depositContractSpecVersion = "0.12.1"; 29 testnetDepositContractSpecVersion = "0.9.2.1"; 30 31 src = fetchFromGitHub { 32 owner = "sigp"; 33 repo = "lighthouse"; 34 rev = "v${version}"; 35 hash = "sha256-QVAFzV9sao8+eegI7bLfm+pPHyvDFhnADS80+nqqgtE="; 36 }; 37 38 patches = [ 39 ./use-system-sqlite.patch 40 ]; 41 42 postPatch = '' 43 cp ${./Cargo.lock} Cargo.lock 44 ''; 45 46 cargoLock = { 47 lockFile = ./Cargo.lock; 48 outputHashes = { 49 "amcl-0.3.0" = "sha256-Mj4dXTlGVSleFfuTKgVDQ7S3jANMsdtVE5L90WGxA4U="; 50 "arbitrary-1.3.0" = "sha256-BMxcBfxBRf+Kb0Tz55jtFbwokSeD2GPtB+KV8Wbne0g="; 51 "beacon-api-client-0.1.0" = "sha256-fI8qST6HZrchg7yr/nVtRNrsW3f5ONSX+mGRYW+iiqA="; 52 "ethereum-consensus-0.1.1" = "sha256-aBrZ786Me0BWpnncxQc5MT3r+O0yLQhqGKFBiNTdqSA="; 53 "libmdbx-0.1.4" = "sha256-NMsR/Wl1JIj+YFPyeMMkrJFfoS07iEAKEQawO89a+/Q="; 54 "lmdb-rkv-0.14.0" = "sha256-sxmguwqqcyOlfXOZogVz1OLxfJPo+Q0+UjkROkbbOCk="; 55 "mev-rs-0.2.1" = "sha256-n3ns1oynw5fKQtp/CQHER41+C1EmLCVEBqggkHc3or4="; 56 "ssz-rs-0.8.0" = "sha256-k1JLu+jZrSqUyHou76gbJeA5CDWwdL0fPkek3Vzl4Gs="; 57 "warp-0.3.2" = "sha256-m9lkEgeSs0yEc+6N6DG7IfQY/evkUMoNyst2hMUR//c="; 58 }; 59 }; 60 61 buildFeatures = [ "modern" "gnosis" ]; 62 63 nativeBuildInputs = [ 64 rustPlatform.bindgenHook 65 cmake 66 perl 67 pkg-config 68 protobuf 69 ]; 70 71 buildInputs = [ 72 sqlite 73 ] ++ lib.optionals stdenv.isDarwin [ 74 CoreFoundation 75 Security 76 SystemConfiguration 77 ]; 78 79 depositContractSpec = fetchurl { 80 url = "https://raw.githubusercontent.com/ethereum/eth2.0-specs/v${depositContractSpecVersion}/deposit_contract/contracts/validator_registration.json"; 81 hash = "sha256-ZslAe1wkmkg8Tua/AmmEfBmjqMVcGIiYHwi+WssEwa8="; 82 }; 83 84 testnetDepositContractSpec = fetchurl { 85 url = "https://raw.githubusercontent.com/sigp/unsafe-eth2-deposit-contract/v${testnetDepositContractSpecVersion}/unsafe_validator_registration.json"; 86 hash = "sha256-aeTeHRT3QtxBRSNMCITIWmx89vGtox2OzSff8vZ+RYY="; 87 }; 88 89 LIGHTHOUSE_DEPOSIT_CONTRACT_SPEC_URL = "file://${depositContractSpec}"; 90 LIGHTHOUSE_DEPOSIT_CONTRACT_TESTNET_URL = "file://${testnetDepositContractSpec}"; 91 92 cargoBuildFlags = [ 93 "--package lighthouse" 94 ]; 95 96 __darwinAllowLocalNetworking = true; 97 98 checkFeatures = [ ]; 99 100 # All of these tests require network access and/or docker 101 cargoTestFlags = [ 102 "--workspace" 103 "--exclude beacon_node" 104 "--exclude http_api" 105 "--exclude beacon_chain" 106 "--exclude lighthouse" 107 "--exclude lighthouse_network" 108 "--exclude slashing_protection" 109 "--exclude watch" 110 "--exclude web3signer_tests" 111 ]; 112 113 # All of these tests require network access 114 checkFlags = [ 115 "--skip service::tests::tests::test_dht_persistence" 116 "--skip time::test::test_reinsertion_updates_timeout" 117 118 ] ++ lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ 119 "--skip subnet_service::tests::sync_committee_service::same_subscription_with_lower_until_epoch" 120 "--skip subnet_service::tests::sync_committee_service::subscribe_and_unsubscribe" 121 ]; 122 123 nativeCheckInputs = [ 124 nodePackages.ganache 125 postgresql 126 ]; 127 128 passthru = { 129 tests.version = testers.testVersion { 130 package = lighthouse; 131 command = "lighthouse --version"; 132 version = "v${lighthouse.version}"; 133 }; 134 updateScript = nix-update-script { }; 135 }; 136 137 meta = with lib; { 138 description = "Ethereum consensus client in Rust"; 139 homepage = "https://lighthouse.sigmaprime.io/"; 140 license = licenses.asl20; 141 maintainers = with maintainers; [ centromere pmw ]; 142 }; 143}