diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 39 |
1 files changed, 39 insertions, 0 deletions
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]; + }; + }; +} |