Changes: - Fixed `nix/status-go/desktop` builds - Dropped nimbus wrapper for `status-go` for now - Split `status-go` builds into subfolders: `mobile`, `desktop` - Fixed shells for desktop builds: `linux`,`macos`,`windows` - Added `make status-go-*` targets for building them - Moved source management to `nix/status-go/source.nix` - Moved `nix/status-go/build.nix` into `nix/status-go/mobile` - Moved `nix/desktop/cmake/qtkeychain` to `nix/pkgs/qtkeychain-src` - Moved `nix/desktop/linux/linuxdeployqt` to `nix/pkgs` - Moved `nix/desktop/linux/appimagekit` to `nix/pkgs` - Dropped `nix/tools/mkShell.nix` since it did almost nothing - Dropped `nix/desktop/cmake/snorenotify` since it's broken - Moved setup from `nix/tools/mkShell.nix` to `nix/shells.nix` - Simplified `nix/mobile/ios/status-go-shell.nix` - Simplified `nix/status-go/default.nix` - Updated the `nix/DETAILS.md` and `nix/README.md` - Moved known issues to `nix/KNOWN_ISSUES.md` - Improved output of `nix/scripts/build.sh` Signed-off-by: Jakub Sokołowski <jakub@status.im>
2.8 KiB
Description
This document descripts the layout of our Nix setup.
Folders
There are four main folders in the nix directory:
nix/scripts- Bash scripts for easier usage of Nixnix/pkgs- Packages we add to or modify innixpkgsnix/deps- Project dependencies managed by Nixnix/lib- Our tools we merge intopkgs.libnix/tools- Various tools used by our derivations and shellsnix/status-go- Derivations for buildingstatus-gorepo
Files
There are a few main files that define the whole build environment:
nix/nix.conf- Binary cache configurationnix/default.nix- Entrypoint for both shells and targetsnix/shells.nix- Definition of Nix shells used in buildsnix/targets.nix- Hierarchy of main build targetsnix/pkgs.nix- Definition of a customnixpkgsreponix/overlay.nix- Overrides fornixpkgs, custom packages
The default.nix and shell.nix files at th repo root are just a gateway into the nix subfolder.
Start
The starting point for using our Nix shells and targets is the default.nix file.
It pulls in all the pkgs, targets and shells defined in nix/default.nix. The point is easy access to them via commands like nix-build or nix-shell, which you'll see next.
Usage
We will use the make jsbundle-android target as an example of a derivation you can build using Nix:
make jsbundle-androidis called by developermakecallsnix/scripts/build.sh targets.mobile.android.jsbundlebuild.shcallsnix-build --attr targets.mobile.android.jsbundlewith extra argumentsnix-buildbuilds the derivation fromnix/mobile/android/jsbundle/default.nix
The same can be done for other targets like targets.mobile.android.release.
Except in that case extra arguments are required which is why the scripts/release-android.sh is used in the make release-android target.
If you run make release-android you'll see the nix-build command used:
nix-build \
--pure \
--fallback \
--no-out-link \
--show-trace \
--attr targets.mobile.android.release \
--argstr secrets-file '/tmp/tmp-status-react-559a3a441/tmp.xAnrPuNtAP' \
--option extra-sandbox-paths '/home/joe/.gradle/status-im.keystore /tmp/tmp-status-react-559a3a441/tmp.xAnrPuNtAP' \
--arg config '{ \
status-im.build-type="nightly";
status-im.build-number="2020022418";
status-im.android.keystore-path="/home/joe/.gradle/status-im.keystore";
status-im.android.abi-split="false";
status-im.android.abi-include="armeabi-v7a;arm64-v8a;x86";
}' \
default.nix
Some of those are required which is why just calling:
nix-build --attr targets.mobile.android.release
Would fail.