Minor refactoring of the way dependency packages are iterated for shellHook and buildInputs.

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2019-05-13 11:22:29 +02:00
parent 90d517adf6
commit b542c7de26
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
7 changed files with 50 additions and 50 deletions

View File

@ -23,6 +23,9 @@ with pkgs;
python27 # for e.g. gyp
yarn'
] ++ (builtins.attrValues nodeInputs);
selectedSources =
lib.optional platform.targetDesktop statusDesktop ++
lib.optional platform.targetMobile statusMobile;
in _stdenv.mkDerivation rec {
name = "status-react-build-env";
@ -36,9 +39,6 @@ with pkgs;
++ lib.optional isDarwin cocoapods
++ lib.optional (isDarwin && !platform.targetIOS) clang
++ lib.optional (!isDarwin) gcc7
++ lib.optionals platform.targetDesktop statusDesktop.buildInputs
++ lib.optionals platform.targetMobile statusMobile.buildInputs;
shellHook =
lib.optionalString platform.targetDesktop statusDesktop.shellHook +
lib.optionalString platform.targetMobile statusMobile.shellHook;
++ lib.catAttrs "buildInputs" selectedSources;
shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
}

View File

@ -10,6 +10,10 @@ let
windowsPlatform = callPackage ./windows { };
snoreNotifySources = callPackage ./cmake/snorenotify { };
qtkeychainSources = callPackage ./cmake/qtkeychain { };
selectedSources =
lib.optional platform.targetLinux linuxPlatform ++
lib.optional platform.targetDarwin darwinPlatform ++
lib.optional platform.targetWindows windowsPlatform;
in
{
@ -19,19 +23,6 @@ in
file
snoreNotifySources
qtkeychainSources
] ++ lib.optionals platform.targetLinux linuxPlatform.buildInputs
++ lib.optionals platform.targetDarwin darwinPlatform.buildInputs
++ lib.optionals platform.targetWindows windowsPlatform.buildInputs
++ lib.optional (! platform.targetWindows) qt5.full;
shellHook =
snoreNotifySources.shellHook +
qtkeychainSources.shellHook +
lib.optionalString (target-os != "windows") ''
export QT_PATH="${qt5.full}"
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
export PATH="${qt5.full}/bin:$PATH"
'' +
lib.optionalString platform.targetLinux linuxPlatform.shellHook +
lib.optionalString platform.targetDarwin darwinPlatform.shellHook +
lib.optionalString platform.targetWindows windowsPlatform.shellHook;
] ++ lib.catAttrs "buildInputs" selectedSources;
shellHook = lib.concatStrings (lib.catAttrs "shellHook" (selectedSources ++ [ snoreNotifySources qtkeychainSources ]));
}

View File

@ -16,9 +16,14 @@ in {
linuxdeployqt
patchelf
baseImage
] ++ status-go.packages;
qt5.full
] ++ status-go.buildInputs;
shellHook =
baseImage.shellHook +
status-go.shellHook;
status-go.shellHook + ''
export QT_PATH="${qt5.full}"
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
export PATH="${qt5.full}/bin:$PATH"
'';
}

View File

@ -12,7 +12,8 @@ let
in
{
buildInputs = [
baseImage status-go.packages
baseImage status-go.buildInputs
qt5.full
AppKit Cocoa darwin.cf-private Foundation OpenGL
];
@ -20,5 +21,8 @@ in
baseImage.shellHook +
status-go.shellHook + ''
export NIX_TARGET_LDFLAGS="-F${CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_TARGET_LDFLAGS"
export QT_PATH="${qt5.full}"
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
export PATH="${qt5.full}/bin:$PATH"
'';
}

View File

@ -1,4 +1,4 @@
{ config, stdenv, pkgs, target-os ? "all", status-go }:
{ config, stdenv, pkgs, target-os, status-go }:
with pkgs;
with stdenv;
@ -10,18 +10,19 @@ let
version = "10.1";
};
xcodeWrapper = xcodeenv.composeXcodeWrapper xcodewrapperArgs;
android = callPackage ./android.nix { inherit config; };
androidPlatform = callPackage ./android.nix { inherit config; };
selectedSources =
[ status-go ] ++
lib.optional platform.targetAndroid androidPlatform;
in
{
inherit (android) androidComposition;
inherit (androidPlatform) androidComposition;
inherit xcodewrapperArgs;
buildInputs =
status-go.packages ++
lib.optionals platform.targetAndroid android.buildInputs ++
status-go.buildInputs ++
lib.catAttrs "buildInputs" selectedSources ++
lib.optional (platform.targetIOS && isDarwin) xcodeWrapper;
shellHook =
status-go.shellHook +
lib.optionalString platform.targetAndroid android.shellHook;
shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
}

View File

@ -71,14 +71,14 @@ let
});
};
packages = if target-os == "android" then [ status-go-packages.android ] else
buildInputs = if target-os == "android" then [ status-go-packages.android ] else
if target-os == "ios" then [ status-go-packages.ios ] else
if target-os == "all" then currentHostConfig.allTargets else
if platform.targetDesktop then [ status-go-packages.desktop ] else
throw "Unexpected target platform ${target-os}";
in {
inherit packages;
inherit buildInputs;
shellHook =
lib.optionalString platform.targetIOS ''

View File

@ -34,8 +34,7 @@ in mkShell' {
(if useFastlanePkg then [ fastlane' ] else lib.optionals platform.targetMobile [ bundler ruby ]); # bundler/ruby used for fastlane on macOS
inputsFrom = [ projectDeps ];
TARGET_OS = target-os;
shellHook =
''
shellHook = ''
set -e
STATUS_REACT_HOME=$(git rev-parse --show-toplevel)