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";
|
||||
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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, pkgs, deps, callPackage, mkShell
|
||||
{ pkgs, deps, callPackage, mkShell
|
||||
, status-go, androidPkgs, androidShell }:
|
||||
|
||||
let
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# for the Android development environment.
|
||||
#
|
||||
|
||||
{ callPackage, stdenv, writeScript }:
|
||||
{ callPackage }:
|
||||
|
||||
let
|
||||
compose = callPackage ./compose.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";
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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}'';
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -55,7 +55,7 @@ let
|
|||
# Geth forces a 'v' prefix for all versions
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue