diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 313f0d533974..db0a023ae773 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,7 +1,7 @@ -library 'status-jenkins-lib@v1.3.3' +library 'status-jenkins-lib@fix/nix-profile' pipeline { - agent { label 'linux && x86_64 && nix-2.3' } + agent { label 'linux && x86_64 && nix-2.5' } options { timestamps() diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 76324e679e80..d691bddbf7b0 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.3.3' +library 'status-jenkins-lib@fix/nix-profile' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index fbc669c31125..55df8e1bf84c 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,7 +1,7 @@ -library 'status-jenkins-lib@v1.3.3' +library 'status-jenkins-lib@fix/nix-profile' pipeline { - agent { label 'macos && x86_64 && nix-2.3 && xcode-12.5' } + agent { label 'macos && x86_64 && nix-2.5 && xcode-12.5' } parameters { string( diff --git a/ci/Jenkinsfile.nix-cache b/ci/Jenkinsfile.nix-cache index 8f90de3241d9..c9ac2f114d27 100644 --- a/ci/Jenkinsfile.nix-cache +++ b/ci/Jenkinsfile.nix-cache @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.3.3' +library 'status-jenkins-lib@fix/nix-profile' pipeline { agent { label params.AGENT_LABEL } diff --git a/ci/tools/Jenkinsfile.fastlane-clean b/ci/tools/Jenkinsfile.fastlane-clean index 968a4c593328..f4714a174085 100644 --- a/ci/tools/Jenkinsfile.fastlane-clean +++ b/ci/tools/Jenkinsfile.fastlane-clean @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.3.3' +library 'status-jenkins-lib@fix/nix-profile' pipeline { agent { label 'macos' } diff --git a/ci/tools/Jenkinsfile.playstore-meta b/ci/tools/Jenkinsfile.playstore-meta index 13e8f11cc9cb..5b5519e160f4 100644 --- a/ci/tools/Jenkinsfile.playstore-meta +++ b/ci/tools/Jenkinsfile.playstore-meta @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.3.3' +library 'status-jenkins-lib@fix/nix-profile' pipeline { agent { label 'linux' } diff --git a/nix/scripts/setup.sh b/nix/scripts/setup.sh index cc747b36f196..5635ff3bc66e 100755 --- a/nix/scripts/setup.sh +++ b/nix/scripts/setup.sh @@ -3,49 +3,49 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) source "${GIT_ROOT}/scripts/colors.sh" -NIX_VERSION="2.3.12" +NIX_VERSION="2.5.1" NIX_INSTALL_URL="https://nixos.org/releases/nix/nix-${NIX_VERSION}/install" -NIX_INSTALL_SHA256="468a49a1cef293d59508bb3b62625dfcd99ec00334a14309f125cf8de513d5f1" +NIX_INSTALL_SHA256="e265dfd8e80223633a9726009b42c534ac3d5f2b6da5ad6432ca1f6ea88206d0" NIX_INSTALL_PATH="/tmp/nix-install-${NIX_VERSION}" function install_nix() { - # Don't break people's profiles - export NIX_INSTALLER_NO_MODIFY_PROFILE=1 - # Fix for installing on MacOS Catalina - export NIX_IGNORE_SYMLINK_STORE=1 - # Download installer and verify SHA256 - curl -s "${NIX_INSTALL_URL}" -o "${NIX_INSTALL_PATH}" - echo "${NIX_INSTALL_SHA256} ${NIX_INSTALL_PATH}" | sha256sum -c - chmod +x "${NIX_INSTALL_PATH}" - # Run the installer - "${NIX_INSTALL_PATH}" --no-daemon - if [ $? -eq 0 ]; then - echo -e "${GRN}The Nix package manager was successfully installed.${RST}" - else - echo -e "${RED}Failed to install Nix package manager!${RST}" >&2 - echo "Please see: https://nixos.org/nix/manual/#chap-installation" >&2 - exit 1 - fi + # Don't break people's profiles + export NIX_INSTALLER_NO_MODIFY_PROFILE=1 + # Fix for installing on MacOS Catalina + export NIX_IGNORE_SYMLINK_STORE=1 + # Download installer and verify SHA256 + curl -s "${NIX_INSTALL_URL}" -o "${NIX_INSTALL_PATH}" + echo "${NIX_INSTALL_SHA256} ${NIX_INSTALL_PATH}" | sha256sum -c + chmod +x "${NIX_INSTALL_PATH}" + # Run the installer + "${NIX_INSTALL_PATH}" --no-daemon + if [ $? -eq 0 ]; then + echo -e "${GRN}The Nix package manager was successfully installed.${RST}" + else + echo -e "${RED}Failed to install Nix package manager!${RST}" >&2 + echo "Please see: https://nixos.org/nix/manual/#chap-installation" >&2 + exit 1 + fi } if [[ ! -x "$(command -v curl)" ]]; then - echo -e "${RED}The 'curl' utility is required for Nix installation.${RST}" >&2 - exit 1 + echo -e "${RED}The 'curl' utility is required for Nix installation.${RST}" >&2 + exit 1 fi if [[ "$(source /etc/os-release 2>/dev/null && echo "${NAME}")" == *NixOS* ]]; then - echo -e "${GRN}Already running NixOS.${RST}" - exit + echo -e "${GRN}Already running NixOS.${RST}" + exit fi if [[ -x "$(command -v nix)" ]]; then - echo -e "${GRN}Nix package manager already installed.${RST}" - exit + echo -e "${GRN}Nix package manager already installed.${RST}" + exit fi if [[ "${IN_NIX_SHELL}" == 'pure' ]]; then - echo -e "${GRN}Already in a pure Nix shell.${RST}" - exit + echo -e "${GRN}Already in a pure Nix shell.${RST}" + exit fi # If none of the checks before succeeded we need to install Nix diff --git a/nix/scripts/source.sh b/nix/scripts/source.sh index dc53b4afa723..0c798754d96d 100755 --- a/nix/scripts/source.sh +++ b/nix/scripts/source.sh @@ -4,30 +4,57 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) -# Location of profile script for Nix that adjusts PATH -export NIX_PROFILE_SH="${HOME}/.nix-profile/etc/profile.d/nix.sh" - -function source_nix() { - # Just stop if Nix is already available - if [[ -x $(command -v nix) ]]; then - return - elif [[ -f "${NIX_PROFILE_SH}" ]]; then - # Load Nix profile if it exists - source "${NIX_PROFILE_SH}" - return - else - # Setup Nix if not available +function file_group() { + UNAME=$(uname -s) + if [[ "${UNAME}" == "Linux" ]]; then + stat -Lc "%G" /nix + elif [[ "${UNAME}" == "Darwin" ]]; then + stat -Lf "%Sg" /nix + fi +} + +function nix_install_type() { + # single-user - User of Nix + # multi-user - nixbld + # NixOS - root + NIX_DIR_GROUP=$(file_group /nix) + if [[ "${NIX_DIR_GROUP}" == "nixbld" ]]; then + echo "multi" + elif [[ "${NIX_DIR_GROUP}" == "${USER}" ]]; then + echo "single" + elif [[ "${NIX_DIR_GROUP}" == "${USER}" ]]; then + echo "nixos" + else + echo "Unknown Nix installtion type!" >&2 + exit 1 + fi +} + +function source_nix_profile() { + NIX_INSTALL_TYPE=$(nix_install_type) + if [[ "${NIX_INSTALL_TYPE}" == "multi" ]]; then + source "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" + elif [[ "${NIX_INSTALL_TYPE}" == "single" ]]; then + source "${HOME}/.nix-profile/etc/profile.d/nix.sh" + elif [[ "${NIX_INSTALL_TYPE}" == "nixops" ]]; then + echo "Sourcing profile not necessary on NixOS!" >&2 + fi +} + +# Just stop if Nix is already available +if [[ -x $(command -v nix) ]]; then + exit 0 +fi + +if [[ ! -d /nix ]]; then # Setup Nix if not available ${GIT_ROOT}/nix/scripts/setup.sh - fi +fi - # Load Nix profile - source "${NIX_PROFILE_SH}" +# Load Nix profile +source_nix_profile - # Verify Nix is available - if [[ ! -x $(command -v nix) ]]; then +# Verify Nix is available +if [[ ! -x $(command -v nix) ]]; then echo "Nix not available, sourcing profile failed!" > /dev/stderr exit 1 - fi -} - -source_nix +fi diff --git a/package.json b/package.json index 05a99ccb44e2..bb6a308e5ebb 100644 --- a/package.json +++ b/package.json @@ -5,22 +5,22 @@ "scripts": { "start": "react-native start", "ios": "react-native run-ios", + "app:android": "react-native run-android", "app:compile:android": "shadow-cljs compile android", - "app:watch": "shadow-cljs watch android", "app:packager": "react-native start --host 0.0.0.0 --port 8081", - "app:android": "react-native run-android" + "app:watch": "shadow-cljs watch android" }, "dependencies": { "@react-native-community/async-storage": "^1.11.0", - "@react-native-community/audio-toolkit": "git+https://github.com/tbenr/react-native-audio-toolkit.git#v2.0.3-status-v6", - "@react-native-community/cameraroll": "git+https://github.com/status-im/react-native-cameraroll.git#v4.0.4-status.0", + "@react-native-community/audio-toolkit": "git+https://github.com/tbenr/react-native-audio-toolkit.git#refs/tags/v2.0.3-status-v6", + "@react-native-community/cameraroll": "git+https://github.com/status-im/react-native-cameraroll.git#refs/tags/v4.0.4-status.0", "@react-native-community/clipboard": "^1.2.2", "@react-native-community/hooks": "^2.5.1", "@react-native-community/masked-view": "^0.1.6", "@react-native-community/netinfo": "^4.4.0", "@react-native-community/push-notification-ios": "^1.4.1", "@react-native-community/slider": "^3.0.0", - "bignumber.js": "git+https://github.com/status-im/bignumber.js.git#v4.0.2-status", + "bignumber.js": "git+https://github.com/status-im/bignumber.js.git#refs/tags/v4.0.2-status", "buffer": "^5.4.2", "chance": "^1.1.0", "create-react-class": "^15.6.2", @@ -35,7 +35,7 @@ "react-native": "0.63.4", "react-native-background-timer": "^2.1.1", "react-native-camera-kit": "^8.0.4", - "react-native-config": "git+https://github.com/status-im/react-native-config.git#v1.4.2-status", + "react-native-config": "git+https://github.com/status-im/react-native-config.git#refs/tags/v1.4.2-status", "react-native-dark-mode": "^0.2.2", "react-native-device-info": "^7.4.0", "react-native-dialogs": "^1.0.4", @@ -45,10 +45,10 @@ "react-native-fs": "^2.14.1", "react-native-gesture-handler": "^1.8.0", "react-native-haptic-feedback": "^1.9.0", - "react-native-image-crop-picker": "git+https://github.com/status-im/react-native-image-crop-picker.git#v0.36.2-status.0", + "react-native-image-crop-picker": "git+https://github.com/status-im/react-native-image-crop-picker.git#refs/tags/v0.36.2-status.0", "react-native-image-resizer": "^1.2.3", - "react-native-image-viewing": "git+https://github.com/Ferossgp/react-native-image-viewing.git#v0.2.1", - "react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-5-status", + "react-native-image-viewing": "git+https://github.com/Ferossgp/react-native-image-viewing.git#refs/tags/v0.2.1", + "react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#refs/tags/v.3.0.0-5-status", "react-native-languages": "^3.0.2", "react-native-linear-gradient": "^2.5.6", "react-native-mail": "^6.1.1", @@ -60,11 +60,11 @@ "react-native-shake": "^3.3.1", "react-native-share": "^7.0.1", "react-native-splash-screen": "^3.2.0", - "react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.37", + "react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.5.37", "react-native-svg": "^9.8.4", "react-native-touch-id": "^4.4.1", - "react-native-webview": "git+https://github.com/status-im/react-native-webview.git#v11.3.0-status", - "rn-emoji-keyboard": "git+https://github.com/status-im/rn-emoji-keyboard.git#v0.4.2", + "react-native-webview": "git+https://github.com/status-im/react-native-webview.git#refs/tags/v11.3.0-status", + "rn-emoji-keyboard": "git+https://github.com/status-im/rn-emoji-keyboard.git#refs/tags/v0.4.2", "tdigest": "^0.1.1", "web3-utils": "^1.2.1" }, @@ -79,7 +79,7 @@ "jest": "^25.1.0", "nyc": "^14.1.1", "process": "0.11.10", - "rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#v2.0.2-status", + "rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#refs/tags/v2.0.2-status", "shadow-cljs": "^2.10.14" } } diff --git a/yarn.lock b/yarn.lock index cd5cd85f0d37..7fb3d3ac0e5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1238,7 +1238,7 @@ dependencies: deep-assign "^3.0.0" -"@react-native-community/audio-toolkit@git+https://github.com/tbenr/react-native-audio-toolkit.git#v2.0.3-status-v6": +"@react-native-community/audio-toolkit@git+https://github.com/tbenr/react-native-audio-toolkit.git#refs/tags/v2.0.3-status-v6": version "2.0.3" resolved "git+https://github.com/tbenr/react-native-audio-toolkit.git#7ae9055cf6169b30f5089bda7bfcfc1c40a715e5" dependencies: @@ -1246,7 +1246,7 @@ eventemitter3 "^1.2.0" lodash "^4.17.15" -"@react-native-community/cameraroll@git+https://github.com/status-im/react-native-cameraroll.git#v4.0.4-status.0": +"@react-native-community/cameraroll@git+https://github.com/status-im/react-native-cameraroll.git#refs/tags/v4.0.4-status.0": version "4.0.4" resolved "git+https://github.com/status-im/react-native-cameraroll.git#337c5a515e9b0f0728882f73568075553415f523" @@ -2022,7 +2022,7 @@ big-integer@^1.6.44: resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e" integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w== -"bignumber.js@git+https://github.com/status-im/bignumber.js.git#v4.0.2-status": +"bignumber.js@git+https://github.com/status-im/bignumber.js.git#refs/tags/v4.0.2-status": version "4.0.2" resolved "git+https://github.com/status-im/bignumber.js.git#cc066a0a3d6bfe0c436c9957f4ea8344bf963c89" @@ -6593,7 +6593,7 @@ react-native-camera-kit@^8.0.4: dependencies: lodash "^4.14.2" -"react-native-config@git+https://github.com/status-im/react-native-config.git#v1.4.2-status": +"react-native-config@git+https://github.com/status-im/react-native-config.git#refs/tags/v1.4.2-status": version "1.4.2" resolved "git+https://github.com/status-im/react-native-config.git#c3e58d76fed923aaf88eadc5073099fab5ecb346" @@ -6656,7 +6656,7 @@ react-native-haptic-feedback@^1.9.0: resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-1.9.0.tgz#7d62c54536f04dd5d8f1c2bb8ee444009f2294b9" integrity sha512-tIRbq8k7HK9AoyvXrOHUEFmJd65ZAh1HP9mDyD/gDisG1ApY4Im9UKn0q0of9z7s8AJY3sZA9GMuSKdSBGdKKQ== -"react-native-image-crop-picker@git+https://github.com/status-im/react-native-image-crop-picker.git#v0.36.2-status.0": +"react-native-image-crop-picker@git+https://github.com/status-im/react-native-image-crop-picker.git#refs/tags/v0.36.2-status.0": version "0.36.2" resolved "git+https://github.com/status-im/react-native-image-crop-picker.git#d14a68dcb643328b91e783d3a83561e7d6e0bd25" @@ -6665,11 +6665,11 @@ react-native-image-resizer@^1.2.3: resolved "https://registry.yarnpkg.com/react-native-image-resizer/-/react-native-image-resizer-1.2.3.tgz#21cb2b158ff950e55a0fc01c2cb61375bd5a03ba" integrity sha512-RDPNJglRmWDZ/7hvu+CbpsKYl6AQmseL8cWX4UkLAHxQWNc5ZdYhP/9avC5xCfyiwkRw+Zmkmv78HO0kt0ewhQ== -"react-native-image-viewing@git+https://github.com/Ferossgp/react-native-image-viewing.git#v0.2.1": +"react-native-image-viewing@git+https://github.com/Ferossgp/react-native-image-viewing.git#refs/tags/v0.2.1": version "0.2.1" resolved "git+https://github.com/Ferossgp/react-native-image-viewing.git#8ef67cdce7b7c66065a939847e45db71347c678e" -"react-native-keychain@git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-5-status": +"react-native-keychain@git+https://github.com/status-im/react-native-keychain.git#refs/tags/v.3.0.0-5-status": version "3.0.0-rc.3" resolved "git+https://github.com/status-im/react-native-keychain.git#9b0d9b283116947cf125e12b6d1d17203604f0d9" @@ -6745,7 +6745,7 @@ react-native-splash-screen@^3.2.0: resolved "https://registry.yarnpkg.com/react-native-splash-screen/-/react-native-splash-screen-3.2.0.tgz#d47ec8557b1ba988ee3ea98d01463081b60fff45" integrity sha512-Ls9qiNZzW/OLFoI25wfjjAcrf2DZ975hn2vr6U9gyuxi2nooVbzQeFoQS5vQcbCt9QX5NY8ASEEAtlLdIa6KVg== -"react-native-status-keycard@git+https://github.com/status-im/react-native-status-keycard.git#v2.5.37": +"react-native-status-keycard@git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.5.37": version "2.5.37" resolved "git+https://github.com/status-im/react-native-status-keycard.git#af61b0213adbf4b5a6bae97c85496d95007d5acb" @@ -6762,7 +6762,7 @@ react-native-touch-id@^4.4.1: resolved "https://registry.yarnpkg.com/react-native-touch-id/-/react-native-touch-id-4.4.1.tgz#8b1bb2d04c30bac36bb9696d2d723e719c4a8b08" integrity sha512-1jTl8fC+0fxvqegy/XXTyo6vMvPhjzkoDdaqoYZx0OH8AT250NuXnNPyKktvigIcys3+2acciqOeaCall7lrvg== -"react-native-webview@git+https://github.com/status-im/react-native-webview.git#v11.3.0-status": +"react-native-webview@git+https://github.com/status-im/react-native-webview.git#refs/tags/v11.3.0-status": version "11.3.0" resolved "git+https://github.com/status-im/react-native-webview.git#aafe232857d5c278d7ab43826e8b79a523121073" dependencies: @@ -7104,11 +7104,11 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -"rn-emoji-keyboard@git+https://github.com/status-im/rn-emoji-keyboard.git#v0.4.2": +"rn-emoji-keyboard@git+https://github.com/status-im/rn-emoji-keyboard.git#refs/tags/v0.4.2": version "0.4.2" resolved "git+https://github.com/status-im/rn-emoji-keyboard.git#969814269cc51fae2c1fd0375e8509fa066cdc7f" -"rn-snoopy@git+https://github.com/status-im/rn-snoopy.git#v2.0.2-status": +"rn-snoopy@git+https://github.com/status-im/rn-snoopy.git#refs/tags/v2.0.2-status": version "2.0.2" resolved "git+https://github.com/status-im/rn-snoopy.git#f23dc13469c6c2a694649f658cdc1d1eaf8def64" dependencies: