status-mobile/derivation.nix

43 lines
1.9 KiB
Nix
Raw Normal View History

{ system ? builtins.currentSystem
, config ? { android_sdk.accept_license = true; }, overlays ? []
, pkgs ? (import <nixpkgs> { inherit system config overlays; })
, target-os }:
let
platform = pkgs.callPackage ./nix/platform.nix { inherit target-os; };
# TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib)
2019-07-04 14:49:21 +00:00
stdenv = pkgs.stdenvNoCC;
gradle = pkgs.gradle_4_10;
baseGo = pkgs.go_1_11;
go = pkgs.callPackage ./nix/patched-go { inherit baseGo; };
2019-06-11 09:44:17 +00:00
buildGoPackage = pkgs.buildGoPackage.override { inherit go; };
statusDesktop = pkgs.callPackage ./nix/desktop { inherit target-os stdenv status-go pkgs nodejs; inherit (pkgs) darwin; go = baseGo; };
2019-07-04 14:49:21 +00:00
statusMobile = pkgs.callPackage ./nix/mobile { inherit target-os config stdenv pkgs nodejs status-go gradle; inherit (pkgs.xcodeenv) composeXcodeWrapper; };
2019-06-11 09:44:17 +00:00
status-go = pkgs.callPackage ./nix/status-go { inherit target-os go buildGoPackage; inherit (pkgs.xcodeenv) composeXcodeWrapper; inherit (statusMobile) xcodewrapperArgs; androidPkgs = statusMobile.androidComposition; };
2019-07-04 14:49:21 +00:00
nodejs = pkgs.nodejs-10_x;
yarn = pkgs.yarn.override { inherit nodejs; };
nodePkgBuildInputs = [
2019-07-04 14:49:21 +00:00
nodejs
pkgs.python27 # for e.g. gyp
2019-07-04 14:49:21 +00:00
yarn
];
selectedSources =
2019-07-04 14:49:21 +00:00
stdenv.lib.optional platform.targetDesktop statusDesktop ++
stdenv.lib.optional platform.targetMobile statusMobile;
2019-07-04 14:49:21 +00:00
in with stdenv; mkDerivation rec {
name = "status-react-build-env";
buildInputs = with pkgs; [
clojure
leiningen
maven
watchman
] ++ nodePkgBuildInputs
++ lib.optional isDarwin cocoapods
++ lib.optional (isDarwin && !platform.targetIOS) clang
++ lib.optional (!isDarwin) gcc8
++ lib.catAttrs "buildInputs" selectedSources;
shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
}