status-react/nix/mobile/ios/default.nix

59 lines
1.8 KiB
Nix

{ config, stdenv, stdenvNoCC, callPackage, mkShell, fastlane, cocoapods,
xcodeWrapper, mkFilter, fetchurl, flock, nodejs, bash, zlib, procps,
status-go, projectNodePackage }:
let
inherit (stdenv.lib) catAttrs concatStrings unique;
createMobileFilesSymlinks = root: ''
# Set up symlinks to mobile enviroment in project root
ln -sf ${root}/mobile/js_files/package.json ${root}/package.json
ln -sf ${root}/mobile/js_files/metro.config.js ${root}/metro.config.js
ln -sf ${root}/mobile/js_files/yarn.lock ${root}/yarn.lock
'';
src =
let path = ./../../..;
in builtins.path { # We use builtins.path so that we can name the resulting derivation, otherwise the name would be taken from the checkout directory, which is outside of our control
inherit path;
name = "status-react-source-npm-deps";
filter =
# Keep this filter as restrictive as possible in order to avoid unnecessary rebuilds and limit closure size
mkFilter {
dirRootsToInclude = [ "mobile/js_files" ];
dirsToExclude = [ ".git" ".svn" "CVS" ".hg" ];
filesToInclude = [ ".babelrc" ];
root = path;
};
};
selectedSources = [ fastlane status-go ];
buildInputs = unique ([
cocoapods
fastlane.drv
xcodeWrapper
flock # used in reset-node_modules.sh
procps
] ++ catAttrs "buildInputs" selectedSources);
shellHook = ''
${status-go.shellHook}
${fastlane.shellHook}
${createMobileFilesSymlinks "$STATUS_REACT_HOME"}
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh "${projectNodePackage}" && \
$STATUS_REACT_HOME/nix/mobile/ios/install-pods-and-status-go.sh || \
exit
'';
in {
inherit xcodeWrapper shellHook buildInputs;
# TARGETS
shell = mkShell {
inherit buildInputs shellHook;
};
}