2024-01-02 11:29:13 +00:00
|
|
|
{ lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, darwin, fetchurl }:
|
|
|
|
|
|
|
|
let
|
|
|
|
wasiPreviewCommandComponentAdapter = fetchurl {
|
2024-07-27 06:49:29 +00:00
|
|
|
url = "https://github.com/bytecodealliance/wasmtime/releases/download/v22.0.0/wasi_snapshot_preview1.command.wasm";
|
|
|
|
hash = "sha256-UVBFddlI0Yh1ZNs0b2jSnKsHvGGAS5U09yuwm8Q6lxw=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
wasiPreviewReactorComponentAdapter = fetchurl {
|
2024-07-27 06:49:29 +00:00
|
|
|
url = "https://github.com/bytecodealliance/wasmtime/releases/download/v22.0.0/wasi_snapshot_preview1.reactor.wasm";
|
|
|
|
hash = "sha256-oE53IRMZgysSWT7RhrpZJjdaIyzCRf0h4d1yjqj/PSk=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "wash-cli";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.29.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchCrate {
|
|
|
|
inherit version pname;
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-A66KSDYFbByguhnlzzU5nf8pE3lhnYQjI3h73SKB2Zo=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
cargoHash = "sha256-2mo30xHQ3aCExdI0ITDY9g/C5peN48PdUNFVVxM//+c=";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [ openssl ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-01-02 11:29:13 +00:00
|
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
|
|
darwin.apple_sdk.frameworks.CoreServices
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = "
|
|
|
|
export WASI_PREVIEW1_COMMAND_COMPONENT_ADAPTER=${wasiPreviewCommandComponentAdapter}
|
|
|
|
export WASI_PREVIEW1_REACTOR_COMPONENT_ADAPTER=${wasiPreviewReactorComponentAdapter}
|
|
|
|
";
|
|
|
|
|
|
|
|
# Tests require the internet and don't work when running in nix
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "wasmCloud Shell (wash) CLI tool";
|
|
|
|
homepage = "https://wasmcloud.com/";
|
|
|
|
mainProgram = "wash";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ bloveless ];
|
|
|
|
};
|
|
|
|
}
|