nix: Avoid bad practice of inheriting pkgs

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2019-05-17 10:55:24 +02:00
parent 3799df77cc
commit 373291bfc0
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
14 changed files with 73 additions and 74 deletions

View File

@ -3,42 +3,42 @@
, pkgs ? (import <nixpkgs> { inherit system config overlays; })
, target-os }:
with pkgs;
let
platform = callPackage ./nix/platform.nix { inherit target-os; };
# TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib)
_stdenv = stdenvNoCC;
statusDesktop = callPackage ./nix/desktop { inherit target-os status-go; stdenv = _stdenv; };
statusMobile = callPackage ./nix/mobile { inherit target-os config status-go; stdenv = _stdenv; };
status-go = callPackage ./nix/status-go { inherit target-os; inherit (xcodeenv) composeXcodeWrapper; inherit (statusMobile) xcodewrapperArgs; androidPkgs = statusMobile.androidComposition; };
nodejs' = nodejs-10_x;
yarn' = yarn.override { nodejs = nodejs'; };
nodeInputs = import ./nix/global-node-packages/output {
# The remaining dependencies come from Nixpkgs
inherit pkgs;
nodejs = nodejs';
};
nodePkgBuildInputs = [
nodejs'
python27 # for e.g. gyp
yarn'
] ++ (builtins.attrValues nodeInputs);
selectedSources =
lib.optional platform.targetDesktop statusDesktop ++
lib.optional platform.targetMobile statusMobile;
let
platform = pkgs.callPackage ./nix/platform.nix { inherit target-os; };
# TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib)
stdenv' = pkgs.stdenvNoCC;
gradle = pkgs.gradle_4_10;
statusDesktop = pkgs.callPackage ./nix/desktop { inherit target-os status-go; inherit (pkgs) darwin; stdenv = stdenv'; };
statusMobile = pkgs.callPackage ./nix/mobile { inherit target-os config status-go gradle; inherit (pkgs.xcodeenv) composeXcodeWrapper; stdenv = stdenv'; };
status-go = pkgs.callPackage ./nix/status-go { inherit target-os; inherit (pkgs.xcodeenv) composeXcodeWrapper; inherit (statusMobile) xcodewrapperArgs; androidPkgs = statusMobile.androidComposition; };
nodejs' = pkgs.nodejs-10_x;
yarn' = pkgs.yarn.override { nodejs = nodejs'; };
nodeInputs = import ./nix/global-node-packages/output {
# The remaining dependencies come from Nixpkgs
inherit pkgs;
nodejs = nodejs';
};
nodePkgBuildInputs = [
nodejs'
pkgs.python27 # for e.g. gyp
yarn'
] ++ (builtins.attrValues nodeInputs);
selectedSources =
stdenv'.lib.optional platform.targetDesktop statusDesktop ++
stdenv'.lib.optional platform.targetMobile statusMobile;
in _stdenv.mkDerivation rec {
name = "status-react-build-env";
in with stdenv'; stdenv'.mkDerivation rec {
name = "status-react-build-env";
buildInputs = with _stdenv; [
clojure
leiningen
maven
watchman
] ++ nodePkgBuildInputs
++ lib.optional isDarwin cocoapods
++ lib.optional (isDarwin && !platform.targetIOS) clang
++ lib.optional (!isDarwin) gcc7
++ lib.catAttrs "buildInputs" selectedSources;
shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
}
buildInputs = with pkgs; [
clojure
leiningen
maven
watchman
] ++ nodePkgBuildInputs
++ lib.optional isDarwin cocoapods
++ lib.optional (isDarwin && !platform.targetIOS) clang
++ lib.optional (!isDarwin) gcc7
++ lib.catAttrs "buildInputs" selectedSources;
shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
}

View File

@ -139,6 +139,6 @@ SPEC CHECKSUMS:
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
yoga: 128daf064cacaede0c3bb27424b6b4c71052e6cd
PODFILE CHECKSUM: 6a6c6a3aad3b4979df3974dc03b0bf305426ce72
PODFILE CHECKSUM: 1b73a7ab29d939e99e86434864c837afaf55851c
COCOAPODS: 1.5.3

View File

@ -1,12 +1,13 @@
{ stdenv, pkgs, target-os, status-go }:
{ stdenv, callPackage, target-os,
cmake, extra-cmake-modules, file, status-go,
darwin }:
with pkgs;
with stdenv;
let
platform = callPackage ../platform.nix { inherit target-os; };
linuxPlatform = callPackage ./linux { inherit status-go; };
darwinPlatform = callPackage ./macos { inherit status-go; };
darwinPlatform = callPackage ./macos { inherit status-go darwin; };
windowsPlatform = callPackage ./windows { };
snoreNotifySources = callPackage ./cmake/snorenotify { };
qtkeychainSources = callPackage ./cmake/qtkeychain { };

View File

@ -1,6 +1,6 @@
{ stdenv, pkgs, status-go }:
{ stdenv, callPackage,
appimagekit, patchelf, qt5, status-go }:
with pkgs;
with stdenv;
assert isLinux;

View File

@ -1,6 +1,6 @@
{ stdenv, pkgs, status-go }:
{ stdenv, callPackage,
darwin, qt5, status-go }:
with pkgs;
with stdenv;
with darwin.apple_sdk.frameworks;

View File

@ -1,6 +1,6 @@
{ stdenv, pkgs }:
{ stdenv, callPackage,
conan, nsis, go }:
with pkgs;
with stdenv;
assert isLinux;

View File

@ -1,10 +1,9 @@
{ config, stdenv, pkgs }:
{ config, stdenv, callPackage,
androidenv, openjdk, gradle }:
with pkgs;
with stdenv;
let
gradle = gradle_4_10;
androidComposition = androidenv.composeAndroidPackages {
toolsVersion = "26.1.1";
platformToolsVersion = "28.0.2";
@ -33,7 +32,7 @@ in
buildInputs = [ openjdk gradle ];
shellHook = ''
export JAVA_HOME="${openjdk}"
export ANDROID_HOME=${licensedAndroidEnv}
export ANDROID_HOME="${licensedAndroidEnv}"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle"
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"

View File

@ -1,16 +1,15 @@
{ config, stdenv, pkgs, target-os, status-go }:
{ config, stdenv, callPackage, target-os,
gradle, status-go, composeXcodeWrapper }:
with pkgs;
with stdenv;
let
gradle = gradle_4_10;
platform = pkgs.callPackage ../platform.nix { inherit target-os; };
platform = callPackage ../platform.nix { inherit target-os; };
xcodewrapperArgs = {
version = "10.1";
};
xcodeWrapper = xcodeenv.composeXcodeWrapper xcodewrapperArgs;
androidPlatform = callPackage ./android.nix { inherit config; };
xcodeWrapper = composeXcodeWrapper xcodewrapperArgs;
androidPlatform = callPackage ./android.nix { inherit config gradle; };
selectedSources =
[ status-go ] ++
lib.optional platform.targetAndroid androidPlatform;

View File

@ -1,6 +1,4 @@
{ config, stdenv, pkgs, androidComposition }:
with pkgs;
{ config, stdenv, androidComposition }:
stdenv.mkDerivation rec {
name = "licensed-android-sdk";

View File

@ -1,5 +1,6 @@
{ buildGoPackage, go, xcodeWrapper, pkgs, stdenv, utils }:
{ stdenv, utils, callPackage,
buildGoPackage, go, xcodeWrapper }:
{ owner, repo, rev, version, goPackagePath, src, host,
@ -11,7 +12,7 @@
with stdenv;
let
buildStatusGo = pkgs.callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; };
buildStatusGo = callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; };
args = removeAttrs args' [ "goBuildFlags" "goBuildLdFlags" "outputFileName" "hostSystem" ]; # Remove desktop-only arguments from args
buildStatusGoDesktopLib = buildStatusGo (args // {

View File

@ -1,5 +1,6 @@
{ buildGoPackage, go, gomobile, openjdk, xcodeWrapper, pkgs, stdenv, utils }:
{ stdenv, utils, callPackage,
buildGoPackage, go, gomobile, openjdk, xcodeWrapper }:
{ owner, repo, rev, version, goPackagePath, src, host,
@ -11,7 +12,7 @@ with stdenv;
let
targetConfig = config;
buildStatusGo = pkgs.callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; };
buildStatusGo = callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; };
args = removeAttrs args' [ "config" "goBuildFlags" "goBuildLdFlags" ]; # Remove mobile-only arguments from args
buildStatusGoMobileLib = buildStatusGo (args // {

View File

@ -1,13 +1,15 @@
{ target-os, stdenv, buildGoPackage, go, pkgs, fetchFromGitHub, openjdk, androidPkgs, composeXcodeWrapper, xcodewrapperArgs ? {} }:
{ target-os, stdenv, callPackage,
buildGoPackage, go, fetchFromGitHub, openjdk,
androidPkgs, composeXcodeWrapper, xcodewrapperArgs ? {} }:
with stdenv;
let
platform = pkgs.callPackage ../platform.nix { inherit target-os; };
utils = pkgs.callPackage ../utils.nix { inherit xcodeWrapper; };
gomobile = pkgs.callPackage ./gomobile { inherit (androidPkgs) platform-tools; inherit composeXcodeWrapper xcodewrapperArgs utils; };
buildStatusGoDesktopLib = pkgs.callPackage ./build-desktop-status-go.nix { inherit buildGoPackage go pkgs xcodeWrapper utils; };
buildStatusGoMobileLib = pkgs.callPackage ./build-mobile-status-go.nix { inherit buildGoPackage go gomobile pkgs xcodeWrapper utils; };
platform = callPackage ../platform.nix { inherit target-os; };
utils = callPackage ../utils.nix { inherit xcodeWrapper; };
gomobile = callPackage ./gomobile { inherit (androidPkgs) platform-tools; inherit composeXcodeWrapper xcodewrapperArgs utils; };
buildStatusGoDesktopLib = callPackage ./build-desktop-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; };
buildStatusGoMobileLib = callPackage ./build-mobile-status-go.nix { inherit buildGoPackage go gomobile xcodeWrapper utils; };
extractStatusGoConfig = f: lib.last (lib.splitString "\n" (lib.fileContents f));
owner = lib.fileContents ../../STATUS_GO_OWNER;
version = extractStatusGoConfig ../../STATUS_GO_VERSION; # TODO: Simplify this path search with lib.locateDominatingFile

View File

@ -1,5 +1,5 @@
{ stdenv, pkgs, utils, buildGoPackage, fetchgit,
glibc, ncurses5, zlib, makeWrapper, patchelf,
{ stdenv, utils, fetchgit,
buildGoPackage, glibc, ncurses5, zlib, makeWrapper, patchelf,
platform-tools, composeXcodeWrapper, xcodewrapperArgs ? {}
}:

View File

@ -61,8 +61,6 @@ if [ ! -f .babelrc ] || [ $(readlink .babelrc) != "${PLATFORM_FOLDER}/.babelrc"
ln -sf ${PLATFORM_FOLDER}/metro.config.js metro.config.js
fi
rm -rf /home/jenkins/.cache/yarn/v4/.tmp/6ec8ff0e65cf4f48c50d7472fa1f10ca
rm -rf /Users/jenkins/Library/Caches/Yarn/v4/.tmp/6ec8ff0e65cf4f48c50d7472fa1f10ca
yarn install --frozen-lockfile
case $1 in