summaryrefslogtreecommitdiff
path: root/wage/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'wage/default.nix')
-rw-r--r--wage/default.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/wage/default.nix b/wage/default.nix
new file mode 100644
index 0000000..bda492f
--- /dev/null
+++ b/wage/default.nix
@@ -0,0 +1,40 @@
+{ rust
+, wasm-bindgen-cli
+, buildRustPackage
+, fetchFromGitHub
+}:
+
+buildRustPackage {
+ pname = "wage";
+ version = "git-main";
+
+ src = fetchFromGitHub {
+ owner = "str4d";
+ repo = "wage";
+ rev = "refs/heads/main";
+ sha256 = "sha256-ZeGYPIPAfYo+WGWtphfzcGtQ7qAjDslQoKcFhYyqEQM=";
+ };
+
+ nativeBuildInputs = [ rust wasm-bindgen-cli ];
+
+ patchPhase = ''
+ cp ${./Cargo.lock} .
+ '';
+
+ buildPhase = ''
+ cargo build --release --target=wasm32-unknown-unknown
+ '';
+
+ installPhase = ''
+ mkdir -p $out;
+
+ wasm-bindgen \
+ --target web \
+ --out-dir $out \
+ target/wasm32-unknown-unknown/release/wage.wasm;
+ '';
+
+ cargoLock = {
+ lockFile = ./Cargo.lock;
+ };
+}