nix: cleanup of unused variables
Mostly achieved by running via `nix-linter`. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
bcf3e3205a
commit
5d9a29b3c8
|
@ -51,10 +51,6 @@ let
|
||||||
{ path = "${absPath}/ios/subfile"; type = "file";
|
{ path = "${absPath}/ios/subfile"; type = "file";
|
||||||
expected = false; }
|
expected = false; }
|
||||||
];
|
];
|
||||||
# make paths absolute
|
|
||||||
testsAbs = builtins.map (
|
|
||||||
t: t // { path = "${absPath}/${t.path}"; }
|
|
||||||
) tests;
|
|
||||||
in builtins.map (
|
in builtins.map (
|
||||||
t: let
|
t: let
|
||||||
rval = (filter t.path t.type);
|
rval = (filter t.path t.type);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, pkgs, deps, callPackage, mkShell
|
{ pkgs, deps, callPackage, mkShell
|
||||||
, status-go, androidPkgs, androidShell }:
|
, status-go, androidPkgs, androidShell }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{ stdenv, pkgs, deps, lib, config, callPackage,
|
{ stdenv, pkgs, deps, lib, watchmanFactory
|
||||||
watchmanFactory, androidPkgs, patchMavenSources,
|
, androidPkgs, patchMavenSources, jsbundle, status-go }:
|
||||||
jsbundle, status-go }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# Value for BUILD_ENV checked by Clojure code at compile time
|
# Value for BUILD_ENV checked by Clojure code at compile time
|
||||||
|
@ -15,9 +14,7 @@
|
||||||
assert (lib.stringLength watchmanSockPath) > 0 -> stdenv.isDarwin;
|
assert (lib.stringLength watchmanSockPath) > 0 -> stdenv.isDarwin;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) toLower optionalString stringLength getConfig makeLibraryPath elem;
|
||||||
toLower optionalString stringLength assertMsg
|
|
||||||
getConfig makeLibraryPath checkEnvVarSet elem;
|
|
||||||
|
|
||||||
# Pass secretsFile for INFURA_TOKEN to jsbundle build
|
# Pass secretsFile for INFURA_TOKEN to jsbundle build
|
||||||
builtJsBundle = jsbundle { inherit secretsFile; };
|
builtJsBundle = jsbundle { inherit secretsFile; };
|
||||||
|
@ -29,9 +26,6 @@ let
|
||||||
# Used to detect end-to-end builds
|
# Used to detect end-to-end builds
|
||||||
androidAbiInclude = getConfig "android.abi-include" "armeabi-v7a;arm64-v8a;x86";
|
androidAbiInclude = getConfig "android.abi-include" "armeabi-v7a;arm64-v8a;x86";
|
||||||
|
|
||||||
baseName = "${buildType}-android";
|
|
||||||
name = "status-react-build-${baseName}";
|
|
||||||
|
|
||||||
envFileName =
|
envFileName =
|
||||||
if androidAbiInclude == "x86" then ".env.e2e"
|
if androidAbiInclude == "x86" then ".env.e2e"
|
||||||
else if (elem buildType ["release" "nightly"]) then ".env.${buildType}"
|
else if (elem buildType ["release" "nightly"]) then ".env.${buildType}"
|
||||||
|
@ -44,8 +38,10 @@ let
|
||||||
apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}";
|
apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}";
|
||||||
patchedWatchman = watchmanFactory watchmanSockPath;
|
patchedWatchman = watchmanFactory watchmanSockPath;
|
||||||
|
|
||||||
|
baseName = "${buildType}-android";
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
inherit name;
|
name = "status-react-build-${baseName}";
|
||||||
|
|
||||||
src = let path = ./../../..;
|
src = let path = ./../../..;
|
||||||
# We use builtins.path so that we can name the resulting derivation
|
# We use builtins.path so that we can name the resulting derivation
|
||||||
in builtins.path {
|
in builtins.path {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{ config, lib, stdenvNoCC, callPackage, mkShell, status-go }:
|
{ lib, callPackage, mkShell, status-go }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) catAttrs concatStrings optional unique;
|
|
||||||
|
|
||||||
fastlane = callPackage ./fastlane { };
|
fastlane = callPackage ./fastlane { };
|
||||||
|
|
||||||
android = callPackage ./android {
|
android = callPackage ./android {
|
||||||
|
@ -24,7 +22,7 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
shell = mkShell {
|
shell = mkShell {
|
||||||
inputsFrom = (catAttrs "shell" selectedSources);
|
inputsFrom = lib.catAttrs "shell" selectedSources;
|
||||||
};
|
};
|
||||||
|
|
||||||
# TARGETS
|
# TARGETS
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'.
|
# It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'.
|
||||||
#
|
#
|
||||||
|
|
||||||
{ lib, mkShell, status-go }:
|
{ mkShell, status-go }:
|
||||||
|
|
||||||
mkShell {
|
mkShell {
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
# It is used by Gradle to package Android app resources.
|
# It is used by Gradle to package Android app resources.
|
||||||
# See: https://developer.android.com/studio/command-line/aapt2
|
# See: https://developer.android.com/studio/command-line/aapt2
|
||||||
|
|
||||||
{ lib, stdenv, deps, pkgs, fetchurl }:
|
{ lib, stdenv, pkgs, fetchurl }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) getAttr optionals;
|
inherit (lib) getAttr optionals;
|
||||||
inherit (pkgs) zip unzip patchelf;
|
|
||||||
inherit (stdenv) isLinux isDarwin;
|
inherit (stdenv) isLinux isDarwin;
|
||||||
|
|
||||||
pname = "aapt2";
|
pname = "aapt2";
|
||||||
|
@ -53,7 +52,7 @@ in stdenv.mkDerivation {
|
||||||
srcs = with urls; [ jar sha pom ];
|
srcs = with urls; [ jar sha pom ];
|
||||||
phases = [ "unpackPhase" ]
|
phases = [ "unpackPhase" ]
|
||||||
++ optionals isLinux [ "patchPhase" ]; # OSX binaries don't need patchelf
|
++ optionals isLinux [ "patchPhase" ]; # OSX binaries don't need patchelf
|
||||||
buildInputs = [ zip unzip patchelf ];
|
buildInputs = with pkgs; [ zip unzip patchelf ];
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
@ -71,15 +70,15 @@ in stdenv.mkDerivation {
|
||||||
|
|
||||||
# Patch executables from maven dependency to use Nix's interpreter
|
# Patch executables from maven dependency to use Nix's interpreter
|
||||||
tmpDir=$(mktemp -d)
|
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
|
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
|
done
|
||||||
|
|
||||||
# Rebuild the .jar file with patched binaries
|
# Rebuild the .jar file with patched binaries
|
||||||
pushd $tmpDir > /dev/null
|
pushd $tmpDir > /dev/null
|
||||||
chmod u+w $out/${filenames.jar}
|
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
|
chmod $out/${filenames.jar} --reference=$out/${filenames.jar}.sha1
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
rm -rf $tmpDir
|
rm -rf $tmpDir
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# for the Android development environment.
|
# for the Android development environment.
|
||||||
#
|
#
|
||||||
|
|
||||||
{ stdenv, config, callPackage, androidenv, openjdk, mkShell }:
|
{ androidenv }:
|
||||||
|
|
||||||
# The "android-sdk-license" license is accepted
|
# The "android-sdk-license" license is accepted
|
||||||
# by setting android_sdk.accept_license = true.
|
# by setting android_sdk.accept_license = true.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# for the Android development environment.
|
# for the Android development environment.
|
||||||
#
|
#
|
||||||
|
|
||||||
{ callPackage, stdenv, writeScript }:
|
{ callPackage }:
|
||||||
|
|
||||||
let
|
let
|
||||||
compose = callPackage ./compose.nix { };
|
compose = callPackage ./compose.nix { };
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{ lib, buildGoModule, fetchFromGitHub }:
|
{ buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
let
|
buildGoModule rec {
|
||||||
inherit (lib) strings;
|
|
||||||
in buildGoModule rec {
|
|
||||||
pname = "go-maven-resolver";
|
pname = "go-maven-resolver";
|
||||||
version = "v1.1.2";
|
version = "v1.1.2";
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# for merging the default shell with others
|
# 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`
|
# 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
|
# the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, callPackage, mkShell, openjdk, androidPkgs }:
|
{ lib, callPackage, mkShell }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) attrValues mapAttrs;
|
inherit (lib) attrValues mapAttrs;
|
||||||
|
@ -40,7 +40,6 @@ in rec {
|
||||||
inherit meta source;
|
inherit meta source;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
shell = mkShell {
|
shell = mkShell {
|
||||||
inputsFrom = [ mobile.android mobile.ios ];
|
inputsFrom = [ mobile.android mobile.ios ];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
{ lib, stdenv, utils, buildGoPackage
|
{ buildGoPackage
|
||||||
, go, xcodeWrapper
|
|
||||||
# object with source attributes
|
# object with source attributes
|
||||||
, meta, source}:
|
, meta, source}:
|
||||||
|
|
||||||
let
|
buildGoPackage {
|
||||||
inherit (stdenv) isDarwin;
|
|
||||||
inherit (lib) optional;
|
|
||||||
|
|
||||||
in buildGoPackage {
|
|
||||||
pname = source.repo;
|
pname = source.repo;
|
||||||
version = "${source.cleanVersion}-${source.shortRev}";
|
version = "${source.cleanVersion}-${source.shortRev}";
|
||||||
|
|
||||||
|
@ -25,9 +20,7 @@ in buildGoPackage {
|
||||||
# Build the Go library
|
# Build the Go library
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
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
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, stdenv, utils, callPackage, buildGoPackage
|
{ lib, stdenv, utils, buildGoPackage
|
||||||
, go, androidPkgs, openjdk, gomobile, xcodeWrapper
|
, go, androidPkgs, openjdk, gomobile, xcodeWrapper
|
||||||
# object with source attributes
|
# object with source attributes
|
||||||
, meta, source
|
, meta, source
|
||||||
|
@ -13,9 +13,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (stdenv) isDarwin;
|
inherit (stdenv) isDarwin;
|
||||||
inherit (lib)
|
inherit (lib) concatStringsSep concatMapStrings optionalString makeBinPath optional;
|
||||||
concatStrings concatStringsSep concatMapStrings optionalString
|
|
||||||
getAttr attrValues makeBinPath optional;
|
|
||||||
|
|
||||||
removeReferences = [ go ];
|
removeReferences = [ go ];
|
||||||
removeExpr = refs: ''remove-references-to ${concatMapStrings (ref: " -t ${ref}") refs}'';
|
removeExpr = refs: ''remove-references-to ${concatMapStrings (ref: " -t ${ref}") refs}'';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, utils, lib, callPackage, fetchFromGitHub }:
|
{ utils, lib, fetchFromGitHub }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) strings traceValFn attrByPath importJSON getConfig;
|
inherit (lib) strings traceValFn importJSON getConfig;
|
||||||
|
|
||||||
srcOverride = getConfig "status-go.src-override" null;
|
srcOverride = getConfig "status-go.src-override" null;
|
||||||
# Warning message about using local sources
|
# Warning message about using local sources
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
# This Nix expression takes care of reading/parsing the correct .env configuration file and return it as an attr set
|
# 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
|
let
|
||||||
inherit (builtins) listToAttrs head tail readFile;
|
inherit (builtins) listToAttrs head tail readFile;
|
||||||
inherit (lib) attrByPath filter hasPrefix nameValuePair splitString;
|
inherit (lib) attrByPath filter hasPrefix nameValuePair splitString;
|
||||||
|
|
||||||
build-type = attrByPath ["status-im" "build-type"] "" config;
|
build-type = attrByPath ["status-im" "build-type"] "" config;
|
||||||
ci = (attrByPath ["status-im" "ci"] "" config) != "";
|
|
||||||
|
|
||||||
readLinesFromFile =
|
readLinesFromFile =
|
||||||
file:
|
file:
|
||||||
|
|
|
@ -11,7 +11,7 @@ let
|
||||||
lines = splitString "\n" (readFile gradlePropsFile);
|
lines = splitString "\n" (readFile gradlePropsFile);
|
||||||
|
|
||||||
isKeyValueLine = line: line != "" && !hasPrefix "#" line;
|
isKeyValueLine = line: line != "" && !hasPrefix "#" line;
|
||||||
cleanup = lines: filter isKeyValueLine lines;
|
cleanup = filter isKeyValueLine;
|
||||||
extractKeyValues = line:
|
extractKeyValues = line:
|
||||||
let flag = splitString "=" line;
|
let flag = splitString "=" line;
|
||||||
in nameValuePair (head flag) (last flag);
|
in nameValuePair (head flag) (last flag);
|
||||||
|
|
|
@ -55,7 +55,7 @@ let
|
||||||
# Geth forces a 'v' prefix for all versions
|
# 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
|
# 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 {
|
in {
|
||||||
inherit sanitizeVersion
|
inherit sanitizeVersion
|
||||||
|
|
Loading…
Reference in New Issue