nix: Apply some nixfmt suggestions and fix macOS status-go buildInputs
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
parent
4ab64d6c40
commit
9594552102
|
@ -27,6 +27,7 @@ let
|
|||
};
|
||||
# Declare a specialized mkShell function which adds some bootstrapping
|
||||
# so that e.g. STATUS_REACT_HOME is automatically available in the shell
|
||||
mkShell' = shellAttr: (mkShell.override { inherit stdenv; }) (shell' shellAttr);
|
||||
mkShell' = shellAttr:
|
||||
(mkShell.override { inherit stdenv; }) (shell' shellAttr);
|
||||
|
||||
in mkShell'
|
||||
|
|
|
@ -10,7 +10,10 @@ let
|
|||
platform = pkgs.callPackage ./platform.nix { inherit target-os; };
|
||||
# Declare a specialized mkShell function which adds some bootstrapping
|
||||
# so that e.g. STATUS_REACT_HOME is automatically available in the shell
|
||||
mkShell = (import ./bootstrapped-shell.nix { inherit stdenv target-os; inherit (pkgs) mkShell git; });
|
||||
mkShell = (import ./bootstrapped-shell.nix {
|
||||
inherit stdenv target-os;
|
||||
inherit (pkgs) mkShell git;
|
||||
});
|
||||
# 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;
|
||||
maven = pkgs.maven;
|
||||
|
@ -22,7 +25,10 @@ let
|
|||
status-go = pkgs.callPackage ./status-go { inherit target-os go buildGoPackage; inherit (mobile.ios) xcodeWrapper; androidPkgs = mobile.android.androidComposition; };
|
||||
# mkFilter is a function that allows filtering a directory structure (used for filtering source files being captured in a closure)
|
||||
mkFilter = import ./tools/mkFilter.nix { inherit (stdenv) lib; };
|
||||
localMavenRepoBuilder = pkgs.callPackage ./tools/maven/maven-repo-builder.nix { inherit (pkgs) stdenv; };
|
||||
localMavenRepoBuilder =
|
||||
pkgs.callPackage ./tools/maven/maven-repo-builder.nix {
|
||||
inherit (pkgs) stdenv;
|
||||
};
|
||||
nodejs = pkgs.nodejs-10_x;
|
||||
yarn = pkgs.yarn.override { inherit nodejs; };
|
||||
selectedSources =
|
||||
|
@ -57,8 +63,7 @@ in {
|
|||
nodejs
|
||||
pkgs.python27 # for e.g. gyp
|
||||
yarn
|
||||
]
|
||||
++ optional isDarwin pkgs.cocoapods
|
||||
] ++ optional isDarwin pkgs.cocoapods
|
||||
++ optional (isDarwin && !platform.targetIOS) pkgs.clang
|
||||
++ optional (!isDarwin) pkgs.gcc8
|
||||
++ catAttrs "buildInputs" selectedSources);
|
||||
|
|
|
@ -11,10 +11,14 @@ let
|
|||
|
||||
in {
|
||||
buildInputs = [
|
||||
baseImage status-go.buildInputs
|
||||
baseImage
|
||||
qt5.full
|
||||
AppKit Cocoa darwin.cf-private Foundation OpenGL
|
||||
];
|
||||
AppKit
|
||||
Cocoa
|
||||
darwin.cf-private
|
||||
Foundation
|
||||
OpenGL
|
||||
] ++ status-go.buildInputs;
|
||||
|
||||
shellHook =
|
||||
concatStrings (catAttrs "shellHook" [ baseImage status-go ] ) + ''
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,8 @@ let
|
|||
echo -e "\n33b6a2b64607f11b759f320ef9dff4ae5c47d97a" > "$out/licenses/google-gdk-license"
|
||||
'';
|
||||
};
|
||||
shellHook = assert platform.targetAndroid; ''
|
||||
shellHook = assert platform.targetAndroid;
|
||||
''
|
||||
export JAVA_HOME="${openjdk}"
|
||||
export ANDROID_HOME="${licensedAndroidEnv}"
|
||||
export ANDROID_SDK_ROOT="$ANDROID_HOME"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,17 +7,21 @@ let
|
|||
platform = callPackage ../../platform.nix { inherit target-os; };
|
||||
useFastlanePkg = platform.targetAndroid && !stdenv.isDarwin;
|
||||
fastlane = callPackage ../../../fastlane {
|
||||
bundlerEnv = _: bundlerEnv {
|
||||
bundlerEnv = _:
|
||||
bundlerEnv {
|
||||
name = "fastlane-gems";
|
||||
gemdir = ../../../fastlane;
|
||||
};
|
||||
};
|
||||
bundlerDeps = optionals platform.targetMobile [ bundler ruby ];
|
||||
bundlerDeps = optionals platform.targetMobile [
|
||||
bundler
|
||||
ruby
|
||||
]; # bundler/ruby used for fastlane on macOS
|
||||
shellHook = optionalString useFastlanePkg fastlane.shellHook;
|
||||
|
||||
# TARGETS
|
||||
shell = mkShell {
|
||||
buildInputs = if useFastlanePkg then [ fastlane curl ] else bundlerDeps; # bundler/ruby used for fastlane on macOS
|
||||
buildInputs = if useFastlanePkg then [ fastlane curl ] else bundlerDeps;
|
||||
inherit shellHook;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,16 @@
|
|||
|
||||
# We allow for "none" value because `make shell` can be called with `TARGET_OS` not set.
|
||||
# We don't want to assume `all`, because that will rebuild status-go for all platforms.
|
||||
assert stdenv.lib.assertOneOf "target-os" target-os [ "linux" "android" "windows" "macos" "darwin" "ios" "all" "none" ];
|
||||
assert stdenv.lib.assertOneOf "target-os" target-os [
|
||||
"linux"
|
||||
"android"
|
||||
"windows"
|
||||
"macos"
|
||||
"darwin"
|
||||
"ios"
|
||||
"all"
|
||||
"none"
|
||||
];
|
||||
|
||||
let
|
||||
inherit (stdenv) isDarwin isLinux;
|
||||
|
|
|
@ -45,7 +45,7 @@ else
|
|||
echo -e "See nix/README.md for more details."
|
||||
fi
|
||||
|
||||
if [[ "$TARGET_OS" =~ (linux|windows) ]]; then
|
||||
if [[ "$TARGET_OS" =~ (linux|windows|darwin|macos) ]]; then
|
||||
# This is a dirty workaround because 'yarn install' is an impure operation,
|
||||
# so we need to call it from an impure shell.
|
||||
# Hopefull we'll be able to fix this later on with something like yarn2nix
|
||||
|
|
|
@ -10,9 +10,16 @@
|
|||
hostSystem } @ args':
|
||||
|
||||
let
|
||||
buildStatusGo = 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
|
||||
args = removeAttrs args' [
|
||||
"goBuildFlags"
|
||||
"goBuildLdFlags"
|
||||
"outputFileName"
|
||||
"hostSystem"
|
||||
]; # Remove desktop-only arguments from args
|
||||
buildStatusGoDesktopLib = buildStatusGo (args // {
|
||||
buildMessage = "Building desktop library";
|
||||
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
||||
|
@ -32,9 +39,7 @@ let
|
|||
|
||||
outputs = [ "out" ];
|
||||
|
||||
meta = {
|
||||
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
||||
};
|
||||
meta = { platforms = with stdenv.lib.platforms; linux ++ darwin; };
|
||||
});
|
||||
|
||||
in buildStatusGoDesktopLib
|
|
@ -78,9 +78,7 @@ let
|
|||
return
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit owner version rev;
|
||||
};
|
||||
passthru = { inherit owner version rev; };
|
||||
|
||||
meta = {
|
||||
# Add default meta information
|
||||
|
@ -89,8 +87,7 @@ let
|
|||
license = lib.licenses.mpl20;
|
||||
} // meta // {
|
||||
# add an extra maintainer to every package
|
||||
maintainers = (meta.maintainers or []) ++
|
||||
[ lib.maintainers.pombeirp ];
|
||||
maintainers = (meta.maintainers or [ ]) ++ [ lib.maintainers.pombeirp ];
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -72,10 +72,15 @@ let
|
|||
});
|
||||
};
|
||||
|
||||
buildInputs = if target-os == "android" then android.buildInputs else
|
||||
if target-os == "ios" then ios.buildInputs else
|
||||
if target-os == "all" then currentHostConfig.allTargets else
|
||||
if platform.targetDesktop then desktop.buildInputs else
|
||||
buildInputs = if target-os == "android" then
|
||||
android.buildInputs
|
||||
else if target-os == "ios" then
|
||||
ios.buildInputs
|
||||
else if target-os == "all" then
|
||||
currentHostConfig.allTargets
|
||||
else if platform.targetDesktop then
|
||||
desktop.buildInputs
|
||||
else
|
||||
throw "Unexpected target platform ${target-os}";
|
||||
android = {
|
||||
buildInputs = optional platform.targetAndroid [ status-go-packages.android ];
|
||||
|
|
|
@ -85,9 +85,11 @@ function writeEntry() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo -n " \"$depurl\" = {
|
||||
echo -n " \"$depurl\" =
|
||||
{
|
||||
host = repositories.$host;
|
||||
path = \"$deppath\";
|
||||
path =
|
||||
\"$deppath\";
|
||||
type = \"$type\";"
|
||||
if [ -n "$pom_sha256" ]; then
|
||||
echo -n "
|
||||
|
@ -126,8 +128,10 @@ let
|
|||
jcenter = \"$jcenterUrl\";
|
||||
jitpack = \"$jitpackUrl\";
|
||||
maven = \"$mavenUrl\";
|
||||
sonatypeSnapshots = \"$sonatypeSnapshotsUrl\";
|
||||
sonatypePublicGrid = \"$sonatypePublicGridUrl\";
|
||||
sonatypeSnapshots =
|
||||
\"$sonatypeSnapshotsUrl\";
|
||||
sonatypePublicGrid =
|
||||
\"$sonatypePublicGridUrl\";
|
||||
};
|
||||
|
||||
in {"
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
# It also filters out symlinks to result folders created by nix-build, as well as backup/swap/generated files
|
||||
|
||||
let
|
||||
inherit (lib) any compare compareLists elem elemAt hasPrefix length min splitString take;
|
||||
inherit (lib)
|
||||
any compare compareLists elem elemAt hasPrefix length min splitString take;
|
||||
|
||||
isPathAllowed =
|
||||
allowedPath:
|
||||
path:
|
||||
isPathAllowed = allowedPath: path:
|
||||
let
|
||||
count = min (length allowedPathElements) (length pathElements);
|
||||
pathElements = splitString "/" path;
|
||||
|
@ -17,13 +16,12 @@ let
|
|||
allowedPathElementsSubset = take count allowedPathElements;
|
||||
in (compareLists compare allowedPathElementsSubset pathElementsSubset) == 0;
|
||||
|
||||
mkFilter = {
|
||||
dirRootsToInclude, # Relative paths of directories to include
|
||||
mkFilter = { dirRootsToInclude, # Relative paths of directories to include
|
||||
dirsToExclude ? [ ], # Base names of directories to exclude
|
||||
filesToInclude ? [ ], # Relative path of files to include
|
||||
filesToExclude ? [ ], # Relative path of files to exclude
|
||||
root
|
||||
}: path: type:
|
||||
root }:
|
||||
path: type:
|
||||
let
|
||||
baseName = baseNameOf (toString path);
|
||||
subpath = elemAt (splitString "${toString root}/" path) 1;
|
||||
|
|
|
@ -30,11 +30,17 @@ let
|
|||
};
|
||||
tests = [
|
||||
{
|
||||
a = { path = "${absPath}/android/1"; type = "directory"; };
|
||||
a = {
|
||||
path = "${absPath}/android/1";
|
||||
type = "directory";
|
||||
};
|
||||
e = true;
|
||||
}
|
||||
{
|
||||
a = { path = "${absPath}/ios"; type = "directory"; };
|
||||
a = {
|
||||
path = "${absPath}/ios";
|
||||
type = "directory";
|
||||
};
|
||||
e = false;
|
||||
}
|
||||
];
|
||||
|
|
10
shell.nix
10
shell.nix
|
@ -3,8 +3,14 @@
|
|||
target-os ? "none" }:
|
||||
|
||||
let
|
||||
project = import ./default.nix { inherit target-os pkgs nixpkgs-bootstrap; inherit (nixpkgs-bootstrap) config; };
|
||||
mkShell = pkgs.callPackage ./nix/bootstrapped-shell.nix { inherit stdenv target-os; inherit (pkgs) mkShell; };
|
||||
project = import ./default.nix {
|
||||
inherit target-os pkgs nixpkgs-bootstrap;
|
||||
inherit (nixpkgs-bootstrap) config;
|
||||
};
|
||||
mkShell = pkgs.callPackage ./nix/bootstrapped-shell.nix {
|
||||
inherit stdenv target-os;
|
||||
inherit (pkgs) mkShell;
|
||||
};
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue