crane/checks/trunk.nix
Ivan Petkov ff2e879b26
update all Cargo.locks (#364)
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/4a56ce9727a0c5478a836a0d8a8f641c5b9a3d5f' (2023-08-02)
  → 'github:NixOS/nixpkgs/5068bc8fe943bde3c446326da8d0ca9c93d5a682' (2023-08-07)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/99df4908445be37ddb2d332580365fce512a7dcf' (2023-08-03)
  → 'github:oxalica/rust-overlay/b520a3889b24aaf909e287d19d406862ced9ffc9' (2023-08-07)
2023-08-11 00:13:17 +00:00

44 lines
1.1 KiB
Nix

{ myLib
, pkgs
, runCommand
, stdenv
}:
let
wasmToolchain = pkgs.rust-bin.stable.latest.minimal.override {
targets = [ "wasm32-unknown-unknown" ];
};
tarball = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/4e6868b1aa3766ab1de169922bb3826143941973.tar.gz";
sha256 = "sha256:1q6bj2jjlwb10sfrhqmjpzsc3yc4x76cvky16wh0z52p7d2lhdpv";
};
myLibWasm = (myLib.overrideToolchain wasmToolchain).overrideScope' (final: prev: {
inherit (import tarball { inherit (stdenv) system; }) wasm-bindgen-cli;
});
defaultArgs = {
src = ./trunk;
doCheck = false;
};
# default build
cargoArtifacts = myLibWasm.buildDepsOnly (defaultArgs // {
CARGO_BUILD_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
''