diff --git a/flake.nix b/flake.nix index 662e7d0fa..5db22fcab 100644 --- a/flake.nix +++ b/flake.nix @@ -1,36 +1,38 @@ { description = "Comm flake"; inputs = { utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; }; 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; }; # 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 { 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 index 7e01ed6b0..76a4c5247 100755 --- a/keyserver/bash/source-nvm.sh +++ b/keyserver/bash/source-nvm.sh @@ -1,10 +1,13 @@ #!/usr/bin/env bash # source as: logged in user # 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 index 9d3cd2706..90a274462 100644 --- a/keyserver/docker-compose.yml +++ b/keyserver/docker-compose.yml @@ -1,53 +1,54 @@ version: "3.9" services: node: build: dockerfile: keyserver/Dockerfile context: ../ args: - HOST_UID=${HOST_UID} - HOST_GID=${HOST_GID} image: commapp/node-keyserver:1.0 restart: always ports: - "3000:3000" env_file: - .env environment: - REDIS_URL=redis://cache - COMM_LISTEN_ADDR=0.0.0.0 - COMM_MYSQL_HOST=${COMM_MYSQL_HOST:-database} - COMM_MYSQL_DATABASE - COMM_MYSQL_USER - COMM_MYSQL_PASSWORD depends_on: - cache - database database: image: mysql:5.7.37-debian 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 --local-infile=0 --sql-mode=STRICT_ALL_TABLES --innodb-buffer-pool-size=1600M environment: - MYSQL_RANDOM_ROOT_PASSWORD=yes - MYSQL_DATABASE=$COMM_MYSQL_DATABASE - MYSQL_USER=$COMM_MYSQL_USER - MYSQL_PASSWORD=$COMM_MYSQL_PASSWORD volumes: - mysqldata:/var/lib/mysql cache: image: redis:6.2.6-bullseye restart: always expose: - "6379" command: redis-server --loglevel warning volumes: mysqldata: diff --git a/native/ios/Podfile b/native/ios/Podfile index 44efd05b7..38643a2d3 100644 --- a/native/ios/Podfile +++ b/native/ios/Podfile @@ -1,75 +1,79 @@ 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 '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' common_comm_target_pods use_expo_modules! config = use_native_modules! 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 :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes' ) # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. use_flipper!({ "Flipper-DoubleConversion" => "1.1.7" }) end 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" - # 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 podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {} use_expo_modules! use_react_native!( :path => "../../node_modules/react-native", :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes' ) end post_install do |installer| 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' 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' end end end