summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2024-01-28 12:06:58 +0100
committerTom Barrett <tom@tombarrett.xyz>2024-01-28 12:06:58 +0100
commita6cb7f4f88f2471e6329298230bb64827c852348 (patch)
treea95648a15831bf5f7f974a1df24e9695867bf5c0 /flake.nix
parent02231403df6241d08ea61600713fc1565bb22956 (diff)
close but not thereflake
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix39
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];
+ };
+ };
+}