forked from wasmerio/wasmer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add Wasmer CLI package definition to Nix flake
Allows `nix run github:wasmerio/wasmer` to run the CLI. Also: * switches the nixpkgs channel used to 23.11-stable to avoid churn * Adds wasm-tools and cargo-deny into the devshell
- Loading branch information
Showing
3 changed files
with
127 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Nix derivation for the Wasmer CLI binary | ||
# | ||
# NOTE: mostly copied from upstrean nixpkgs | ||
# See: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/wasmer/default.nix | ||
pkgs@{ stdenv | ||
, lib | ||
, rustPlatform | ||
, fetchFromGitHub | ||
, llvmPackages | ||
, libffi | ||
, libxml2 | ||
, withLLVM ? !stdenv.isDarwin | ||
, withSinglepass ? !(stdenv.isDarwin && stdenv.isx86_64) | ||
, ... | ||
}: | ||
|
||
let | ||
# Get the release version from Cargo.toml | ||
cargoToml = builtins.fromTOML (builtins.readFile ../../lib/cli/Cargo.toml); | ||
version = cargoToml.package.version; | ||
in | ||
rustPlatform.buildRustPackage rec { | ||
pname = "wasmer"; | ||
version = "4.2.5"; | ||
|
||
src = ../..; | ||
|
||
cargoLock = { | ||
lockFile = ../../Cargo.lock; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
rustPlatform.bindgenHook | ||
]; | ||
|
||
buildInputs = lib.optionals withLLVM [ | ||
llvmPackages.llvm | ||
libffi | ||
libxml2 | ||
] ++ lib.optionals stdenv.isDarwin [ | ||
pkgs.CoreFoundation | ||
pkgs.SystemConfiguration | ||
pkgs.Security | ||
]; | ||
|
||
# check references to `compiler_features` in Makefile on update | ||
buildFeatures = [ | ||
"cranelift" | ||
"wasmer-artifact-create" | ||
"static-artifact-create" | ||
"wasmer-artifact-load" | ||
"static-artifact-load" | ||
] | ||
++ lib.optional withLLVM "llvm" | ||
++ lib.optional withSinglepass "singlepass"; | ||
|
||
cargoBuildFlags = [ "--manifest-path" "lib/cli/Cargo.toml" "--bin" "wasmer" ]; | ||
|
||
env.LLVM_SYS_150_PREFIX = lib.optionalString withLLVM llvmPackages.llvm.dev; | ||
|
||
doCheck = false; | ||
|
||
meta = with lib; { | ||
description = "The Universal WebAssembly Runtime"; | ||
longDescription = '' | ||
Wasmer is a standalone WebAssembly runtime for running WebAssembly outside | ||
of the browser, supporting WASI and Emscripten. Wasmer can be used | ||
standalone (via the CLI) and embedded in different languages, running in | ||
x86 and ARM devices. | ||
''; | ||
homepage = "https://wasmer.io/"; | ||
license = licenses.mit; | ||
}; | ||
} |