From 48c7f928cddf695c68311a25daa0d07538414560 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 4 Jul 2019 16:49:21 +0200 Subject: [PATCH] Clean up some nix files --- ci/nix.groovy | 3 ++- derivation.nix | 20 ++++++++++---------- nix/status-go/build-mobile-status-go.nix | 1 - nix/status-go/default.nix | 1 + shell.nix | 19 +++++++++---------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ci/nix.groovy b/ci/nix.groovy index c5ce9efc56..3b1a03cf8b 100644 --- a/ci/nix.groovy +++ b/ci/nix.groovy @@ -8,7 +8,7 @@ def shell(Map opts = [:], String cmd) { def defaults = [ pure: true, args: ['target-os': env.TARGET_OS], - keep: ['LOCALE_ARCHIVE_2_27'], + keep: ['LOCALE_ARCHIVE_2_27', 'IN_CI_ENVIRONMENT'], ] /* merge defaults with received opts */ opts = defaults + opts @@ -22,6 +22,7 @@ def shell(Map opts = [:], String cmd) { set +x . ~/.nix-profile/etc/profile.d/nix.sh set -x + IN_CI_ENVIRONMENT=1 \\ nix-shell \\ ${isPure ? "--pure" : ""} \\ ${keepFlags.join(" ")} \\ diff --git a/derivation.nix b/derivation.nix index 361427e907..2c55cf1e9a 100644 --- a/derivation.nix +++ b/derivation.nix @@ -6,25 +6,25 @@ 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; + stdenv = pkgs.stdenvNoCC; gradle = pkgs.gradle_4_10; go = pkgs.go_1_11; buildGoPackage = pkgs.buildGoPackage.override { inherit go; }; - statusDesktop = pkgs.callPackage ./nix/desktop { inherit target-os status-go pkgs go; inherit (pkgs) darwin; stdenv = stdenv'; nodejs = nodejs'; }; - statusMobile = pkgs.callPackage ./nix/mobile { inherit target-os config pkgs status-go gradle; inherit (pkgs.xcodeenv) composeXcodeWrapper; stdenv = stdenv'; nodejs = nodejs'; }; + statusDesktop = pkgs.callPackage ./nix/desktop { inherit target-os stdenv status-go pkgs nodejs go; inherit (pkgs) darwin; }; + statusMobile = pkgs.callPackage ./nix/mobile { inherit target-os config stdenv pkgs nodejs status-go gradle; inherit (pkgs.xcodeenv) composeXcodeWrapper; }; status-go = pkgs.callPackage ./nix/status-go { inherit target-os go buildGoPackage; inherit (pkgs.xcodeenv) composeXcodeWrapper; inherit (statusMobile) xcodewrapperArgs; androidPkgs = statusMobile.androidComposition; }; - nodejs' = pkgs.nodejs-10_x; - yarn' = pkgs.yarn.override { nodejs = nodejs'; }; + nodejs = pkgs.nodejs-10_x; + yarn = pkgs.yarn.override { inherit nodejs; }; nodePkgBuildInputs = [ - nodejs' + nodejs pkgs.python27 # for e.g. gyp - yarn' + yarn ]; selectedSources = - stdenv'.lib.optional platform.targetDesktop statusDesktop ++ - stdenv'.lib.optional platform.targetMobile statusMobile; + stdenv.lib.optional platform.targetDesktop statusDesktop ++ + stdenv.lib.optional platform.targetMobile statusMobile; -in with stdenv'; stdenv'.mkDerivation rec { +in with stdenv; mkDerivation rec { name = "status-react-build-env"; buildInputs = with pkgs; [ diff --git a/nix/status-go/build-mobile-status-go.nix b/nix/status-go/build-mobile-status-go.nix index 44a48b2a1e..9444eaf2cb 100644 --- a/nix/status-go/build-mobile-status-go.nix +++ b/nix/status-go/build-mobile-status-go.nix @@ -20,7 +20,6 @@ let buildMessage = "Building mobile library for ${targetConfig.name}"; # Build mobile libraries - # TODO: Manage to pass -s -w to -ldflags. Seems to only accept a single flag buildPhase = '' GOPATH=${gomobile.dev}:$GOPATH \ PATH=${lib.makeBinPath [ gomobile.bin ]}:$PATH \ diff --git a/nix/status-go/default.nix b/nix/status-go/default.nix index 6c310972f4..1c100c1377 100644 --- a/nix/status-go/default.nix +++ b/nix/status-go/default.nix @@ -50,6 +50,7 @@ let currentHostConfig = if isDarwin then hostConfigs.darwin else hostConfigs.linux; goBuildFlags = "-v"; + # TODO: Manage to pass -s -w to -ldflags. Seems to only accept a single flag goBuildLdFlags = "-ldflags=-s"; xcodeWrapper = composeXcodeWrapper xcodewrapperArgs; diff --git a/shell.nix b/shell.nix index ce7f4c9709..c5edd8d418 100644 --- a/shell.nix +++ b/shell.nix @@ -1,24 +1,23 @@ { nixpkgs-bootstrap ? import ./nix/nixpkgs-bootstrap.nix { }, pkgs ? nixpkgs-bootstrap.pkgs, target-os ? "all" }: -with pkgs; let projectDeps = import ./default.nix { inherit target-os pkgs nixpkgs-bootstrap; inherit (nixpkgs-bootstrap) config; }; - platform = callPackage ./nix/platform.nix { inherit target-os; }; - useFastlanePkg = (platform.targetAndroid && !stdenv'.isDarwin); + platform = pkgs.callPackage ./nix/platform.nix { inherit target-os; }; + useFastlanePkg = (platform.targetAndroid && !stdenv.isDarwin); # 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; - mkShell' = mkShell.override { stdenv = stdenv'; }; - fastlane' = callPackage ./fastlane { + stdenv = pkgs.stdenvNoCC; + mkShell = pkgs.mkShell.override { inherit stdenv; }; + fastlane = pkgs.callPackage ./fastlane { bundlerEnv = _: pkgs.bundlerEnv { name = "fastlane-gems"; gemdir = ./fastlane; }; }; -in mkShell' { - buildInputs = [ +in mkShell { + buildInputs = with pkgs; [ # utilities bash curl @@ -32,7 +31,7 @@ in mkShell' { unzip wget ] ++ - (if useFastlanePkg then [ fastlane' ] else lib.optionals platform.targetMobile [ bundler ruby ]); # bundler/ruby used for fastlane on macOS + (if useFastlanePkg then [ fastlane ] else with pkgs; lib.optionals platform.targetMobile [ bundler ruby ]); # bundler/ruby used for fastlane on macOS inputsFrom = [ projectDeps ]; TARGET_OS = target-os; shellHook = '' @@ -42,7 +41,7 @@ in mkShell' { export PATH=$STATUS_REACT_HOME/node_modules/.bin:$PATH ${projectDeps.shellHook} - ${lib.optionalString useFastlanePkg fastlane'.shellHook} + ${stdenv.lib.optionalString useFastlanePkg fastlane.shellHook} if [ "$IN_NIX_SHELL" != 'pure' ] && [ ! -f $STATUS_REACT_HOME/.ran-setup ]; then $STATUS_REACT_HOME/scripts/setup