diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index a66d652..01fc1dc 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -2,7 +2,7 @@ To bump the holochain version you will need to do these things: 1. update all holochain dependencies in the top-level `Cargo.toml` file -2. do a `nix flake update` before `nix develop` to bring down the latest Holochain version. Note that if you are updating to a major version you may need to change the source for `holonix.url` and `taurie-plugin-holochain.url` in the `flake.nix` file first. +2. do a `nix flake update` before `nix develop` to bring down the latest Holochain version. Note that if you are updating to a major version you may need to change the source for `holonix.url` in the `flake.nix` file first (e.g. `main-0.6` -> `main-0.7`), and possibly the `channel` in `rust-toolchain.toml` to match the Rust version that Holochain release is built with. 3. make any updates necessary to the crates due to any changes in Holochain. You should be able to check this by running `npm test` which should build all the crates and test the `client` and the `service` 4. if there have been major changes you many need to create new fixtures for the tests in `crates/runtime/fixtures` and `crates/runtime-ffi/fixtures` by using the scaffolding tool from the current version of Holochain to build the `forum.happ` file (which you do by running `hc-scaffold example` and the following the instructions to initialize the generated repo and finally running `npm run package`) 5. Finally you to actually do a release you publish all the components listed in the following order: diff --git a/flake.lock b/flake.lock index ed94b87..92350be 100644 --- a/flake.lock +++ b/flake.lock @@ -15,21 +15,6 @@ "type": "github" } }, - "crane_2": { - "locked": { - "lastModified": 1770419512, - "narHash": "sha256-o8Vcdz6B6bkiGUYkZqFwH3Pv1JwZyXht3dMtS7RchIo=", - "owner": "ipetkov", - "repo": "crane", - "rev": "2510f2cbc3ccd237f700bb213756a8f35c32d8d7", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -48,24 +33,6 @@ "type": "github" } }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" - }, - "locked": { - "lastModified": 1769996383, - "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "hc-scaffold": { "flake": false, "locked": { @@ -83,23 +50,6 @@ "type": "github" } }, - "hc-scaffold_2": { - "flake": false, - "locked": { - "lastModified": 1769104114, - "narHash": "sha256-Ebh8YW7J4VRAwhK9XQDf98nWAIvciddzdx7LbhZiwdI=", - "owner": "holochain", - "repo": "scaffolding", - "rev": "6749c80d54306e4c1ad5831ce2dbdbb9a283ee0c", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "v0.600.1-rc.0", - "repo": "scaffolding", - "type": "github" - } - }, "holochain": { "flake": false, "locked": { @@ -117,63 +67,6 @@ "type": "github" } }, - "holochain-nix-builders": { - "inputs": { - "crane": [ - "tauri-plugin-holochain", - "holochain-nix-builders", - "holonix", - "crane" - ], - "holonix": [ - "tauri-plugin-holochain", - "holonix" - ], - "nixpkgs": [ - "tauri-plugin-holochain", - "holochain-nix-builders", - "holonix", - "nixpkgs" - ], - "rust-overlay": [ - "tauri-plugin-holochain", - "holochain-nix-builders", - "holonix", - "rust-overlay" - ] - }, - "locked": { - "lastModified": 1772476964, - "narHash": "sha256-EUOhbhQXJD8Ogt4lzYa7lzLap0TPPkRPOeL0Bpx9/WY=", - "owner": "darksoil-studio", - "repo": "holochain-nix-builders", - "rev": "8733730cc9a11bc0a45c92626f8b3622ec3f853f", - "type": "github" - }, - "original": { - "owner": "darksoil-studio", - "ref": "main-0.6", - "repo": "holochain-nix-builders", - "type": "github" - } - }, - "holochain_2": { - "flake": false, - "locked": { - "lastModified": 1770591280, - "narHash": "sha256-v+5CAu0uP83J4s9JX6b3T566btfWU1DHrb8ScK7QoD8=", - "owner": "holochain", - "repo": "holochain", - "rev": "189e55996083c8e317df7b177c5eaef561cafbf4", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "holochain-0.6.1-rc.1", - "repo": "holochain", - "type": "github" - } - }, "holonix": { "inputs": { "crane": "crane", @@ -200,32 +93,6 @@ "type": "github" } }, - "holonix_2": { - "inputs": { - "crane": "crane_2", - "flake-parts": "flake-parts_2", - "hc-scaffold": "hc-scaffold_2", - "holochain": "holochain_2", - "kitsune2": "kitsune2_2", - "lair-keystore": "lair-keystore_2", - "nixpkgs": "nixpkgs_2", - "rust-overlay": "rust-overlay_2" - }, - "locked": { - "lastModified": 1770640893, - "narHash": "sha256-VsBjHLqsGNsf4upOQJ98DG5bRC89asTv2ygprhH3vWY=", - "owner": "holochain", - "repo": "holonix", - "rev": "dad799c47a4d7eb51daa9608094d8df90fbaf78f", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "main-0.6", - "repo": "holonix", - "type": "github" - } - }, "kitsune2": { "flake": false, "locked": { @@ -243,23 +110,6 @@ "type": "github" } }, - "kitsune2_2": { - "flake": false, - "locked": { - "lastModified": 1768402558, - "narHash": "sha256-v7uEmcVGC6tDjrkEZHMJa9DdXnqXwwVxJx9GkZq9P/U=", - "owner": "holochain", - "repo": "kitsune2", - "rev": "2b809bcf0bff3d493cd5ba230677240432fff58a", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "2b809bcf0bff3d493cd5ba230677240432fff58a", - "repo": "kitsune2", - "type": "github" - } - }, "lair-keystore": { "flake": false, "locked": { @@ -277,23 +127,6 @@ "type": "github" } }, - "lair-keystore_2": { - "flake": false, - "locked": { - "lastModified": 1759147598, - "narHash": "sha256-K8TkVlKAwS7uuSZC46oSHddtZTM2XGWUTNnjjYdC1bE=", - "owner": "holochain", - "repo": "lair", - "rev": "8aa9ab1468e82a8bfb9bf1e65762efc51659d306", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "v0.6.3", - "repo": "lair", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1775305101, @@ -325,37 +158,6 @@ "type": "github" } }, - "nixpkgs-lib_2": { - "locked": { - "lastModified": 1769909678, - "narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "72716169fe93074c333e8d0173151350670b824c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1770464364, - "narHash": "sha256-z5NJPSBwsLf/OfD8WTmh79tlSU8XgIbwmk6qB1/TFzY=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "23d72dabcb3b12469f57b37170fcbc1789bd7457", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-25.11", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "flake-parts": [ @@ -367,7 +169,10 @@ "holonix", "nixpkgs" ], - "tauri-plugin-holochain": "tauri-plugin-holochain" + "rust-overlay": [ + "holonix", + "rust-overlay" + ] } }, "rust-overlay": { @@ -390,125 +195,6 @@ "repo": "rust-overlay", "type": "github" } - }, - "rust-overlay_2": { - "inputs": { - "nixpkgs": [ - "tauri-plugin-holochain", - "holonix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1770520253, - "narHash": "sha256-6rWuHgSENXKnC6HGGAdRolQrnp/8IzscDn7FQEo1uEQ=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "ebb8a141f60bb0ec33836333e0ca7928a072217f", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "scaffolding": { - "inputs": { - "crane": [ - "tauri-plugin-holochain", - "scaffolding", - "holonix", - "crane" - ], - "holochain-nix-builders": [ - "tauri-plugin-holochain", - "holochain-nix-builders" - ], - "holonix": [ - "tauri-plugin-holochain", - "holonix" - ], - "nixpkgs": [ - "tauri-plugin-holochain", - "scaffolding", - "holonix", - "nixpkgs" - ], - "rust-overlay": [ - "tauri-plugin-holochain", - "scaffolding", - "holonix", - "rust-overlay" - ] - }, - "locked": { - "lastModified": 1772476985, - "narHash": "sha256-q+wPi8BAH6mo1p8Vn74QvUi4z5Wk3vsdYGjzMf8Xo4M=", - "owner": "darksoil-studio", - "repo": "scaffolding", - "rev": "6c54fbd08ee80e7664139e09c383043723000df1", - "type": "github" - }, - "original": { - "owner": "darksoil-studio", - "ref": "main-0.6", - "repo": "scaffolding", - "type": "github" - } - }, - "tauri-plugin-holochain": { - "inputs": { - "crane": [ - "tauri-plugin-holochain", - "holonix", - "crane" - ], - "holochain-nix-builders": "holochain-nix-builders", - "holonix": "holonix_2", - "nixpkgs": [ - "tauri-plugin-holochain", - "holonix", - "nixpkgs" - ], - "rust-overlay": [ - "tauri-plugin-holochain", - "holonix", - "rust-overlay" - ], - "scaffolding": "scaffolding", - "webkitnixpkgs": "webkitnixpkgs" - }, - "locked": { - "lastModified": 1772547106, - "narHash": "sha256-HUjWAAoTbbNAnyXwHEIeu5AnLfFw+x/qp/Cc1r4qs8g=", - "owner": "darksoil-studio", - "repo": "tauri-plugin-holochain", - "rev": "c3c39eacc071eac20e9e411c31a87599eba565be", - "type": "github" - }, - "original": { - "owner": "darksoil-studio", - "ref": "main-0.6", - "repo": "tauri-plugin-holochain", - "type": "github" - } - }, - "webkitnixpkgs": { - "locked": { - "lastModified": 1709246466, - "narHash": "sha256-jN8Y5Zv2tNUKIGuSqhm8yIMn2x6jhMQvNwKYduvKxjU=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "ed4db9c6c75079ff3570a9e3eb6806c8f692dc26", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "rev": "ed4db9c6c75079ff3570a9e3eb6806c8f692dc26", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 35cd434..1c54340 100644 --- a/flake.nix +++ b/flake.nix @@ -1,30 +1,141 @@ { - description = "Template for Holochain app development"; + description = "Volla Cloud Services — development environment"; + # We depend on holonix only for the Holochain toolchain (holochain, hc, + # hc-scaffold, lair-keystore, ...) and the rust-overlay it already pins. + # Everything else (Rust toolchain, Android SDK/NDK, Tauri desktop libs) is + # composed here from nixpkgs, so the repo has no dependency on any external + # Tauri/Holochain dev-shell flake. (The previous dev shell came from + # darksoil-studio/tauri-plugin-holochain, whose GitHub repo no longer + # exists — it was renamed to p2p-shipyard — making the input unfetchable.) inputs = { holonix.url = "github:holochain/holonix/main-0.6"; nixpkgs.follows = "holonix/nixpkgs"; flake-parts.follows = "holonix/flake-parts"; - - tauri-plugin-holochain.url = "github:darksoil-studio/tauri-plugin-holochain/main-0.6"; + rust-overlay.follows = "holonix/rust-overlay"; }; outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { systems = builtins.attrNames inputs.holonix.devShells; - perSystem = { inputs', config, pkgs, system, ... }: { - devShells.default = pkgs.mkShell { - inputsFrom = [ - inputs'.tauri-plugin-holochain.devShells.holochainTauriAndroidDev - inputs'.holonix.devShells.default - ]; - - packages = [ - pkgs.cargo-ndk - pkgs.pnpm + perSystem = { system, inputs', ... }: + let + pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ (import inputs.rust-overlay) ]; + config = { + allowUnfree = true; # Android SDK/NDK are unfree + android_sdk.accept_license = true; + }; + }; + + # Rust toolchain. Channel, components, and cross-compilation targets all + # come from ./rust-toolchain.toml so nix and rustup users stay in sync. + rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + + # Android SDK + NDK, matching the gradle config (compileSdk/buildTools 34, + # minSdk 27). The NDK is what `cargo ndk` uses to cross-compile the Rust + # crates into the jniLibs consumed by the Android libraries/plugins. + # 28.0.13004108 is the NDK the previous dev shell shipped, so the + # produced .so files stay the same (clang 19, 16 KB page-aligned). + ndkVersion = "28.0.13004108"; + androidComposition = pkgs.androidenv.composeAndroidPackages { + platformVersions = [ "34" ]; + buildToolsVersions = [ "34.0.0" ]; + includeNDK = true; + ndkVersions = [ ndkVersion ]; + cmakeVersions = [ "3.22.1" ]; + includeEmulator = false; # emulator is provided by CI / installed on demand + includeSystemImages = false; + }; + androidSdk = androidComposition.androidsdk; + androidHome = "${androidSdk}/libexec/android-sdk"; + ndkHome = "${androidHome}/ndk/${ndkVersion}"; + + # System libraries to build a Tauri v2 app on Linux. The tauri plugin + # crates link these on the host for `cargo check`/tests; Android builds + # don't use them. + tauriDeps = with pkgs; [ + webkitgtk_4_1 + gtk3 + gdk-pixbuf + glib + glib-networking + librsvg + libsoup_3 + dbus + openssl ]; + in + { + devShells.default = pkgs.mkShell { + # Tools placed on PATH. + packages = (with inputs'.holonix.packages; [ + holochain + hc + hc-scaffold + lair-keystore + bootstrap-srv + ]) ++ [ + rust + androidSdk + ] ++ (with pkgs; [ + cargo-ndk # build Rust -> Android jniLibs + nodejs_22 + pnpm + jdk17 # Gradle + pkg-config + binaryen # wasm-opt, for building hApp/zome wasm + shared-mime-info + gsettings-desktop-schemas + ]); + + # Libraries to compile/link against (exposed via pkg-config). + buildInputs = tauriDeps; + + shellHook = '' + export ANDROID_HOME="${androidHome}" + export ANDROID_SDK_ROOT="${androidHome}" + export ANDROID_NDK="${ndkHome}" + export ANDROID_NDK_ROOT="${ndkHome}" + export ANDROID_NDK_HOME="${ndkHome}" + export NDK_HOME="${ndkHome}" + + # cargo-ndk exports plain CC/CXX/AR pointing at the NDK clang, which + # also hijacks *host* compiles (build scripts, proc-macro deps). The + # HOST_* variants take precedence in the `cc` crate for host-targeted + # units, so host builds keep the host toolchain even under + # `cargo ndk`. + export HOST_CC=gcc + export HOST_CXX=g++ + export HOST_AR=ar + + # TLS for the nix webkit (glib-networking's GIO module). Additive on + # purpose: GIO_MODULE_DIR would override the module search path for + # every GLib app launched from this shell. + export GIO_EXTRA_MODULES=${pkgs.glib-networking}/lib/gio/modules + # webkitgtk >= 2.44 requires a working EGL display in its web process + # (DMA-BUF renderer + Skia) and aborts with EGL_BAD_PARAMETER without + # one. nixpkgs' libglvnd only searches /run/opengl-driver for EGL + # vendor drivers — a NixOS-only path — so on other distros the nix + # dev shell finds no GPU driver and the webview dies blank. Supply a + # vendor list: the host's native drivers first (host binaries run + # from this shell behave exactly as outside it), then nixpkgs Mesa, + # which nix-linked binaries fall back to (llvmpipe on NVIDIA; + # can drive AMD/Intel GPUs directly) after failing to dlopen the + # host's driver. NixOS hosts skip this and keep /run/opengl-driver. + if [ ! -e /run/opengl-driver ] && [ -z "$__EGL_VENDOR_LIBRARY_FILENAMES" ] && [ -z "$__EGL_VENDOR_LIBRARY_DIRS" ]; then + export __EGL_VENDOR_LIBRARY_DIRS=/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d:${pkgs.mesa}/share/glvnd/egl_vendor.d + fi + # GTK schema lookup for the nix webkit; GSETTINGS_SCHEMAS_PATH is + # filled by the glib setup hook from the schemas in `packages`. + export XDG_DATA_DIRS=$GSETTINGS_SCHEMAS_PATH:$XDG_DATA_DIRS + + # Visual cue that you are inside the dev shell. + export PS1='\[\033[1;35m\][vcs-dev:\w]\$\[\033[0m\] ' + ''; + }; }; - }; }; -} \ No newline at end of file +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fffed65..9c7fe71 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,12 @@ [toolchain] -channel = "1.81.0" +channel = "1.88.0" components = ["rustfmt", "clippy"] profile = "minimal" -targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"] \ No newline at end of file +targets = [ + "x86_64-unknown-linux-gnu", + "aarch64-linux-android", + "armv7-linux-androideabi", + "i686-linux-android", + "x86_64-linux-android", + "wasm32-unknown-unknown", +]