Skip to content

Commit

Permalink
Custom go compiler WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed May 20, 2024
1 parent f0764d1 commit 9b14114
Show file tree
Hide file tree
Showing 69 changed files with 11,093 additions and 797 deletions.
522 changes: 305 additions & 217 deletions Cargo.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tauri-build = { version = "2.0.0-beta", default-features = false , features = []
[dependencies]
tauri = { version = "2.0.0-beta", features = [] }
tauri-plugin-holochain = { git = "https://github.com/darksoil-studio/tauri-plugin-holochain", branch = "main" }
holochain_types = { version = "0.3.0-beta-dev" }
holochain_types = { version = "0.3.1-rc" }
lair_keystore = { version = "0.4.0" }
holochain_client = { version = "0.5.0-dev" }
log = "0.4"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tauri-build = { version = "2.0.0-beta", default-features = false , features = []
[dependencies]
tauri = { version = "2.0.0-beta", features = [] }
tauri-plugin-holochain = { git = "https://github.com/darksoil-studio/tauri-plugin-holochain", branch = "main" }
holochain_types = { version = "0.3.0-beta-dev" }
holochain_types = { version = "0.3.1-rc" }
lair_keystore = { version = "0.4.0" }
holochain_client = { version = "0.5.0-dev" }
log = "0.4"
Expand Down
76 changes: 76 additions & 0 deletions custom-go-compiler.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{ ... }:

{
perSystem = { inputs', lib, pkgs, self', ... }: rec {

packages.custom-go-wrapper = let
go = packages.custom-go-compiler;
# there is interference only in this specific case, we assemble a go derivationt that not propagate anything but still has everything available required for our specific use-case
#
# the wrapper inherits preconfigured environment variables from the
# derivation that depends on the propagating go
in if pkgs.stdenv.isDarwin && pkgs.system == "x86_64-darwin" then
pkgs.darwin.apple_sdk_11_0.stdenv.mkDerivation {
name = "go";

nativeBuildInputs = [ pkgs.makeBinaryWrapper go ];

dontBuild = true;
dontUnpack = true;

installPhase = ''
makeWrapper ${pkgs.go}/bin/go $out/bin/go \
${
builtins.concatStringsSep " "
(builtins.map (var: ''--set ${var} "''$${var}"'') [
"NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_apple_darwin"
"NIX_LDFLAGS"
"NIX_CFLAGS_COMPILE_FOR_BUILD"
"NIX_CFLAGS_COMPILE"
# confirmed needed above here
# unsure between here
# and here
# confirmed unneeded below here
# "NIX_CC"
# "NIX_CC_FOR_BUILD"
# "NIX_LDFLAGS_FOR_BUILD"
# "NIX_BINTOOLS"
# "NIX_CC_WRAPPER_TARGET_HOST_x86_64_apple_darwin"
# "NIX_CC_WRAPPER_TARGET_BUILD_x86_64_apple_darwin"
# "NIX_ENFORCE_NO_NATIVE"
# "NIX_DONT_SET_RPATH"
# "NIX_BINTOOLS_FOR_BUILD"
# "NIX_DONT_SET_RPATH_FOR_BUILD"
# "NIX_NO_SELF_RPATH"
# "NIX_IGNORE_LD_THROUGH_GCC"
# "NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_apple_darwin"
# "NIX_COREFOUNDATION_RPATH"
# "NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_apple_darwin"
])
}
'';
}
else
go;

packages.custom-go-compiler = let
go = lib.overrideDerivation pkgs.go_1_21 (attrs: rec {
name = "go-${version}-dev";
version = "1.21";
src = pkgs.fetchgit {
url = "https://github.com/wlynxg/go";
rev = "bff8d409ebfb8d4c8488325f13cb212b07cf6bb4";
sha256 = "5uMfEqGc2UzxAnJUj8mAd7ojdWF537Ey1DRHWTqjLDY=";
leaveDotGit = true;
};
buildInputs = with pkgs; [ pcre git ];
nativeBuildInputs = with pkgs; [ pcre git ];
});

in go;
};
}
8 changes: 7 additions & 1 deletion docs/documentation/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Holochain has experimental support for Android. This means that holochain works

### iOS

In development, holochain works as expected in iOS. But Apple prevents JIT compilation in iOS devices, so when a holochain app is published in the iOS store, it does not work. Thankfully there is already work in progress to address this issue. Stay tuned for updates!
In development, holochain works as expected in iOS. But Apple prevents JIT compilation in iOS devices, so when a holochain app is published in the iOS store, it does not work. Thankfully there is already [work in progress done by wasmer](https://github.com/wasmerio/wasmer/issues/4486) to address this issue. Stay tuned for updates!

---

## Well, okey... Then how does tauri-plugin-holochain help me now?

For now, you can build a desktop only executable hApp that your users can download and use. It's ready to be deployed and iterated upon. After the issues with holochain mobile outlined above are resolved, you will be able to upgrade to a new version of the plugin to automatically get mobile support in your hApp.

This is the way ourselves in darskoil studio are building hApps right now. We are monitoring the issues at the technical level, and in constant communication with the core holochain development team. At the same time, while they get resolved, we are building the MVP version for our hApps.
13 changes: 11 additions & 2 deletions docs/documentation/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,14 @@ sudo adb devices

Disable the firewall to get the tauri frontend with:

1. Identify firewall rule number: sudo iptables -L INPUT --line-numbers
2. Remove firewall rule: sudo iptables -D INPUT <RULE_NUM>
1. Identify firewall rule number:

```bash
sudo iptables -L INPUT --line-numbers
```

2. Remove firewall rule:

```bash
sudo iptables -D INPUT <RULE_NUM>
```
Loading

0 comments on commit 9b14114

Please sign in to comment.