status-mobile/nix/shells.nix
Jakub Sokołowski 42fb40476c
nix: reafactoring of status-go builds
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>
2020-05-04 20:55:07 +02:00

86 lines
2.5 KiB
Nix

# This file defines custom shells as well as shortcuts
# for accessing more nested shells.
{
config ? {},
pkgs ? import ./pkgs.nix { inherit config; }
}:
let
inherit (pkgs) lib stdenv;
# everything else we define in nix/ dir
targets = pkgs.callPackage ./targets.nix { inherit config; };
# the default shell that is used when target is not specified
# it is also merged with all the other shells
default = pkgs.mkShell {
name = "status-react-shell"; # for identifying all shells
buildInputs = with pkgs; lib.unique ([
# core utilities that should always be present in a shell
bash curl wget file unzip flock
git gnumake jq ncurses gnugrep
# build specific utilities
clojure maven watchman
# other nice to have stuff
yarn nodejs python27
] # and some special cases
++ lib.optionals stdenv.isDarwin [ cocoapods clang ]
++ lib.optionals (!stdenv.isDarwin) [ gcc8 ]
);
# avoid terinal issues
TERM="xterm";
# default locale
LANG="en_US.UTF-8";
LANGUAGE="en_US.UTF-8";
# just a nicety for easy access to node scripts
shellHook = ''
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
export PATH="$STATUS_REACT_HOME/node_modules/.bin:$PATH"
'';
};
# An attrset for easier merging with default shell
shells = {
inherit default;
# for calling clojure targets in CI or Makefile
clojure = pkgs.mkShell {
buildInputs = with pkgs; [ clojure flock maven nodejs openjdk ];
};
# for 'make watchman-clean'
watchman = pkgs.mkShell {
buildInputs = [ pkgs.watchman ];
};
# for running fastlane commands alone
fastlane = targets.mobile.fastlane.shell;
# for 'scripts/generate-keystore.sh'
keytool = pkgs.mkShell {
buildInputs = [ pkgs.openjdk8 ];
};
# for targets that need 'adb' and other SDK/NDK tools
android-env = pkgs.androidShell;
# helpers for use with target argument
ios = targets.mobile.ios.shell;
android = targets.mobile.android.shell;
desktop = targets.desktop.shell;
linux = targets.desktop.linux.shell;
macos = targets.desktop.macos.shell;
windows = targets.desktop.macos.shell;
};
# for merging the default shell with others
mergeDefaultShell = (key: val: lib.mergeSh default [ val ]);
# values here can be selected using `nix-shell --attr shells.$TARGET default.nix`
# the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set
in lib.mapAttrs mergeDefaultShell shells