website/flake.nix
2026-09-15 11:22:01 +02:00

67 lines
1.8 KiB
Nix

{
description = "Bevy WASM website";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
flake-parts,
nixpkgs,
rust-overlay,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem = { pkgs, system, ... }:
let
overlays = [ (import rust-overlay) ];
rustPkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = rustPkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
cargoLock = fromTOML (builtins.readFile ./Cargo.lock);
wasmBindgen = pkgs.lib.findFirst
(pkg: pkg.name == "wasm-bindgen")
(throw "Could not find wasm-bindgen package")
cargoLock.package;
wasm-bindgen-cli = pkgs.buildWasmBindgenCli rec {
src = pkgs.fetchCrate {
pname = "wasm-bindgen-cli";
version = wasmBindgen.version;
hash = "sha256-a7lcXJnnZkYReja+iUO7NqqrWyv3toxnUgQb8s4IS5s=";
};
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit src;
inherit (src) pname version;
hash = "sha256-R1Tas33Ursy8kqsxguAkG0ZhNed2n5uFTAhw1l2qlLY=";
};
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = [
rustToolchain
wasm-bindgen-cli
pkgs.binaryen
pkgs.brotli
pkgs.just
];
};
};
};
}