diff --git a/nix/overlay.nix b/nix/overlay.nix index 3d9bd1524ad..0e2801b45da 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -53,25 +53,14 @@ in { xcodeWrapper = callPackage ./pkgs/xcodeenv/compose-xcodewrapper.nix { } { versions = ["16.0" "16.1" "16.2"]; }; - go = super.go_1_21; + go = super.go_1_22; clang = super.clang_15; - buildGoPackage = super.buildGo121Package; - buildGoModule = super.buildGo121Module; - gomobile = (super.gomobile.overrideAttrs (old: { - patches = [ - (self.fetchurl { # https://github.com/golang/mobile/pull/84 - url = "https://github.com/golang/mobile/commit/f20e966e05b8f7e06bed500fa0da81cf6ebca307.patch"; - sha256 = "sha256-TZ/Yhe8gMRQUZFAs9G5/cf2b9QGtTHRSObBFD5Pbh7Y="; - }) - (self.fetchurl { # https://github.com/golang/go/issues/58426 - url = "https://github.com/golang/mobile/commit/406ed3a7b8e44dc32844953647b49696d8847d51.patch"; - sha256 = "sha256-dqbYukHkQEw8npOkKykOAzMC3ot/Y4DEuh7fE+ptlr8="; - }) - ]; - })).override { - # FIXME: No Android SDK packages for aarch64-darwin. - withAndroidPkgs = stdenv.system != "aarch64-darwin"; + buildGoPackage = super.buildGo122Package; + buildGoModule = super.buildGo122Module; + gomobile = callPackage ./pkgs/gomobile { + #FIXME: No Android SDK packages for aarch64-darwin. androidPkgs = self.androidEnvCustom.compose; + withAndroidPkgs = stdenv.system != "aarch64-darwin"; }; # Android environment diff --git a/nix/pkgs/gomobile/default.nix b/nix/pkgs/gomobile/default.nix new file mode 100644 index 00000000000..21c6f5fd081 --- /dev/null +++ b/nix/pkgs/gomobile/default.nix @@ -0,0 +1,85 @@ +{ + stdenv, + lib, + fetchgit, + fetchurl, + buildGo122Module, + zlib, + makeWrapper, + xcodeenv, + androidenv, + xcodeWrapperArgs ? { }, + xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs, + withAndroidPkgs ? stdenv.system != "aarch64-darwin", + androidPkgs ? ( + androidenv.composeAndroidPackages { + includeNDK = true; + } + ), +}: +buildGo122Module { + pname = "gomobile"; + version = "0-unstable-2024-12-13"; + + src = fetchgit { + name = "gomobile"; + url = "https://go.googlesource.com/mobile"; + rev = "a87c1cf6cf463f0d4476cfe0fcf67c2953d76e7c"; + hash = "sha256-7j4rdmCZMC8tn4vAsC9x/mMNkom/+Tl7uAY+5gkSvfY="; + }; + + vendorHash = "sha256-6ycxEDEE0/i6Lxo0gb8wq3U2U7Q49AJj+PdzSl57wwI="; + + CGO_ENABLED = "1"; + + subPackages = [ + "bind" + "cmd/gobind" + "cmd/gomobile" + ]; + + # Fails with: go: cannot find GOROOT directory + doCheck = false; + + nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodeWrapper ]; + + # Prevent a non-deterministic temporary directory from polluting the resulting object files + postPatch = '' + substituteInPlace cmd/gomobile/env.go --replace-quiet \ + 'tmpdir, err = ioutil.TempDir("", "gomobile-work-")' \ + 'tmpdir = filepath.Join(os.Getenv("NIX_BUILD_TOP"), "gomobile-work")' + substituteInPlace cmd/gomobile/init.go --replace-quiet \ + 'tmpdir, err = ioutil.TempDir(gomobilepath, "work-")' \ + 'tmpdir = filepath.Join(os.Getenv("NIX_BUILD_TOP"), "work")' + + # To fix unable to import bind: no Go package in golang.org/x/mobile/bind + substituteInPlace cmd/gomobile/init.go --replace \ + 'golang.org/x/mobile/cmd/gobind@latest' \ + 'golang.org/x/mobile/cmd/gobind' + ''; + + # Necessary for GOPATH when using gomobile. + postInstall = '' + mkdir -p $out/src/golang.org/x + ln -s $src $out/src/golang.org/x/mobile + ''; + + postFixup = '' + for prog in gomobile gobind; do + wrapProgram $out/bin/$prog \ + --suffix GOPATH : $out \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}" \ + ${lib.optionalString withAndroidPkgs '' + --prefix PATH : "${androidPkgs.androidsdk}/bin" \ + --set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk" + ''} + done + ''; + + meta = { + description = "Tool for building and running mobile apps written in Go"; + homepage = "https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile"; + license = with lib.licenses; [ bsd3 ]; + maintainers = with lib.maintainers; [ jakubgs ]; + }; +} diff --git a/status-go-version.json b/status-go-version.json index 244c1d7e56f..adc8885988d 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v9.2.0", - "commit-sha1": "41743c6ca0bb0a1ff4510bfa3575948d477e6284", - "src-sha256": "1awd04bsxkglbgd0nk5mdz2sm17pxkcj47hfslczsppww7yhmc9n" + "version": "bump-go-to-1-23", + "commit-sha1": "71a04fe168be2d4de9cf155f2768cf8082ddec85", + "src-sha256": "03i75sdw4866713nj68k2ficmj37p10q70vksc33kqzgm03rccjz" }