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
|
@ -8,7 +8,7 @@
|
||||||
let
|
let
|
||||||
shell' = shellAttr:
|
shell' = shellAttr:
|
||||||
shellAttr // {
|
shellAttr // {
|
||||||
nativeBuildInputs = (shellAttr.nativeBuildInputs or []) ++ [ git ];
|
nativeBuildInputs = (shellAttr.nativeBuildInputs or [ ]) ++ [ git ];
|
||||||
TARGET_OS = target-os;
|
TARGET_OS = target-os;
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
set -e
|
set -e
|
||||||
|
@ -27,6 +27,7 @@ let
|
||||||
};
|
};
|
||||||
# Declare a specialized mkShell function which adds some bootstrapping
|
# Declare a specialized mkShell function which adds some bootstrapping
|
||||||
# so that e.g. STATUS_REACT_HOME is automatically available in the shell
|
# 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'
|
in mkShell'
|
||||||
|
|
|
@ -10,7 +10,10 @@ let
|
||||||
platform = pkgs.callPackage ./platform.nix { inherit target-os; };
|
platform = pkgs.callPackage ./platform.nix { inherit target-os; };
|
||||||
# Declare a specialized mkShell function which adds some bootstrapping
|
# Declare a specialized mkShell function which adds some bootstrapping
|
||||||
# so that e.g. STATUS_REACT_HOME is automatically available in the shell
|
# 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)
|
# 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;
|
||||||
maven = pkgs.maven;
|
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; };
|
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 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; };
|
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;
|
nodejs = pkgs.nodejs-10_x;
|
||||||
yarn = pkgs.yarn.override { inherit nodejs; };
|
yarn = pkgs.yarn.override { inherit nodejs; };
|
||||||
selectedSources =
|
selectedSources =
|
||||||
|
@ -54,11 +60,10 @@ in {
|
||||||
|
|
||||||
shell = {
|
shell = {
|
||||||
buildInputs = unique ([
|
buildInputs = unique ([
|
||||||
nodejs
|
nodejs
|
||||||
pkgs.python27 # for e.g. gyp
|
pkgs.python27 # for e.g. gyp
|
||||||
yarn
|
yarn
|
||||||
]
|
] ++ optional isDarwin pkgs.cocoapods
|
||||||
++ optional isDarwin pkgs.cocoapods
|
|
||||||
++ optional (isDarwin && !platform.targetIOS) pkgs.clang
|
++ optional (isDarwin && !platform.targetIOS) pkgs.clang
|
||||||
++ optional (!isDarwin) pkgs.gcc8
|
++ optional (!isDarwin) pkgs.gcc8
|
||||||
++ catAttrs "buildInputs" selectedSources);
|
++ catAttrs "buildInputs" selectedSources);
|
||||||
|
|
|
@ -11,10 +11,14 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
baseImage status-go.buildInputs
|
baseImage
|
||||||
qt5.full
|
qt5.full
|
||||||
AppKit Cocoa darwin.cf-private Foundation OpenGL
|
AppKit
|
||||||
];
|
Cocoa
|
||||||
|
darwin.cf-private
|
||||||
|
Foundation
|
||||||
|
OpenGL
|
||||||
|
] ++ status-go.buildInputs;
|
||||||
|
|
||||||
shellHook =
|
shellHook =
|
||||||
concatStrings (catAttrs "shellHook" [ baseImage status-go ] ) + ''
|
concatStrings (catAttrs "shellHook" [ baseImage status-go ] ) + ''
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,15 +46,16 @@ let
|
||||||
echo -e "\n33b6a2b64607f11b759f320ef9dff4ae5c47d97a" > "$out/licenses/google-gdk-license"
|
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 JAVA_HOME="${openjdk}"
|
||||||
export ANDROID_SDK_ROOT="$ANDROID_HOME"
|
export ANDROID_HOME="${licensedAndroidEnv}"
|
||||||
export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle"
|
export ANDROID_SDK_ROOT="$ANDROID_HOME"
|
||||||
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"
|
export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle"
|
||||||
export ANDROID_NDK="$ANDROID_NDK_ROOT"
|
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"
|
||||||
export PATH="$ANDROID_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools:$PATH"
|
export ANDROID_NDK="$ANDROID_NDK_ROOT"
|
||||||
'';
|
export PATH="$ANDROID_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools:$PATH"
|
||||||
|
'';
|
||||||
|
|
||||||
in {
|
in {
|
||||||
inherit androidComposition licensedAndroidEnv shellHook;
|
inherit androidComposition licensedAndroidEnv shellHook;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,17 +7,21 @@ let
|
||||||
platform = callPackage ../../platform.nix { inherit target-os; };
|
platform = callPackage ../../platform.nix { inherit target-os; };
|
||||||
useFastlanePkg = platform.targetAndroid && !stdenv.isDarwin;
|
useFastlanePkg = platform.targetAndroid && !stdenv.isDarwin;
|
||||||
fastlane = callPackage ../../../fastlane {
|
fastlane = callPackage ../../../fastlane {
|
||||||
bundlerEnv = _: bundlerEnv {
|
bundlerEnv = _:
|
||||||
name = "fastlane-gems";
|
bundlerEnv {
|
||||||
gemdir = ../../../fastlane;
|
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;
|
shellHook = optionalString useFastlanePkg fastlane.shellHook;
|
||||||
|
|
||||||
# TARGETS
|
# TARGETS
|
||||||
shell = mkShell {
|
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;
|
inherit shellHook;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
name = "nixpkgs-source";
|
name = "nixpkgs-source";
|
||||||
})) { inherit config; } }:
|
})) { inherit config; } }:
|
||||||
|
|
||||||
{
|
{
|
||||||
inherit pkgs config;
|
inherit pkgs config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,16 @@
|
||||||
|
|
||||||
# We allow for "none" value because `make shell` can be called with `TARGET_OS` not set.
|
# 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.
|
# 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
|
let
|
||||||
inherit (stdenv) isDarwin isLinux;
|
inherit (stdenv) isDarwin isLinux;
|
||||||
|
|
|
@ -45,7 +45,7 @@ else
|
||||||
echo -e "See nix/README.md for more details."
|
echo -e "See nix/README.md for more details."
|
||||||
fi
|
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,
|
# This is a dirty workaround because 'yarn install' is an impure operation,
|
||||||
# so we need to call it from an impure shell.
|
# so we need to call it from an impure shell.
|
||||||
# Hopefull we'll be able to fix this later on with something like yarn2nix
|
# Hopefull we'll be able to fix this later on with something like yarn2nix
|
||||||
|
|
|
@ -10,9 +10,16 @@
|
||||||
hostSystem } @ args':
|
hostSystem } @ args':
|
||||||
|
|
||||||
let
|
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 // {
|
buildStatusGoDesktopLib = buildStatusGo (args // {
|
||||||
buildMessage = "Building desktop library";
|
buildMessage = "Building desktop library";
|
||||||
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
||||||
|
@ -32,9 +39,7 @@ let
|
||||||
|
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
|
|
||||||
meta = {
|
meta = { platforms = with stdenv.lib.platforms; linux ++ darwin; };
|
||||||
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
in buildStatusGoDesktopLib
|
in buildStatusGoDesktopLib
|
|
@ -78,9 +78,7 @@ let
|
||||||
return
|
return
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = { inherit owner version rev; };
|
||||||
inherit owner version rev;
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
# Add default meta information
|
# Add default meta information
|
||||||
|
@ -89,8 +87,7 @@ let
|
||||||
license = lib.licenses.mpl20;
|
license = lib.licenses.mpl20;
|
||||||
} // meta // {
|
} // meta // {
|
||||||
# add an extra maintainer to every package
|
# add an extra maintainer to every package
|
||||||
maintainers = (meta.maintainers or []) ++
|
maintainers = (meta.maintainers or [ ]) ++ [ lib.maintainers.pombeirp ];
|
||||||
[ lib.maintainers.pombeirp ];
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,16 @@ let
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = if target-os == "android" then android.buildInputs else
|
buildInputs = if target-os == "android" then
|
||||||
if target-os == "ios" then ios.buildInputs else
|
android.buildInputs
|
||||||
if target-os == "all" then currentHostConfig.allTargets else
|
else if target-os == "ios" then
|
||||||
if platform.targetDesktop then desktop.buildInputs else
|
ios.buildInputs
|
||||||
throw "Unexpected target platform ${target-os}";
|
else if target-os == "all" then
|
||||||
|
currentHostConfig.allTargets
|
||||||
|
else if platform.targetDesktop then
|
||||||
|
desktop.buildInputs
|
||||||
|
else
|
||||||
|
throw "Unexpected target platform ${target-os}";
|
||||||
android = {
|
android = {
|
||||||
buildInputs = optional platform.targetAndroid [ status-go-packages.android ];
|
buildInputs = optional platform.targetAndroid [ status-go-packages.android ];
|
||||||
shellHook =
|
shellHook =
|
||||||
|
|
|
@ -85,9 +85,11 @@ function writeEntry() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n " \"$depurl\" = {
|
echo -n " \"$depurl\" =
|
||||||
|
{
|
||||||
host = repositories.$host;
|
host = repositories.$host;
|
||||||
path = \"$deppath\";
|
path =
|
||||||
|
\"$deppath\";
|
||||||
type = \"$type\";"
|
type = \"$type\";"
|
||||||
if [ -n "$pom_sha256" ]; then
|
if [ -n "$pom_sha256" ]; then
|
||||||
echo -n "
|
echo -n "
|
||||||
|
@ -112,7 +114,7 @@ currentLine=0
|
||||||
pstr="[=======================================================================]"
|
pstr="[=======================================================================]"
|
||||||
|
|
||||||
echo "# Auto-generated by $(realpath --relative-to="$(dirname $1)" ${BASH_SOURCE})
|
echo "# Auto-generated by $(realpath --relative-to="$(dirname $1)" ${BASH_SOURCE})
|
||||||
{}:
|
{ }:
|
||||||
|
|
||||||
let
|
let
|
||||||
repositories = {
|
repositories = {
|
||||||
|
@ -126,8 +128,10 @@ let
|
||||||
jcenter = \"$jcenterUrl\";
|
jcenter = \"$jcenterUrl\";
|
||||||
jitpack = \"$jitpackUrl\";
|
jitpack = \"$jitpackUrl\";
|
||||||
maven = \"$mavenUrl\";
|
maven = \"$mavenUrl\";
|
||||||
sonatypeSnapshots = \"$sonatypeSnapshotsUrl\";
|
sonatypeSnapshots =
|
||||||
sonatypePublicGrid = \"$sonatypePublicGridUrl\";
|
\"$sonatypeSnapshotsUrl\";
|
||||||
|
sonatypePublicGrid =
|
||||||
|
\"$sonatypePublicGridUrl\";
|
||||||
};
|
};
|
||||||
|
|
||||||
in {"
|
in {"
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
# It also filters out symlinks to result folders created by nix-build, as well as backup/swap/generated files
|
# It also filters out symlinks to result folders created by nix-build, as well as backup/swap/generated files
|
||||||
|
|
||||||
let
|
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 =
|
isPathAllowed = allowedPath: path:
|
||||||
allowedPath:
|
|
||||||
path:
|
|
||||||
let
|
let
|
||||||
count = min (length allowedPathElements) (length pathElements);
|
count = min (length allowedPathElements) (length pathElements);
|
||||||
pathElements = splitString "/" path;
|
pathElements = splitString "/" path;
|
||||||
|
@ -17,13 +16,12 @@ let
|
||||||
allowedPathElementsSubset = take count allowedPathElements;
|
allowedPathElementsSubset = take count allowedPathElements;
|
||||||
in (compareLists compare allowedPathElementsSubset pathElementsSubset) == 0;
|
in (compareLists compare allowedPathElementsSubset pathElementsSubset) == 0;
|
||||||
|
|
||||||
mkFilter = {
|
mkFilter = { dirRootsToInclude, # Relative paths of directories to include
|
||||||
dirRootsToInclude, # Relative paths of directories to include
|
dirsToExclude ? [ ], # Base names of directories to exclude
|
||||||
dirsToExclude ? [], # Base names of directories to exclude
|
filesToInclude ? [ ], # Relative path of files to include
|
||||||
filesToInclude ? [], # Relative path of files to include
|
filesToExclude ? [ ], # Relative path of files to exclude
|
||||||
filesToExclude ? [], # Relative path of files to exclude
|
root }:
|
||||||
root
|
path: type:
|
||||||
}: path: type:
|
|
||||||
let
|
let
|
||||||
baseName = baseNameOf (toString path);
|
baseName = baseNameOf (toString path);
|
||||||
subpath = elemAt (splitString "${toString root}/" path) 1;
|
subpath = elemAt (splitString "${toString root}/" path) 1;
|
||||||
|
|
|
@ -30,11 +30,17 @@ let
|
||||||
};
|
};
|
||||||
tests = [
|
tests = [
|
||||||
{
|
{
|
||||||
a = { path = "${absPath}/android/1"; type = "directory"; };
|
a = {
|
||||||
|
path = "${absPath}/android/1";
|
||||||
|
type = "directory";
|
||||||
|
};
|
||||||
e = true;
|
e = true;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
a = { path = "${absPath}/ios"; type = "directory"; };
|
a = {
|
||||||
|
path = "${absPath}/ios";
|
||||||
|
type = "directory";
|
||||||
|
};
|
||||||
e = false;
|
e = false;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
RED = "\\033[0;31m";
|
RED = "\\033[0;31m";
|
||||||
GREEN="\\033[0;32m";
|
GREEN = "\\033[0;32m";
|
||||||
NC = "\\033[0m";
|
NC = "\\033[0m";
|
||||||
_xcodeToolsTest = ''
|
_xcodeToolsTest = ''
|
||||||
xcode=0
|
xcode=0
|
||||||
|
|
10
shell.nix
10
shell.nix
|
@ -3,8 +3,14 @@
|
||||||
target-os ? "none" }:
|
target-os ? "none" }:
|
||||||
|
|
||||||
let
|
let
|
||||||
project = import ./default.nix { inherit target-os pkgs nixpkgs-bootstrap; inherit (nixpkgs-bootstrap) config; };
|
project = import ./default.nix {
|
||||||
mkShell = pkgs.callPackage ./nix/bootstrapped-shell.nix { inherit stdenv target-os; inherit (pkgs) mkShell; };
|
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; };
|
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)
|
# 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;
|
||||||
|
|
Loading…
Reference in New Issue