nix: add fake git to status-go build derivation (#21989)

This commit adds a script that overrides `git` to echo version required by `status-go` derivation.

Also fixes error messages like this when building `status-go` :
```
fatal: not a git repository (or any of the parent directories): .git
```

These messages can be often misleading to some developers.
This commit is contained in:
Siddarth Kumar 2025-01-27 18:14:27 +05:30 committed by GitHub
parent 1e48442d67
commit c1230319e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
{ callPackage, lib, buildGoPackage { callPackage, lib, buildGoPackage, pkgs
, androidPkgs, openjdk, gomobile, xcodeWrapper, removeReferencesTo , androidPkgs, openjdk, gomobile, xcodeWrapper, removeReferencesTo
, go-bindata, mockgen, protobuf3_20, protoc-gen-go , go-bindata, mockgen, protobuf3_20, protoc-gen-go
, meta , meta
@ -15,6 +15,8 @@ let
isIOS = platform == "ios"; isIOS = platform == "ios";
isAndroid = platform == "android"; isAndroid = platform == "android";
enforceXCodeAvailable = callPackage ./enforceXCodeAvailable.nix { }; enforceXCodeAvailable = callPackage ./enforceXCodeAvailable.nix { };
# Fixes fatal: not a git repository (or any of the parent directories): .git
fakeGit = pkgs.writeScriptBin "git" "echo ${source.version}";
in buildGoPackage rec { in buildGoPackage rec {
pname = source.repo; pname = source.repo;
@ -29,7 +31,7 @@ in buildGoPackage rec {
extraSrcPaths = [ gomobile ]; extraSrcPaths = [ gomobile ];
nativeBuildInputs = [ nativeBuildInputs = [
gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 fakeGit
] ++ optional isAndroid openjdk ] ++ optional isAndroid openjdk
++ optional isIOS xcodeWrapper; ++ optional isIOS xcodeWrapper;