diff --git a/flake.nix b/flake.nix --- a/flake.nix +++ b/flake.nix @@ -8,15 +8,16 @@ outputs = { self, nixpkgs, utils, ... }: let - # Overlays allow for extending a package set, in this case, we are extending nixpkgs - # with our devShell + # Overlays allow for extending a package set, in this case, we are + # extending nixpkgs with our devShell localOverlay = import ./nix/overlay.nix; overlays = [ localOverlay ]; - # Since we build for many systems (e.g. m1 mac, x86_64-linux), we create - # a helper function to help facilitate instantiation of the related package set + # Since we build for many systems (e.g. aarch64, x86_64-linux), we + # create a helper function to help facilitate instantiation of the related + # package set pkgsForSystem = system: import nixpkgs { inherit overlays system; }; @@ -24,12 +25,15 @@ # utils.lib.eachSystem helps create a result set of expected flake outputs # of the form . # https://github.com/numtide/flake-utils#usage for more examples - in utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ] (system: rec { + in utils.lib.eachSystem [ + "x86_64-linux" "x86_64-darwin" "aarch64-darwin" + ] (system: rec { legacyPackages = pkgsForSystem system; inherit (legacyPackages) devShell; }) // { - # these outputs will lack the system suffix (e.g. devShell.aarch64-darwin), thus should - # be system agnostic such as overlays or utility functions. + # these outputs will lack the system suffix (e.g. + # devShell.aarch64-darwin), thus should be system agnostic such as + # overlays or utility functions. overlays = { inherit localOverlay; }; overlay = localOverlay; }; diff --git a/keyserver/bash/source-nvm.sh b/keyserver/bash/source-nvm.sh --- a/keyserver/bash/source-nvm.sh +++ b/keyserver/bash/source-nvm.sh @@ -4,7 +4,10 @@ # source from: package.json (via npm/yarn scripts) unset PREFIX -[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # Intel Mac -[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" # M1 Mac -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # Ubuntu +# Intel Mac +[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" +# ARM-based Mac +[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" +# Ubuntu +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" nvm install --no-progress diff --git a/keyserver/docker-compose.yml b/keyserver/docker-compose.yml --- a/keyserver/docker-compose.yml +++ b/keyserver/docker-compose.yml @@ -28,8 +28,9 @@ restart: always expose: - "3306" - # There is no M1 build on Docker Hub, so we force x64 - # This is what we want in production anyways. M1 devs will have it emulated + # There is no ARM-based Mac build on Docker Hub, so we force x64 + # This is what we want in production anyways. ARM-based Mac devs will have + # it emulated platform: linux/amd64 command: > --max-allowed-packet=64M diff --git a/native/ios/Podfile b/native/ios/Podfile --- a/native/ios/Podfile +++ b/native/ios/Podfile @@ -1,29 +1,44 @@ -require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") -require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") -require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules") +require File.join( + File.dirname(`node --print "require.resolve('expo/package.json')"`), + "scripts/autolinking") +require File.join( + File.dirname(`node --print "require.resolve('react-native/package.json')"`), + "scripts/react_native_pods") +require File.join( + File.dirname(`node --print "require.resolve('@react-native-community/ + cli-platform-ios/package.json')"`), "native_modules") platform :ios, '12.0' require 'json' def common_comm_target_pods - pod 'SQLCipher-Amalgamation', :path => '../../node_modules/@commapp/sqlcipher-amalgamation' - pod 'gRPC-C++', :podspec => './pod-patch/.patched/gRPC-C++/1.40.0/gRPC-C++.podspec.json' - pod 'gRPC-C++/Protobuf', :podspec => './pod-patch/.patched/gRPC-C++/1.40.0/gRPC-C++.podspec.json' - pod 'gRPC-Core', :podspec => './pod-patch/.patched/gRPC-Core/1.40.0/gRPC-Core.podspec.json' + pod 'SQLCipher-Amalgamation', :path => + '../../node_modules/@commapp/sqlcipher-amalgamation' + pod 'gRPC-C++', :podspec => + './pod-patch/.patched/gRPC-C++/1.40.0/gRPC-C++.podspec.json' + pod 'gRPC-C++/Protobuf', :podspec => + './pod-patch/.patched/gRPC-C++/1.40.0/gRPC-C++.podspec.json' + pod 'gRPC-Core', :podspec => + './pod-patch/.patched/gRPC-Core/1.40.0/gRPC-Core.podspec.json' pod 'Protobuf-C++', '3.15.8' end target 'Comm' do - pod 'ReactNativeKeyboardTrackingView', :path => '../../node_modules/react-native-keyboard-tracking-view' - pod 'ReactNativeKeyboardInput', :path => '../../node_modules/react-native-keyboard-input' - pod 'react-native-video/VideoCaching', :podspec => '../../node_modules/react-native-video/react-native-video.podspec' - pod 'react-native-ffmpeg/min-lts', :podspec => '../../node_modules/react-native-ffmpeg/react-native-ffmpeg.podspec' + pod 'ReactNativeKeyboardTrackingView', :path => + '../../node_modules/react-native-keyboard-tracking-view' + pod 'ReactNativeKeyboardInput', :path => + '../../node_modules/react-native-keyboard-input' + pod 'react-native-video/VideoCaching', :podspec => + '../../node_modules/react-native-video/react-native-video.podspec' + pod 'react-native-ffmpeg/min-lts', :podspec => + '../../node_modules/react-native-ffmpeg/react-native-ffmpeg.podspec' common_comm_target_pods use_expo_modules! config = use_native_modules! - podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {} + podfile_properties = + JSON.parse(File.read('./Podfile.properties.json')) rescue {} use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods @@ -40,12 +55,16 @@ target 'NotificationService' do common_comm_target_pods pod 'OLMKit', :path => "../../node_modules/olm" - pod 'RCT-Folly', :podspec => "../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" + pod 'RCT-Folly', :podspec => + "../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" - # Lines below are only needed to compile and use Expo Secure Store in Notification Service. - # If Apple disapproves 'APPLICATION_EXTENSION_API_ONLY' flag then we can safely delete them and use - # customized Expo Secure Store that does not depend on ExpoModulesCore - podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {} + # Lines below are only needed to compile and use Expo Secure Store in + # Notification Service. + # If Apple disapproves 'APPLICATION_EXTENSION_API_ONLY' flag then we can + # safely delete them and use customized Expo Secure Store that does not depend + # on ExpoModulesCore + podfile_properties = + JSON.parse(File.read('./Podfile.properties.json')) rescue {} use_expo_modules! use_react_native!( :path => "../../node_modules/react-native", @@ -57,16 +76,19 @@ react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) - # Excluding arm64 because M1 simulator isn't supported yet + # Excluding arm64 because ARM-based Mac simulator isn't supported yet # Excluding 32-bit x86 because nobody uses it and it causes compilation issues installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386" - config.build_settings['OTHER_CPLUSPLUSFLAGS'] = '-DDONT_AUTOINSTALL_REANIMATED' + config.build_settings['OTHER_CPLUSPLUSFLAGS'] = + '-DDONT_AUTOINSTALL_REANIMATED' end - # Lines below are only needed to compile and use Expo Secure Store in Notification Service. - # If Apple disapproves 'APPLICATION_EXTENSION_API_ONLY' flag then we can safely delete them and use - # customized Expo Secure Store that does not depend on ExpoModulesCore + # Lines below are only needed to compile and use Expo Secure Store in + # Notification Service. + # If Apple disapproves 'APPLICATION_EXTENSION_API_ONLY' flag then we can + # safely delete them and use customized Expo Secure Store that does not depend + # on ExpoModulesCore installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'