Commit f6c73e51 authored by implr's avatar implr Committed by Bartosz Stebel
Browse files

solana-validator: drop

This is outdated (1.17 will not work on mainnet now) and largely redundant
with pkgs/by-name/so/solana-cli/package.nix.
That package already builds all the validator binaries.
parent 1935cd04
Loading
Loading
Loading
Loading
+0 −9147

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −131
Original line number Diff line number Diff line
# largely inspired from https://github.com/saber-hq/saber-overlay/blob/master/packages/solana/solana.nix

{
  stdenv,
  fetchFromGitHub,
  lib,
  rustPlatform,
  pkg-config,
  darwin,
  udev,
  zlib,
  protobuf,
  openssl,
  libcxx,
  rocksdb_8_3,
  rustfmt,
  perl,
  hidapi,
  solanaPkgs ?
    [
      "solana"
      "solana-bench-tps"
      "solana-faucet"
      "solana-gossip"
      "solana-install"
      "solana-keygen"
      "solana-ledger-tool"
      "solana-log-analyzer"
      "solana-net-shaper"
      "solana-validator"
      "cargo-build-bpf"
      "cargo-test-bpf"
      "solana-dos"
      "solana-install-init"
      "solana-stake-accounts"
      "solana-test-validator"
      "solana-tokens"
      "solana-watchtower"
    ]
    ++ [
      # XXX: Ensure `solana-genesis` is built LAST!
      # See https://github.com/solana-labs/solana/issues/5826
      "solana-genesis"
    ],
}:
let
  pinData = lib.importJSON ./pin.json;
  version = pinData.version;
  hash = pinData.hash;
  rocksdb = rocksdb_8_3;
  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";
  inherit version;

  src = fetchFromGitHub {
    owner = "solana-labs";
    repo = "solana";
    rev = "v${version}";
    inherit hash;
  };

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "crossbeam-epoch-0.9.5" = "sha256-Jf0RarsgJiXiZ+ddy0vp4jQ59J9m0k3sgXhWhCdhgws=";
      "tokio-1.29.1" = "sha256-Z/kewMCqkPVTXdoBcSaFKG5GSQAdkdpj3mAzLLCjjGk=";
    };
  };

  cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;

  # weird errors. see https://github.com/NixOS/nixpkgs/issues/52447#issuecomment-852079285
  # LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config";

  nativeBuildInputs = [
    pkg-config
    protobuf
    rustfmt
    perl
    rustPlatform.bindgenHook
  ];
  buildInputs =
    [
      openssl
      zlib
      hidapi
    ]
    ++ (lib.optionals stdenv.hostPlatform.isLinux [ udev ])
    ++ lib.optionals stdenv.hostPlatform.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.hostPlatform.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;
  };
  passthru.updateScript = ./update.sh;
}
+0 −4
Original line number Diff line number Diff line
{
  "version": "1.17.28",
  "hash": "sha256-y79zsUfYsX377ofsFSg9a2il99uJsA+qdCu3J+EU5nQ="
}
+0 −33
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#! nix-shell -i oil -p jq moreutils nix-prefetch-github gnused

# TODO set to `verbose` or `extdebug` once implemented in oil
shopt --set xtrace
# we need failures inside of command subs to get the correct cargoHash
shopt --unset inherit_errexit

const directory = $(dirname $0 | xargs realpath)
const owner = "solana-labs"
const repo = "solana"
const latest_rev = $(curl -q https://api.github.com/repos/${owner}/${repo}/releases/latest | \
  jq -r '.tag_name')
const latest_version = $(echo ${latest_rev#v})
const current_version = $(jq -r '.version' $directory/pin.json)
if ("$latest_version" === "$current_version") {
  echo "solana is already up-to-date"
  return 0
} else {
  const tarball_meta = $(nix-prefetch-github $owner $repo --rev "$latest_rev")
  const tarball_hash = $(echo $tarball_meta | jq -r '.hash')

  jq ".version = \"$latest_version\" | \
      .\"hash\" = \"$tarball_hash\" | \
      .\"cargoHash\" = \"\"" $directory/pin.json | sponge $directory/pin.json

  const new_cargo_hash = $(nix-build -A solana-validator 2>&1 | \
    tail -n 2 | \
    head -n 1 | \
    sed 's/\s*got:\s*//')

  jq ".cargoHash = \"$new_cargo_hash\"" $directory/pin.json | sponge $directory/pin.json
}
+1 −0
Original line number Diff line number Diff line
@@ -1206,6 +1206,7 @@ mapAliases {
  source-han-serif-traditional-chinese = source-han-serif;


  solana-validator = throw "'solana-validator' is obsoleted by solana-cli, which also includes the validator binary"; # Added 2024-12-20
  spectral = throw "'spectral' has been renamed to/replaced by 'neochat'"; # Converted to throw 2024-10-17
  # spidermonkey is not ABI upwards-compatible, so only allow this for nix-shell
  spidermonkey = throw "'spidermonkey' has been renamed to/replaced by 'spidermonkey_78'"; # Converted to throw 2024-10-17
Loading