File tree Expand file tree Collapse file tree 4 files changed +195
-1
lines changed Expand file tree Collapse file tree 4 files changed +195
-1
lines changed Original file line number Diff line number Diff line change 11/target
2+ result
Original file line number Diff line number Diff line change 1+ {
2+ inputs = {
3+ nixpkgs . url = "github:NixOS/nixpkgs/nixos-unstable" ;
4+ fenix . url = "github:nix-community/fenix" ;
5+ flake-utils . url = "github:numtide/flake-utils" ;
6+ crane = {
7+ url = "github:ipetkov/crane" ;
8+ inputs . nixpkgs . follows = "nixpkgs" ;
9+ } ;
10+ } ;
11+
12+ outputs = {
13+ nixpkgs ,
14+ flake-utils ,
15+ crane ,
16+ ...
17+ } @ inputs :
18+ flake-utils . lib . eachSystem ( flake-utils . lib . defaultSystems ) (
19+ system : let
20+ pkgs = nixpkgs . legacyPackages . ${ system } ;
21+ lib = pkgs . lib ;
22+ fenix = inputs . fenix . packages ;
23+ craneLib = ( crane . mkLib pkgs ) . overrideToolchain toolchain ;
24+
25+ # fenix: rustup replacement for reproducible builds
26+ toolchain = fenix . ${ system } . fromToolchainFile {
27+ file = ./rust-toolchain.toml ;
28+ sha256 = "sha256-VZZnlyP69+Y3crrLHQyJirqlHrTtGTsyiSnZB8jEvVo=" ;
29+ } ;
30+
31+ # buildInputs for Examples
32+ buildInputs = with pkgs ; [
33+ toolchain
34+ pkg-config
35+ ] ;
36+
37+ zed-plugin = craneLib . buildPackage {
38+ doCheck = false ;
39+ pname = "zed-dotenv" ;
40+ src = craneLib . cleanCargoSource ( craneLib . path ./. ) ;
41+ buildPhaseCargoCommand = "cargo build --release --target wasm32-wasip1" ;
42+
43+ installPhaseCommand = ''
44+ mkdir -p $out
45+ cp target/wasm32-wasip1/release/zed_dotenv.wasm $out/extension.wasm
46+ '' ;
47+
48+ inherit buildInputs ;
49+ } ;
50+ in {
51+ # `nix build`
52+ packages . default = zed-plugin ;
53+ # `nix develop`
54+ devShells . default = pkgs . mkShell {
55+ packages = with pkgs ; buildInputs ++ [
56+ cargo-dist
57+ cargo-release
58+ ] ;
59+ LD_LIBRARY_PATH = lib . makeLibraryPath buildInputs ;
60+ } ;
61+ }
62+ ) ;
63+ }
Original file line number Diff line number Diff line change 11[toolchain ]
22channel = " stable"
33profile = " default"
4- targets = [" wasm32-unknown-unknown " ]
4+ targets = [" wasm32-wasip1 " ]
You can’t perform that action at this time.
0 commit comments