From 61700da0064627900e356da9c164289c461005e1 Mon Sep 17 00:00:00 2001 From: Presenter Date: Mon, 27 Nov 2023 14:08:54 +0100 Subject: [PATCH] Initial commit --- .envrc | 1 + .gitignore | 1 + NOTES.md | 28 ++++++++++++ flake.lock | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 42 +++++++++++++++++ 5 files changed, 202 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 NOTES.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..6b064fa --- /dev/null +++ b/NOTES.md @@ -0,0 +1,28 @@ +# NOTES + +# Prerequisites + +- Install Rust +- Install Node.js + +# Create demo + +1. Install `create-tauri-app` + +```sh +cargo install create-tauri-app --locked +``` + +2. Create a Tauri app + +```sh +cargo create-tauri-app RustOnWebDemo +``` + +3. Get started + +```sh +cd RustOnWebDemo +npm install +npm run tauri dev +``` diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6bf3a4f --- /dev/null +++ b/flake.lock @@ -0,0 +1,130 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1685566663, + "narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4ecab3273592f27479a583fb6d975d4aba3486fe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1701051362, + "narHash": "sha256-3dXjewnLylWGZKNshIV0eiabhIDjcUNXC5zRKcm0TxY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "055d3d2ea161dfc6ca569f2f135a107f48cf483e", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b6703de --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + description = "TAURI demo devshell"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/23.05"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + in + with pkgs; + { + devShells.default = mkShell { + buildInputs = [ + # Required MacOS frameworks: + darwin.apple_sdk.frameworks.Cocoa + darwin.apple_sdk.frameworks.Foundation + darwin.apple_sdk.frameworks.WebKit + + # Probably not required MacOS frameworks: + # darwin.apple_sdk.frameworks.AppKit + # darwin.apple_sdk.frameworks.CoreFoundation + # darwin.apple_sdk.frameworks.CoreServices + # darwin.apple_sdk.frameworks.Security + + nodejs + openssl + pkg-config + rust-bin.stable.latest.default + nixpkgs-fmt + ]; + }; + } + ); +}