Skip to content

Commit

Permalink
nix: hack fix for missing git and version script
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Jan 7, 2025
1 parent 706d9a8 commit 9cff936
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions nix/status-go/mobile/build.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ callPackage, lib, buildGoPackage
, androidPkgs, openjdk, gomobile, xcodeWrapper, removeReferencesTo
, go-bindata, mockgen, protobuf3_20, protoc-gen-go
, go-bindata, mockgen, protobuf3_20, protoc-gen-go, git
, meta
, source
, platform ? "android"
Expand Down Expand Up @@ -29,7 +29,7 @@ in buildGoPackage rec {

extraSrcPaths = [ gomobile ];
nativeBuildInputs = [
gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20
gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 git
] ++ optional isAndroid openjdk
++ optional isIOS xcodeWrapper;

Expand All @@ -50,12 +50,27 @@ in buildGoPackage rec {
SENTRY_CONTEXT_NAME = "status-mobile";
SENTRY_CONTEXT_VERSION = version;

preBuild = ''
echo 'Generate static files'
pushd go/src/$goPackagePath
make generate SHELL=$SHELL GO111MODULE=on GO_GENERATE_CMD='go generate'
popd
'';
preBuild = ''
# To fix fatal: not a git repository (or any of the parent directories): .git
git init --quiet --initial-branch=main .
git config user.email "nix@builder"
git config user.name "Nix Builder"
git commit --quiet --allow-empty -m "Initial commit"
git tag -a "v${source.cleanVersion}" -m "Version ${source.cleanVersion}"
# To fix sh: line 1: ../../_assets/scripts/version.sh: cannot execute: required file not found
mkdir -p go/src/github.com/status-im/status-go/_assets/scripts
cat > go/src/github.com/status-im/status-go/_assets/scripts/version.sh <<EOF
#!/usr/bin/env bash
echo "${source.version}"
EOF
chmod +x go/src/github.com/status-im/status-go/_assets/scripts/version.sh
echo 'Generate static files'
pushd go/src/$goPackagePath
make generate SHELL=$SHELL GO111MODULE=on GO_GENERATE_CMD='go generate'
popd
'';

buildPhase = ''
runHook preBuild
Expand Down

0 comments on commit 9cff936

Please sign in to comment.