summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--flake.lock25
-rw-r--r--flake.nix41
-rw-r--r--index.html20
-rw-r--r--resources/background.pngbin3910 -> 0 bytes
5 files changed, 88 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index ea8c4bf..4075fb2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-/target
+target
+result
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..4321d7f
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,25 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1704842529,
+ "narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..e418992
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,41 @@
+{
+ outputs = {
+ self,
+ nixpkgs,
+ }: let
+ pkgs = nixpkgs.legacyPackages.x86_64-linux;
+ buildRustPackage =
+ pkgs.rustPlatform.buildRustPackage.override
+ {rustc = pkgs.rustc-wasm32;};
+ rust-lld = pkgs.symlinkJoin {
+ name = "rust-lld";
+ paths = [pkgs.rustc-wasm32.llvmPackages.lld];
+ postBuild = ''
+ ln -s $out/bin/lld $out/bin/rust-lld
+ '';
+ };
+ in {
+ packages.x86_64-linux.default = buildRustPackage rec {
+ name = "gems";
+ src = ./.;
+ cargoLock = {
+ lockFile = ./Cargo.lock;
+ };
+ doCheck = false;
+ buildPhase = ''
+ cargo build --target wasm32-unknown-unknown --release
+ wasm-bindgen --out-name gems \
+ --out-dir $out \
+ --target web target/wasm32-unknown-unknown/release/gems.wasm
+ '';
+ installPhase = ''
+ cp -r assets $out
+ cp index.html $out
+ '';
+ nativeBuildInputs = [
+ rust-lld
+ pkgs.wasm-bindgen-cli
+ ];
+ };
+ };
+}
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..9552fb5
--- /dev/null
+++ b/index.html
@@ -0,0 +1,20 @@
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <style>
+ body {
+ background: #526864;
+ }
+ canvas {
+ width: 100%;
+ height: 100%;
+ background-color: white;
+ }
+ </style>
+ <title>gems</title>
+ </head>
+ <script type="module">
+ import init from './gems.js'
+ init()
+ </script>
+</html>
diff --git a/resources/background.png b/resources/background.png
deleted file mode 100644
index 060989b..0000000
--- a/resources/background.png
+++ /dev/null
Binary files differ