From a6cb7f4f88f2471e6329298230bb64827c852348 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Sun, 28 Jan 2024 12:06:58 +0100 Subject: close but not there --- flake.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5bff2cc --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + inputs = { + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + outputs = { + self, + nixpkgs, + rust-overlay, + }: let + overlays = [(import rust-overlay)]; + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system overlays; + }; + asmjs-rust-bin = pkgs.rust-bin.stable.latest.default.override { + targets = ["asmjs-unknown-emscripten"]; + }; + rustPlatform = pkgs.makeRustPlatform { + cargo = asmjs-rust-bin; + rustc = asmjs-rust-bin; + }; + in { + packages.x86_64-linux.default = rustPlatform.buildRustPackage rec { + name = "web"; + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + doCheck = false; + HOME = "$TMPDIR"; + buildPhase = '' + cargo build --target asmjs-unknown-emscripten --release + ''; + nativeBuildInputs = [pkgs.SDL2 pkgs.SDL2_gfx pkgs.emscripten]; + RUST_BACKTRACE = "full"; + buildInputs = [pkgs.python3Packages.requests]; + }; + }; +} -- cgit v1.2.3