mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-23 08:22:41 +03:00
37 lines
814 B
Nix
37 lines
814 B
Nix
{ pkgs
|
|
, myLib
|
|
, runCommand
|
|
}:
|
|
|
|
let
|
|
wasmToolchain = pkgs.rust-bin.stable.latest.minimal.override {
|
|
targets = [ "wasm32-unknown-unknown" ];
|
|
};
|
|
|
|
myLibWasm = myLib.overrideToolchain wasmToolchain;
|
|
|
|
defaultArgs = {
|
|
src = ./trunk;
|
|
doCheck = false;
|
|
};
|
|
|
|
# default build
|
|
cargoArtifacts = myLibWasm.buildDepsOnly (defaultArgs // {
|
|
cargoExtraArgs = "--target=wasm32-unknown-unknown";
|
|
});
|
|
trunkSimple = myLibWasm.buildTrunkPackage (defaultArgs // {
|
|
inherit cargoArtifacts;
|
|
pname = "trunk-simple";
|
|
});
|
|
|
|
trunkSimpleNoArtifacts = myLibWasm.buildTrunkPackage (defaultArgs // {
|
|
pname = "trunk-simple-no-artifacts";
|
|
});
|
|
in
|
|
runCommand "trunkTests" { } ''
|
|
test -f ${trunkSimple}/*.wasm
|
|
test -f ${trunkSimple}/*.css
|
|
test -f ${trunkSimpleNoArtifacts}/*.wasm
|
|
mkdir -p $out
|
|
''
|