nixpkgs/pkgs/applications/blockchains/polkadot/default.nix
Ihar Hrachyshka dd0f03a56c treewide: remove usage of deprecated apple_sdk framework stubs
They are not doing anything right now. This is in preparation for their
complete removal from the tree.

Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.

Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-19 20:28:20 -04:00

88 lines
2.3 KiB
Nix

{
cacert,
fetchFromGitHub,
lib,
openssl,
pkg-config,
protobuf,
rocksdb_8_3,
rust-jemalloc-sys-unprefixed,
rustPlatform,
rustc,
stdenv,
}:
let
rocksdb = rocksdb_8_3;
in
rustPlatform.buildRustPackage rec {
pname = "polkadot";
version = "2503";
src = fetchFromGitHub {
owner = "paritytech";
repo = "polkadot-sdk";
rev = "polkadot-stable${version}";
hash = "sha256-nPZFmsf82JpBrOrErH5hrEcmieECfgA7JWzEyEh8AAE=";
# the build process of polkadot requires a .git folder in order to determine
# the git commit hash that is being built and add it to the version string.
# since having a .git folder introduces reproducibility issues to the nix
# build, we check the git commit hash after fetching the source and save it
# into a .git_commit file, and then delete the .git folder. we can then use
# this file to populate an environment variable with the commit hash, which
# is picked up by polkadot's build process.
leaveDotGit = true;
postFetch = ''
( cd $out; git rev-parse --short HEAD > .git_commit )
rm -rf $out/.git
'';
};
preBuild = ''
export SUBSTRATE_CLI_GIT_COMMIT_HASH=$(< .git_commit)
rm .git_commit
'';
useFetchCargoVendor = true;
cargoHash = "sha256-yOJyvpsEK4Ab/Bh6xmqAEHhj1Rq4u/CevcP7vJi0zxo=";
buildType = "production";
buildAndTestSubdir = "polkadot";
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
rustc
rustc.llvmPackages.lld
];
# NOTE: jemalloc is used by default on Linux with unprefixed enabled
buildInputs = [
openssl
] ++ lib.optionals stdenv.hostPlatform.isLinux [ rust-jemalloc-sys-unprefixed ];
checkInputs = [
cacert
];
OPENSSL_NO_VENDOR = 1;
PROTOC = "${protobuf}/bin/protoc";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
meta = with lib; {
description = "Implementation of a https://polkadot.network node in Rust based on the Substrate framework";
homepage = "https://github.com/paritytech/polkadot-sdk";
license = licenses.gpl3Only;
maintainers = with maintainers; [
akru
andresilva
FlorianFranzen
RaghavSood
];
# See Iso::from_arch in src/isa/mod.rs in cranelift-codegen-meta.
platforms = intersectLists platforms.unix (
platforms.aarch64 ++ platforms.s390x ++ platforms.riscv64 ++ platforms.x86
);
};
}