diff --git a/nix/lib/mkFilter_test.nix b/nix/lib/mkFilter_test.nix index 492f6a49e9..9651c48d44 100644 --- a/nix/lib/mkFilter_test.nix +++ b/nix/lib/mkFilter_test.nix @@ -51,10 +51,6 @@ let { path = "${absPath}/ios/subfile"; type = "file"; expected = false; } ]; - # make paths absolute - testsAbs = builtins.map ( - t: t // { path = "${absPath}/${t.path}"; } - ) tests; in builtins.map ( t: let rval = (filter t.path t.type); diff --git a/nix/mobile/android/default.nix b/nix/mobile/android/default.nix index ca8b8d4f50..d96ce3b9d2 100644 --- a/nix/mobile/android/default.nix +++ b/nix/mobile/android/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, deps, callPackage, mkShell +{ pkgs, deps, callPackage, mkShell , status-go, androidPkgs, androidShell }: let diff --git a/nix/mobile/android/release.nix b/nix/mobile/android/release.nix index b8b634cf5f..799e6f39dd 100644 --- a/nix/mobile/android/release.nix +++ b/nix/mobile/android/release.nix @@ -1,6 +1,5 @@ -{ stdenv, pkgs, deps, lib, config, callPackage, - watchmanFactory, androidPkgs, patchMavenSources, - jsbundle, status-go }: +{ stdenv, pkgs, deps, lib, watchmanFactory +, androidPkgs, patchMavenSources, jsbundle, status-go }: { # Value for BUILD_ENV checked by Clojure code at compile time @@ -15,9 +14,7 @@ assert (lib.stringLength watchmanSockPath) > 0 -> stdenv.isDarwin; let - inherit (lib) - toLower optionalString stringLength assertMsg - getConfig makeLibraryPath checkEnvVarSet elem; + inherit (lib) toLower optionalString stringLength getConfig makeLibraryPath elem; # Pass secretsFile for INFURA_TOKEN to jsbundle build builtJsBundle = jsbundle { inherit secretsFile; }; @@ -29,9 +26,6 @@ let # Used to detect end-to-end builds androidAbiInclude = getConfig "android.abi-include" "armeabi-v7a;arm64-v8a;x86"; - baseName = "${buildType}-android"; - name = "status-react-build-${baseName}"; - envFileName = if androidAbiInclude == "x86" then ".env.e2e" else if (elem buildType ["release" "nightly"]) then ".env.${buildType}" @@ -44,8 +38,10 @@ let apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}"; patchedWatchman = watchmanFactory watchmanSockPath; + baseName = "${buildType}-android"; in stdenv.mkDerivation rec { - inherit name; + name = "status-react-build-${baseName}"; + src = let path = ./../../..; # We use builtins.path so that we can name the resulting derivation in builtins.path { diff --git a/nix/mobile/default.nix b/nix/mobile/default.nix index 1d29692a45..470a3378a8 100644 --- a/nix/mobile/default.nix +++ b/nix/mobile/default.nix @@ -1,8 +1,6 @@ -{ config, lib, stdenvNoCC, callPackage, mkShell, status-go }: +{ lib, callPackage, mkShell, status-go }: let - inherit (lib) catAttrs concatStrings optional unique; - fastlane = callPackage ./fastlane { }; android = callPackage ./android { @@ -24,7 +22,7 @@ let in { shell = mkShell { - inputsFrom = (catAttrs "shell" selectedSources); + inputsFrom = lib.catAttrs "shell" selectedSources; }; # TARGETS diff --git a/nix/mobile/ios/status-go-shell.nix b/nix/mobile/ios/status-go-shell.nix index 177fa3b71b..03d4eb09db 100644 --- a/nix/mobile/ios/status-go-shell.nix +++ b/nix/mobile/ios/status-go-shell.nix @@ -3,7 +3,7 @@ # It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'. # -{ lib, mkShell, status-go }: +{ mkShell, status-go }: mkShell { shellHook = '' diff --git a/nix/pkgs/aapt2/default.nix b/nix/pkgs/aapt2/default.nix index 454dc3a302..c74fb6211f 100644 --- a/nix/pkgs/aapt2/default.nix +++ b/nix/pkgs/aapt2/default.nix @@ -2,11 +2,10 @@ # It is used by Gradle to package Android app resources. # See: https://developer.android.com/studio/command-line/aapt2 -{ lib, stdenv, deps, pkgs, fetchurl }: +{ lib, stdenv, pkgs, fetchurl }: let inherit (lib) getAttr optionals; - inherit (pkgs) zip unzip patchelf; inherit (stdenv) isLinux isDarwin; pname = "aapt2"; @@ -53,7 +52,7 @@ in stdenv.mkDerivation { srcs = with urls; [ jar sha pom ]; phases = [ "unpackPhase" ] ++ optionals isLinux [ "patchPhase" ]; # OSX binaries don't need patchelf - buildInputs = [ zip unzip patchelf ]; + buildInputs = with pkgs; [ zip unzip patchelf ]; unpackPhase = '' mkdir -p $out @@ -71,15 +70,15 @@ in stdenv.mkDerivation { # Patch executables from maven dependency to use Nix's interpreter tmpDir=$(mktemp -d) - ${unzip}/bin/unzip $out/${filenames.jar} -d $tmpDir + unzip $out/${filenames.jar} -d $tmpDir for exe in `find $tmpDir/ -type f -executable`; do - ${patchelf}/bin/patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $exe + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $exe done # Rebuild the .jar file with patched binaries pushd $tmpDir > /dev/null chmod u+w $out/${filenames.jar} - ${zip}/bin/zip -fr $out/${filenames.jar} + zip -fr $out/${filenames.jar} chmod $out/${filenames.jar} --reference=$out/${filenames.jar}.sha1 popd > /dev/null rm -rf $tmpDir diff --git a/nix/pkgs/android-sdk/compose.nix b/nix/pkgs/android-sdk/compose.nix index b05849dcca..3f35d67129 100644 --- a/nix/pkgs/android-sdk/compose.nix +++ b/nix/pkgs/android-sdk/compose.nix @@ -3,7 +3,7 @@ # for the Android development environment. # -{ stdenv, config, callPackage, androidenv, openjdk, mkShell }: +{ androidenv }: # The "android-sdk-license" license is accepted # by setting android_sdk.accept_license = true. diff --git a/nix/pkgs/android-sdk/default.nix b/nix/pkgs/android-sdk/default.nix index 7c7233d658..f3f795251d 100644 --- a/nix/pkgs/android-sdk/default.nix +++ b/nix/pkgs/android-sdk/default.nix @@ -3,7 +3,7 @@ # for the Android development environment. # -{ callPackage, stdenv, writeScript }: +{ callPackage }: let compose = callPackage ./compose.nix { }; diff --git a/nix/pkgs/go-maven-resolver/default.nix b/nix/pkgs/go-maven-resolver/default.nix index b897f48825..3081157585 100644 --- a/nix/pkgs/go-maven-resolver/default.nix +++ b/nix/pkgs/go-maven-resolver/default.nix @@ -1,8 +1,6 @@ -{ lib, buildGoModule, fetchFromGitHub }: +{ buildGoModule, fetchFromGitHub }: -let - inherit (lib) strings; -in buildGoModule rec { +buildGoModule rec { pname = "go-maven-resolver"; version = "v1.1.2"; diff --git a/nix/shells.nix b/nix/shells.nix index 3e0c2f2636..ad91eb76e1 100644 --- a/nix/shells.nix +++ b/nix/shells.nix @@ -71,7 +71,7 @@ let }; # for merging the default shell with others - mergeDefaultShell = (key: val: lib.mergeSh default [ val ]); + mergeDefaultShell = (_: val: lib.mergeSh default [ val ]); # values here can be selected using `nix-shell --attr shells.$TARGET default.nix` # the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set diff --git a/nix/status-go/default.nix b/nix/status-go/default.nix index beb970b33e..f56a32e93d 100644 --- a/nix/status-go/default.nix +++ b/nix/status-go/default.nix @@ -1,4 +1,4 @@ -{ lib, callPackage, mkShell, openjdk, androidPkgs }: +{ lib, callPackage, mkShell }: let inherit (lib) attrValues mapAttrs; @@ -40,7 +40,6 @@ in rec { inherit meta source; }; - shell = mkShell { inputsFrom = [ mobile.android mobile.ios ]; }; diff --git a/nix/status-go/library/default.nix b/nix/status-go/library/default.nix index e862774e77..049a5ea9c4 100644 --- a/nix/status-go/library/default.nix +++ b/nix/status-go/library/default.nix @@ -1,13 +1,8 @@ -{ lib, stdenv, utils, buildGoPackage -, go, xcodeWrapper +{ buildGoPackage # object with source attributes , meta, source}: -let - inherit (stdenv) isDarwin; - inherit (lib) optional; - -in buildGoPackage { +buildGoPackage { pname = source.repo; version = "${source.cleanVersion}-${source.shortRev}"; @@ -25,9 +20,7 @@ in buildGoPackage { # Build the Go library buildPhase = '' runHook preBuild - - go build -buildmode=c-archive -o $out/libstatus.a $NIX_BUILD_TOP/main.go - + go build -buildmode=c-archive -o $out/libstatus.a $NIX_BUILD_TOP/main.go runHook postBuild ''; } diff --git a/nix/status-go/mobile/build.nix b/nix/status-go/mobile/build.nix index 1a0f7e3b1c..d76bb81926 100644 --- a/nix/status-go/mobile/build.nix +++ b/nix/status-go/mobile/build.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, utils, callPackage, buildGoPackage +{ lib, stdenv, utils, buildGoPackage , go, androidPkgs, openjdk, gomobile, xcodeWrapper # object with source attributes , meta, source @@ -13,9 +13,7 @@ let inherit (stdenv) isDarwin; - inherit (lib) - concatStrings concatStringsSep concatMapStrings optionalString - getAttr attrValues makeBinPath optional; + inherit (lib) concatStringsSep concatMapStrings optionalString makeBinPath optional; removeReferences = [ go ]; removeExpr = refs: ''remove-references-to ${concatMapStrings (ref: " -t ${ref}") refs}''; diff --git a/nix/status-go/source.nix b/nix/status-go/source.nix index ca33f8a0e0..7a5e03a0e9 100644 --- a/nix/status-go/source.nix +++ b/nix/status-go/source.nix @@ -1,7 +1,7 @@ -{ config, utils, lib, callPackage, fetchFromGitHub }: +{ utils, lib, fetchFromGitHub }: let - inherit (lib) strings traceValFn attrByPath importJSON getConfig; + inherit (lib) strings traceValFn importJSON getConfig; srcOverride = getConfig "status-go.src-override" null; # Warning message about using local sources diff --git a/nix/tools/envParser.nix b/nix/tools/envParser.nix index e0bd3b8cd4..1dcc8c7659 100644 --- a/nix/tools/envParser.nix +++ b/nix/tools/envParser.nix @@ -1,12 +1,11 @@ # This Nix expression takes care of reading/parsing the correct .env configuration file and return it as an attr set -{ config, stdenv, lib }: +{ config, lib }: let inherit (builtins) listToAttrs head tail readFile; inherit (lib) attrByPath filter hasPrefix nameValuePair splitString; build-type = attrByPath ["status-im" "build-type"] "" config; - ci = (attrByPath ["status-im" "ci"] "" config) != ""; readLinesFromFile = file: diff --git a/nix/tools/gradlePropParser.nix b/nix/tools/gradlePropParser.nix index 483e2b2b94..891177e46f 100644 --- a/nix/tools/gradlePropParser.nix +++ b/nix/tools/gradlePropParser.nix @@ -11,7 +11,7 @@ let lines = splitString "\n" (readFile gradlePropsFile); isKeyValueLine = line: line != "" && !hasPrefix "#" line; - cleanup = lines: filter isKeyValueLine lines; + cleanup = filter isKeyValueLine; extractKeyValues = line: let flag = splitString "=" line; in nameValuePair (head flag) (last flag); diff --git a/nix/tools/utils.nix b/nix/tools/utils.nix index 3ccea1713e..53965cf2d6 100644 --- a/nix/tools/utils.nix +++ b/nix/tools/utils.nix @@ -53,9 +53,9 @@ let sanitizeVersion = version: if (builtins.match versionRegex version) != null # Geth forces a 'v' prefix for all versions - then lib.removePrefix "v" (dropSlashes version) + then lib.removePrefix "v" (dropSlashes version) # reduce metrics cardinality in Prometheus - else lib.traceValFn (v: "WARNING: Marking build version as 'develop'!") "develop"; + else lib.traceValFn (_: "WARNING: Marking build version as 'develop'!") "develop"; in { inherit sanitizeVersion