From 295409d95247c5fb8bfe033bf20d9d2a13c1229e Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:09:19 +0800 Subject: [PATCH 1/2] gomobile: format --- pkgs/development/mobile/gomobile/default.nix | 55 +++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/pkgs/development/mobile/gomobile/default.nix b/pkgs/development/mobile/gomobile/default.nix index 61e3bb75617cc..a4fe24ba5f24a 100644 --- a/pkgs/development/mobile/gomobile/default.nix +++ b/pkgs/development/mobile/gomobile/default.nix @@ -1,11 +1,20 @@ -{ stdenv, lib, fetchgit, buildGoModule, zlib, makeWrapper, xcodeenv, androidenv -, xcodeWrapperArgs ? { } -, xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs -, withAndroidPkgs ? true -, androidPkgs ? androidenv.composeAndroidPackages { +{ + stdenv, + lib, + fetchgit, + buildGoModule, + zlib, + makeWrapper, + xcodeenv, + androidenv, + xcodeWrapperArgs ? { }, + xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs, + withAndroidPkgs ? true, + androidPkgs ? androidenv.composeAndroidPackages { includeNDK = true; ndkVersion = "22.1.7171670"; - } }: + }, +}: buildGoModule { pname = "gomobile"; @@ -20,13 +29,16 @@ buildGoModule { sha256 = "sha256-AOR/p+DW83f2+BOxm2rFXBCrotcIyunK3UzQ/dnauWY="; }; - subPackages = [ "bind" "cmd/gobind" "cmd/gomobile" ]; + subPackages = [ + "bind" + "cmd/gobind" + "cmd/gomobile" + ]; # Fails with: go: cannot find GOROOT directory doCheck = false; - nativeBuildInputs = [ makeWrapper ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodeWrapper ]; + nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodeWrapper ]; # Prevent a non-deterministic temporary directory from polluting the resulting object files postPatch = '' @@ -44,17 +56,20 @@ buildGoModule { ln -s $src $out/src/golang.org/x/mobile ''; - postFixup = '' - for bin in $(ls $out/bin); do - wrapProgram $out/bin/$bin \ - --suffix GOPATH : $out \ - '' + lib.optionalString withAndroidPkgs '' - --prefix PATH : "${androidPkgs.androidsdk}/bin" \ - --set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk" \ - '' + '' - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}" - done - ''; + postFixup = + '' + for bin in $(ls $out/bin); do + wrapProgram $out/bin/$bin \ + --suffix GOPATH : $out \ + '' + + lib.optionalString withAndroidPkgs '' + --prefix PATH : "${androidPkgs.androidsdk}/bin" \ + --set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk" \ + '' + + '' + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}" + done + ''; meta = with lib; { description = "Tool for building and running mobile apps written in Go"; From f5abef98e8b8c9f9e6da4bdab63f8be1e57ea8c0 Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:38:55 +0800 Subject: [PATCH 2/2] gomobile: 2022-05-18 -> 0-unstable-2024-12-13 --- pkgs/development/mobile/gomobile/default.nix | 51 +++++++++----------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/pkgs/development/mobile/gomobile/default.nix b/pkgs/development/mobile/gomobile/default.nix index a4fe24ba5f24a..4b00da7f414b9 100644 --- a/pkgs/development/mobile/gomobile/default.nix +++ b/pkgs/development/mobile/gomobile/default.nix @@ -10,25 +10,25 @@ xcodeWrapperArgs ? { }, xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs, withAndroidPkgs ? true, - androidPkgs ? androidenv.composeAndroidPackages { - includeNDK = true; - ndkVersion = "22.1.7171670"; - }, + androidPkgs ? ( + androidenv.composeAndroidPackages { + includeNDK = true; + } + ), }: - buildGoModule { pname = "gomobile"; - version = "unstable-2022-05-18"; - - vendorHash = "sha256-AmOy3X+d2OD7ZLbFuy+SptdlgWbZJaXYEgO79M64ufE="; + version = "0-unstable-2024-12-13"; src = fetchgit { - rev = "8578da9835fd365e78a6e63048c103b27a53a82c"; name = "gomobile"; url = "https://go.googlesource.com/mobile"; - sha256 = "sha256-AOR/p+DW83f2+BOxm2rFXBCrotcIyunK3UzQ/dnauWY="; + rev = "a87c1cf6cf463f0d4476cfe0fcf67c2953d76e7c"; + hash = "sha256-7j4rdmCZMC8tn4vAsC9x/mMNkom/+Tl7uAY+5gkSvfY="; }; + vendorHash = "sha256-6ycxEDEE0/i6Lxo0gb8wq3U2U7Q49AJj+PdzSl57wwI="; + subPackages = [ "bind" "cmd/gobind" @@ -56,25 +56,22 @@ buildGoModule { ln -s $src $out/src/golang.org/x/mobile ''; - postFixup = - '' - for bin in $(ls $out/bin); do - wrapProgram $out/bin/$bin \ - --suffix GOPATH : $out \ - '' - + lib.optionalString withAndroidPkgs '' - --prefix PATH : "${androidPkgs.androidsdk}/bin" \ - --set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk" \ - '' - + '' - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}" - done - ''; + 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 = with lib; { + meta = { description = "Tool for building and running mobile apps written in Go"; homepage = "https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile"; - license = licenses.bsd3; - maintainers = with maintainers; [ jakubgs ]; + license = with lib.licenses; [ bsd3 ]; + maintainers = with lib.maintainers; [ jakubgs ]; }; }