-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (81 loc) · 2.85 KB
/
Copy pathflake.nix
File metadata and controls
96 lines (81 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
description = "Meld - Static WebAssembly component fusion";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
# Rust 1.85.0 stable with wasm32-wasip2 target
rustToolchain = pkgs.rust-bin.stable."1.85.0".default.override {
targets = [ "wasm32-wasip2" ];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = [
# Rust toolchain (1.85.0 + wasm32-wasip2)
rustToolchain
# Build system
pkgs.bazel_7
# WebAssembly tools
pkgs.wasmtime
pkgs.wit-bindgen # wit-bindgen-cli for test fixture generation
# General development
pkgs.pkg-config
pkgs.openssl
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
pkgs.libiconv
];
# Bazel needs these to find the C/C++ toolchain
env = {
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
};
shellHook = ''
echo "meld dev shell"
echo " rust: $(rustc --version)"
echo " cargo: $(cargo --version)"
echo " bazel: $(bazel --version 2>/dev/null | head -1)"
echo " wasmtime: $(wasmtime --version 2>/dev/null)"
'';
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "meld";
version = "0.2.0";
src = pkgs.lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
pkgs.libiconv
];
# Only build the CLI binary
cargoBuildFlags = [ "--package" "meld-cli" ];
# Skip tests in the Nix build (they need wasm fixtures)
doCheck = false;
meta = {
description = "Static WebAssembly component fusion tool";
homepage = "https://github.com/pulseengine/meld";
license = pkgs.lib.licenses.asl20;
mainProgram = "meld";
};
};
}
);
}