-
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.
- Loading branch information
1 parent
e2f74f1
commit b522666
Showing
5 changed files
with
93 additions
and
67 deletions.
There are no files selected for viewing
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,12 @@ | ||
{ | ||
npmlock2nix, | ||
nodejs_20, | ||
demo-inspector-wasm, | ||
}: | ||
npmlock2nix.v2.node_modules { | ||
src = ./www; | ||
nodejs = nodejs_20; | ||
localPackages = { | ||
"demo-inspector" = demo-inspector-wasm; | ||
}; | ||
} |
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,5 @@ | ||
prev: final: { | ||
demo-inspector-wasm = final.callPackage ./wasm.nix {}; | ||
demo-inspector-node-modules = final.callPackage ./modules.nix {}; | ||
demo-inspector = final.callPackage ./package.nix {}; | ||
} |
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,21 @@ | ||
{ | ||
stdenv, | ||
nodejs_20, | ||
demo-inspector-node-modules, | ||
}: | ||
stdenv.mkDerivation rec { | ||
name = "demo-inspector"; | ||
version = "0.1.0"; | ||
|
||
src = ./www; | ||
|
||
nativeBuildInputs = [nodejs_20]; | ||
buildPhase = '' | ||
cp -r ${demo-inspector-node-modules}/node_modules ./node_modules | ||
npm run build | ||
''; | ||
|
||
installPhase = '' | ||
cp -r dist $out | ||
''; | ||
} |
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 |
---|---|---|
@@ -1,46 +1,59 @@ | ||
pkgs: let | ||
{ | ||
rustPlatform, | ||
nodejs_20, | ||
pkg-config, | ||
openssl, | ||
fetchCrate, | ||
rust-bin, | ||
wasm-pack, | ||
binaryen, | ||
}: let | ||
deps = (builtins.fromTOML (builtins.readFile ./wasm/Cargo.toml)).dependencies; | ||
wasm-bindgen-cli = pkgs.rustPlatform.buildRustPackage rec { | ||
wasm-bindgen-cli = rustPlatform.buildRustPackage rec { | ||
pname = "wasm-bindgen-cli"; | ||
version = deps.wasm-bindgen.version; | ||
src = pkgs.fetchCrate { | ||
src = fetchCrate { | ||
inherit pname version; | ||
sha256 = "sha256-IPxP68xtNSpwJjV2yNMeepAS0anzGl02hYlSTvPocz8="; | ||
}; | ||
|
||
cargoSha256 = "sha256-pBeQaG6i65uJrJptZQLuIaCb/WCQMhba1Z1OhYqA8Zc="; | ||
nativeBuildInputs = [ pkgs.pkg-config ]; | ||
nativeBuildInputs = [pkg-config]; | ||
|
||
buildInputs = with pkgs; [ openssl ]; | ||
buildInputs = [openssl]; | ||
|
||
checkInputs = [ pkgs.nodejs_20 ]; | ||
checkInputs = [nodejs_20]; | ||
|
||
dontCargoCheck = true; | ||
}; | ||
in pkgs.rustPlatform.buildRustPackage rec { | ||
name = "demo-inspector-wasm"; | ||
version = "0.1.0"; | ||
|
||
cargoLock = { | ||
lockFile = ./wasm/Cargo.lock; | ||
rust-wasm = rust-bin.stable.latest.default.override { | ||
targets = ["wasm32-unknown-unknown"]; | ||
}; | ||
in | ||
rustPlatform.buildRustPackage rec { | ||
name = "demo-inspector-wasm"; | ||
version = "0.1.0"; | ||
|
||
cargoLock = { | ||
lockFile = ./wasm/Cargo.lock; | ||
}; | ||
|
||
src = ./wasm; | ||
|
||
WASM_PACK_CACHE = "/build/cache"; | ||
nativeBuildInputs = [rust-wasm wasm-pack wasm-bindgen-cli binaryen]; | ||
buildPhase = '' | ||
runHook preBuild | ||
( | ||
set -x | ||
wasm-pack build --mode no-install | ||
) | ||
runHook postBuild | ||
''; | ||
dontCargoBuild = true; | ||
dontCargoCheck = true; | ||
|
||
src = ./wasm; | ||
|
||
WASM_PACK_CACHE = "/build/cache"; | ||
nativeBuildInputs = [pkgs.rust-wasm pkgs.wasm-pack wasm-bindgen-cli pkgs.binaryen]; | ||
buildPhase = '' | ||
runHook preBuild | ||
( | ||
set -x | ||
wasm-pack build --mode no-install | ||
) | ||
runHook postBuild | ||
''; | ||
dontCargoBuild = true; | ||
dontCargoCheck = true; | ||
|
||
installPhase = '' | ||
cp -r pkg $out | ||
''; | ||
} | ||
installPhase = '' | ||
cp -r pkg $out | ||
''; | ||
} |