about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-20 12:31:50 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-20 12:32:25 +0100
commitb7baf40e099b4215181fe7b0c63083b12ef2c7fb (patch)
treea6efabd31d05b6d0a36624729e80377bbbfb0149 /nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix
parent710028664e26e85cb831a869b3da9f6993902255 (diff)
parent0799f514b1cd74878174939df79ac60ca5036673 (diff)
downloadnixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.gz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.bz2
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.lz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.xz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.zst
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix45
1 files changed, 38 insertions, 7 deletions
diff --git a/nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix b/nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix
index d91da1db8fe2..d2efa4633a64 100644
--- a/nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix
+++ b/nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix
@@ -2,14 +2,18 @@
 
 { stdenv
 , fetchFromGitHub
+, fetchpatch
 , lib
 , rustPlatform
 , pkg-config
+, darwin
 , udev
 , zlib
 , protobuf
 , openssl
 , libclang
+, libcxx
+, rocksdb
 , rustfmt
 , perl
 , hidapi
@@ -23,7 +27,6 @@
     "solana-ledger-tool"
     "solana-log-analyzer"
     "solana-net-shaper"
-    "solana-sys-tuner"
     "solana-validator"
     "cargo-build-bpf"
     "cargo-test-bpf"
@@ -43,7 +46,8 @@ let
   pinData = lib.importJSON ./pin.json;
   version = pinData.version;
   hash = pinData.hash;
-  cargoHash = pinData.cargoHash;
+  inherit (darwin.apple_sdk_11_0) Libsystem;
+  inherit (darwin.apple_sdk_11_0.frameworks) System IOKit AppKit Security;
 in
 rustPlatform.buildRustPackage rec {
   pname = "solana-validator";
@@ -56,8 +60,22 @@ rustPlatform.buildRustPackage rec {
     inherit hash;
   };
 
-  # partly inspired by https://github.com/obsidiansystems/solana-bridges/blob/develop/default.nix#L29
-  inherit cargoHash;
+  # fix build with rust 1.70+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/solana-labs/solana/commit/9e703f85de4184f577f22a1c72a0d33612f2feb1.patch";
+      hash = "sha256-bAKTIQ6FhTk6bIddYULwLfdH5kzNPw1ltXJEfawtAXg=";
+      includes = [ "sdk/program/src/account_info.rs" ];
+    })
+  ];
+
+  cargoLock = {
+    lockFile = ./Cargo.lock;
+    outputHashes = {
+      "crossbeam-epoch-0.9.5" = "sha256-Jf0RarsgJiXiZ+ddy0vp4jQ59J9m0k3sgXhWhCdhgws=";
+      "ntapi-0.3.7" = "sha256-G6ZCsa3GWiI/FeGKiK9TWkmTxen7nwpXvm5FtjNtjWU=";
+    };
+  };
 
   cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;
 
@@ -66,19 +84,32 @@ rustPlatform.buildRustPackage rec {
 
   nativeBuildInputs = [ pkg-config protobuf rustfmt perl rustPlatform.bindgenHook ];
   buildInputs =
-    [ openssl zlib libclang hidapi ] ++ (lib.optionals stdenv.isLinux [ udev ]);
+    [ openssl zlib libclang hidapi ] ++ (lib.optionals stdenv.isLinux [ udev ])
+    ++ lib.optionals stdenv.isDarwin [ Security System Libsystem libcxx ];
   strictDeps = true;
 
   doCheck = false;
 
+  env = {
+    # Used by build.rs in the rocksdb-sys crate. If we don't set these, it would
+    # try to build RocksDB from source.
+    ROCKSDB_LIB_DIR = "${lib.getLib rocksdb}/lib";
+
+    # If set, always finds OpenSSL in the system, even if the vendored feature is enabled.
+    OPENSSL_NO_VENDOR = "1";
+  } // lib.optionalAttrs stdenv.isDarwin {
+    # Require this on darwin otherwise the compiler starts rambling about missing
+    # cmath functions
+    CPPFLAGS = "-isystem ${lib.getDev libcxx}/include/c++/v1";
+    LDFLAGS = "-L${lib.getLib libcxx}/lib";
+  };
+
   meta = with lib; {
     description = "Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces. ";
     homepage = "https://solana.com";
     license = licenses.asl20;
     maintainers = with maintainers; [ adjacentresearch ];
     platforms = platforms.unix;
-    # never built on aarch64-darwin, x86_64-darwin since first introduction in nixpkgs
-    broken = stdenv.isDarwin;
   };
   passthru.updateScript = ./update.sh;
 }