Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build namada wasm scripts #208

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 46 additions & 11 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# Nix Inputs
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane.url = "github:ipetkov/crane";
sbt-derivation.url = "github:zaninime/sbt-derivation";
nix-std.url = "github:chessai/nix-std";
flake-parts.url = "github:hercules-ci/flake-parts";
Expand Down
14 changes: 6 additions & 8 deletions modules/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@
inherit (self'.packages) libwasmvm_1_2_3;
inherit cosmosLib;
};
namada = import ../packages/namada.nix {
inherit pkgs;
inherit (inputs) namada-src;
};
namada-src = pkgs.symlinkJoin {
name = "namada-src";
paths = [inputs.namada-src.outPath];
};
}
# This list contains attr sets that are recursively merged into the
# base attrset
Expand Down Expand Up @@ -180,6 +172,12 @@
inherit (inputs) evmos-src;
inherit (cosmosLib) mkGenerator;
})
# Namada
(import ../packages/namada {
inherit pkgs;
inherit (inputs) namada-src;
craneLib = inputs.crane.lib.${system};
})
];
};
}
133 changes: 92 additions & 41 deletions packages/namada.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,98 @@
pkgs,
namada-src,
}:
pkgs.rustPlatform.buildRustPackage {
pname = "namada";
version = "v0.28.1";
src = namada-src;
nativeBuildInputs = with pkgs;
(
lib.optionals stdenv.isLinux
[pkg-config]
)
++ [
protobuf
rustPlatform.bindgenHook # required for bindgen in custom build script for librocksdb-sys
];
buildInputs = with pkgs;
lib.optionals stdenv.isLinux [
systemd # required for libudev in custom build script for hidapi
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
hidapi
]
++ [
openssl
openssl.dev
];
{
namada = pkgs.rustPlatform.buildRustPackage {
pname = "namada";
version = "v0.28.1";
src = namada-src;
nativeBuildInputs = with pkgs;
(
lib.optionals stdenv.isLinux
[pkg-config]
)
++ [
protobuf
rustPlatform.bindgenHook # required for bindgen in custom build script for librocksdb-sys
];
buildInputs = with pkgs;
lib.optionals stdenv.isLinux [
systemd # required for libudev in custom build script for hidapi
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
hidapi
]
++ [
openssl
openssl.dev
];

cargoLock = {
lockFile = "${namada-src}/Cargo.lock";
outputHashes = {
"borsh-ext-1.2.0" = "sha256-nQadqyeAY0/gEMLBkpqtSm5D7kV+r3LVT/Cg2oTV7Ug=";
"clru-0.5.0" = "sha256-/1NfKqcWGCyF3+f0v2CnuFmNjjKkzfvYcX+GzxLwz7s=";
"ethbridge-bridge-contract-0.24.0" = "sha256-qs81bIWKk4oxh6nFWqAt4eBbPuIWF2a3ytUSjDJZWSU=";
"index-set-0.8.0" = "sha256-oxJfQdKnYiW5VbMPuukVyDY5n8mys31hYNrJF89nXhY=";
"ledger-namada-rs-0.0.1" = "sha256-qFL8LU7i5NAnMUhtrGykVfiYX1NodCNkZG07twyVrac=";
"masp_note_encryption-1.0.0" = "sha256-NwiosHTdzzny+L5VtOBaIa7wia/yRlfiz/8f0pAHUZk=";
"sparse-merkle-tree-0.3.1-pre" = "sha256-B1ZEN4FZjV0x0Cqvx7AZjH9qhDMZYFPVJzg89dqWCv4=";
"tiny-bip39-0.8.2" = "sha256-TU+7Vug3+M6Zxhy6Wln54Pxc9ES4EdFq5TvMOcAG+qA=";
"tower-abci-0.11.1" = "sha256-KisZtsylvUymvV1TpDdGIiE7fSarcuD3I8oZ33BdKTU=";
"wasmer-2.3.0" = "sha256-Fd8ewAwslopjqUVoeHwSR/Zoh4Zm+Sdx8oksXmhLU20=";
"zcash_encoding-0.2.0" = "sha256-keuaoM/t1Q/+8JMemMMUuIo4g5I/EAoONFge+dyWGy0=";
};
cargoLock = {
lockFile = "${namada-src}/Cargo.lock";
outputHashes = {
"borsh-ext-1.2.0" = "sha256-nQadqyeAY0/gEMLBkpqtSm5D7kV+r3LVT/Cg2oTV7Ug=";
"clru-0.5.0" = "sha256-/1NfKqcWGCyF3+f0v2CnuFmNjjKkzfvYcX+GzxLwz7s=";
"ethbridge-bridge-contract-0.24.0" = "sha256-qs81bIWKk4oxh6nFWqAt4eBbPuIWF2a3ytUSjDJZWSU=";
"index-set-0.8.0" = "sha256-oxJfQdKnYiW5VbMPuukVyDY5n8mys31hYNrJF89nXhY=";
"ledger-namada-rs-0.0.1" = "sha256-qFL8LU7i5NAnMUhtrGykVfiYX1NodCNkZG07twyVrac=";
"masp_note_encryption-1.0.0" = "sha256-NwiosHTdzzny+L5VtOBaIa7wia/yRlfiz/8f0pAHUZk=";
"sparse-merkle-tree-0.3.1-pre" = "sha256-B1ZEN4FZjV0x0Cqvx7AZjH9qhDMZYFPVJzg89dqWCv4=";
"tiny-bip39-0.8.2" = "sha256-TU+7Vug3+M6Zxhy6Wln54Pxc9ES4EdFq5TvMOcAG+qA=";
"tower-abci-0.11.1" = "sha256-KisZtsylvUymvV1TpDdGIiE7fSarcuD3I8oZ33BdKTU=";
"wasmer-2.3.0" = "sha256-Fd8ewAwslopjqUVoeHwSR/Zoh4Zm+Sdx8oksXmhLU20=";
"zcash_encoding-0.2.0" = "sha256-keuaoM/t1Q/+8JMemMMUuIo4g5I/EAoONFge+dyWGy0=";
};
};
doCheck = false;
};
namada-wasm-scripts = pkgs.rustPlatform.buildRustPackage {
pname = "namada-wasm-scripts";
version = "v0.28.1";
src = pkgs.symlinkJoin
{
name = "namada-wasm-scripts-src" ;
paths = [ "${namada-src}/wasm" "${namada-src}/tx_prelude" "${namada-src}/vp_prelude" ];
patches = [];
};
nativeBuildInputs = with pkgs;
(
lib.optionals stdenv.isLinux
[pkg-config]
)
++ [
protobuf
rustPlatform.bindgenHook # required for bindgen in custom build script for librocksdb-sys
];
buildInputs = with pkgs;
lib.optionals stdenv.isLinux [
systemd # required for libudev in custom build script for hidapi
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
hidapi
]
++ [
openssl
openssl.dev
];

preBuild = "${pkgs.tree}/bin/tree .";

cargoLock = {
lockFile = "${namada-src}/wasm/Cargo.lock";
outputHashes = {
"borsh-ext-1.2.0" = "sha256-nQadqyeAY0/gEMLBkpqtSm5D7kV+r3LVT/Cg2oTV7Ug=";
"clru-0.5.0" = "sha256-/1NfKqcWGCyF3+f0v2CnuFmNjjKkzfvYcX+GzxLwz7s=";
"ethbridge-bridge-contract-0.24.0" = "sha256-qs81bIWKk4oxh6nFWqAt4eBbPuIWF2a3ytUSjDJZWSU=";
"index-set-0.8.0" = "sha256-oxJfQdKnYiW5VbMPuukVyDY5n8mys31hYNrJF89nXhY=";
"masp_note_encryption-1.0.0" = "sha256-NwiosHTdzzny+L5VtOBaIa7wia/yRlfiz/8f0pAHUZk=";
"sparse-merkle-tree-0.3.1-pre" = "sha256-B1ZEN4FZjV0x0Cqvx7AZjH9qhDMZYFPVJzg89dqWCv4=";
"tiny-bip39-0.8.2" = "sha256-TU+7Vug3+M6Zxhy6Wln54Pxc9ES4EdFq5TvMOcAG+qA=";
"wasmer-2.3.0" = "sha256-Fd8ewAwslopjqUVoeHwSR/Zoh4Zm+Sdx8oksXmhLU20=";
"zcash_encoding-0.2.0" = "sha256-keuaoM/t1Q/+8JMemMMUuIo4g5I/EAoONFge+dyWGy0=";
};
};
doCheck = false;
};
doCheck = false;
}
67 changes: 67 additions & 0 deletions packages/namada/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
pkgs,
namada-src,
craneLib,
}:
let version = "v0.28.1";
in
{
namada = pkgs.rustPlatform.buildRustPackage {
pname = "namada";
inherit version;
src = namada-src;
nativeBuildInputs = with pkgs;
(
lib.optionals stdenv.isLinux
[pkg-config]
)
++ [
protobuf
rustPlatform.bindgenHook # required for bindgen in custom build script for librocksdb-sys
];
buildInputs = with pkgs;
lib.optionals stdenv.isLinux [
systemd # required for libudev in custom build script for hidapi
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
hidapi
]
++ [
openssl
openssl.dev
];

cargoLock = {
lockFile = "${namada-src}/Cargo.lock";
outputHashes = {
"borsh-ext-1.2.0" = "sha256-nQadqyeAY0/gEMLBkpqtSm5D7kV+r3LVT/Cg2oTV7Ug=";
"clru-0.5.0" = "sha256-/1NfKqcWGCyF3+f0v2CnuFmNjjKkzfvYcX+GzxLwz7s=";
"ethbridge-bridge-contract-0.24.0" = "sha256-qs81bIWKk4oxh6nFWqAt4eBbPuIWF2a3ytUSjDJZWSU=";
"index-set-0.8.0" = "sha256-oxJfQdKnYiW5VbMPuukVyDY5n8mys31hYNrJF89nXhY=";
"ledger-namada-rs-0.0.1" = "sha256-qFL8LU7i5NAnMUhtrGykVfiYX1NodCNkZG07twyVrac=";
"masp_note_encryption-1.0.0" = "sha256-NwiosHTdzzny+L5VtOBaIa7wia/yRlfiz/8f0pAHUZk=";
"sparse-merkle-tree-0.3.1-pre" = "sha256-B1ZEN4FZjV0x0Cqvx7AZjH9qhDMZYFPVJzg89dqWCv4=";
"tiny-bip39-0.8.2" = "sha256-TU+7Vug3+M6Zxhy6Wln54Pxc9ES4EdFq5TvMOcAG+qA=";
"tower-abci-0.11.1" = "sha256-KisZtsylvUymvV1TpDdGIiE7fSarcuD3I8oZ33BdKTU=";
"wasmer-2.3.0" = "sha256-Fd8ewAwslopjqUVoeHwSR/Zoh4Zm+Sdx8oksXmhLU20=";
"zcash_encoding-0.2.0" = "sha256-keuaoM/t1Q/+8JMemMMUuIo4g5I/EAoONFge+dyWGy0=";
};
};
doCheck = false;
};
namada-wasm-scripts = let
craneLib' = craneLib.overrideToolchain (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default));
src = namada-src;
cargoExtraArgs = "--manifest-path=./wasm/Cargo.toml --locked";
name = "namada-wasm-scripts";
cargoArtifacts = craneLib'.buildDepsOnly {
cargoLock = "${src}/wasm/Cargo.lock";
pname = "${name}-deps";
inherit version src cargoExtraArgs;
};
in craneLib'.buildPackage {
pname = name;
inherit version src cargoExtraArgs cargoArtifacts;
};
}
Loading