nix: Improve some expressions

This commit is contained in:
Pedro Pombeiro 2019-07-19 20:40:03 +02:00
parent 7230897b94
commit f6527f014e
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
16 changed files with 46 additions and 53 deletions

View File

@ -53,7 +53,7 @@ pipeline {
// Run a Nix build to build/fetch everything that is necessary to instantiate shell.nix for TARGET_OS=all
sh '''
. ~/.nix-profile/etc/profile.d/nix.sh && \
nix-build --pure --no-out-link --show-trace -A shell default.nix
nix-shell --pure --show-trace shell.nix
'''
}
}

View File

@ -22,6 +22,12 @@ let
--set FASTLANE_SKIP_UPDATE_CHECK 1
'';
shellHook = ''
[ -z "$STATUS_REACT_HOME" ] && echo "STATUS_REACT_HOME is empty!" && exit 1
export FASTLANE_PLUGINFILE_PATH=$STATUS_REACT_HOME/fastlane/Pluginfile
'';
meta = with stdenv.lib; {
description = "A tool to automate building and releasing iOS and Android apps";
longDescription = "fastlane is a tool for iOS and Android developers to automate tedious tasks like generating screenshots, dealing with provisioning profiles, and releasing your application.";
@ -33,13 +39,7 @@ let
};
};
in fastlane // {
shellHook = ''
[ -z "$STATUS_REACT_HOME" ] && echo "STATUS_REACT_HOME is empty!" && exit 1
export FASTLANE_PLUGINFILE_PATH=$STATUS_REACT_HOME/fastlane/Pluginfile
'';
}
in fastlane
## This nix file cannot currently be used for iOS due to an error in BUILD TARGET ReactNativeConfig OF PROJECT ReactNativeConfig WITH CONFIGURATION Release
## The log shows:

View File

@ -3,12 +3,13 @@
# as well as define STATUS_REACT_HOME
#
{ stdenv, mkShell, git }:
{ stdenv, mkShell, target-os, git }:
let
shell' = shellAttr:
shellAttr // {
nativeBuildInputs = (shellAttr.nativeBuildInputs or []) ++ [ git ];
TARGET_OS = target-os;
shellHook = ''
set -e

View File

@ -10,7 +10,7 @@ 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; 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;

View File

@ -37,7 +37,7 @@ let
};
in package // {
shellHook = ''
shellHook = (package.shellHook or "") + ''
export QTKEYCHAIN_SOURCES="${package}/src"
'';
}

View File

@ -46,7 +46,7 @@ project( SnoreNotify VERSION ${version} )" \
};
in package // {
shellHook = ''
shellHook = (package.shellHook or "") + ''
export SNORENOTIFY_SOURCES="${package}/src"
'';
}

View File

@ -7,18 +7,19 @@
}:
let
owner = "AppImage";
repo = "AppImageKit";
rev = "b0859501df61cde198b54a317c03b41dbafc98b1";
sha256 = "0qqg79jw9w9rs8c2w3lla4kz62ihafrf7jm370pp1dl8y2i81jzg";
appimagekit_src = fetchFromGitHub {
name = "AppImageKit-source";
owner = "AppImage";
repo = "AppImageKit";
rev = "b0859501df61cde198b54a317c03b41dbafc98b1";
sha256 = "0qqg79jw9w9rs8c2w3lla4kz62ihafrf7jm370pp1dl8y2i81jzg";
name = "${repo}-${stdenv.lib.strings.substring 0 7 rev}-source";
inherit owner repo rev sha256;
};
# squashfuse adapted to nix from cmake experession in "${appimagekit_src}/cmake/dependencies.cmake"
appimagekit_squashfuse = squashfuse.overrideAttrs (attrs: rec {
name = "squashfuse-${version}";
pname = "squashfuse";
version = "20161009";
src = fetchFromGitHub {
@ -60,7 +61,8 @@ let
});
in stdenv.mkDerivation rec {
name = "appimagekit-20180727";
pname = "appimagekit";
version = "20180727";
src = appimagekit_src;

View File

@ -31,7 +31,7 @@ let
};
in package // {
shellHook = ''
shellHook = (package.shellHook or "") + ''
export STATUSREACT_LINUX_BASEIMAGE_PATH="${package}/src"
'';
}

View File

@ -6,6 +6,7 @@ with stdenv;
assert isLinux;
let
inherit (lib) concatStrings catAttrs;
baseImage = callPackage ./base-image { };
appimagekit = callPackage ./appimagekit { };
linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; };
@ -20,8 +21,7 @@ in {
] ++ status-go.buildInputs;
shellHook =
baseImage.shellHook +
status-go.shellHook + ''
concatStrings (catAttrs "shellHook" [ baseImage status-go ] ) + ''
export QT_PATH="${qt5.full}"
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
export PATH="${qt5.full}/bin:$PATH"

View File

@ -3,17 +3,18 @@
with pkgs;
stdenv.mkDerivation rec {
name = "linuxdeployqt";
pname = "linuxdeployqt";
version = "20181215";
owner = "probonopd";
repo = "linuxdeployqt";
rev = "600fc20ea73ee937a402a2bb6b3663d93fcc1d4b";
sha256 = "05kvkfbhsyadlcggl63rhrw5s36d8qxs8gyihrjn2cjk42xx8r7j";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchFromGitHub {
name = "${name}-source";
owner = "probonopd";
repo = "linuxdeployqt";
rev = "600fc20ea73ee937a402a2bb6b3663d93fcc1d4b";
sha256 = "05kvkfbhsyadlcggl63rhrw5s36d8qxs8gyihrjn2cjk42xx8r7j";
name = "${repo}-${stdenv.lib.strings.substring 0 7 rev}-source";
inherit owner repo rev sha256;
}
else throw "${name} is not supported on ${stdenv.hostPlatform.system}";

View File

@ -2,7 +2,7 @@
let
package = stdenv.mkDerivation rec {
name = "StatusImAppBundle";
pname = "StatusImAppBundle";
version = "20190515";
src =
@ -11,7 +11,7 @@ let
url = "https://desktop-app-files.ams3.digitaloceanspaces.com/Status_${version}.app.zip";
sha256 = "1255jgdp0apqh7qfp752nww91iq39x5mm7rf0wazq2vjahfr4pc5";
}
else throw "${name} is not supported on ${stdenv.hostPlatform.system}";
else throw "${pname} is not supported on ${stdenv.hostPlatform.system}";
nativeBuildInputs = [ unzip ];
@ -31,7 +31,7 @@ let
};
in package // {
shellHook = ''
shellHook = (package.shellHook or "") + ''
export STATUSREACT_MACOS_BASEIMAGE_PATH="${package}/src"
'';
}

View File

@ -6,10 +6,10 @@ with darwin.apple_sdk.frameworks;
assert stdenv.isDarwin;
let
inherit (stdenv.lib) concatStrings catAttrs;
baseImage = callPackage ./base-image { };
in
{
in {
buildInputs = [
baseImage status-go.buildInputs
qt5.full
@ -17,8 +17,7 @@ in
];
shellHook =
baseImage.shellHook +
status-go.shellHook + ''
concatStrings (catAttrs "shellHook" [ baseImage status-go ] ) + ''
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}"

View File

@ -4,32 +4,24 @@ assert stdenv.isLinux;
let
package = stdenv.mkDerivation rec {
name = "StatusIm-Windows-base-image";
pname = "StatusIm-Windows-base-image";
version = "20190515";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip";
url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${pname}_${version}.zip";
sha256 = "0wkq0khllms2hnbznb1j8l8yfw6z7phzrdg4ndyik20jkl0faj8f";
}
else throw "${name} is not supported on ${stdenv.hostPlatform.system}";
else throw "${pname} is not supported on ${stdenv.hostPlatform.system}";
nativeBuildInputs = [ unzip ];
phases = [ "unpackPhase" "installPhase" ];
phases = [ "unpackPhase" ];
unpackPhase = ''
mkdir -p $out/src
unzip $src -d $out/src
'';
installPhase = ''
runHook preInstall
echo $out
ls $out -al
runHook postInstall
'';
meta = with stdenv.lib; {
description = "A base image for Windows Status Desktop release distributions";
@ -41,7 +33,7 @@ let
};
in package // {
shellHook = ''
shellHook = (package.shellHook or "") + ''
export STATUSREACT_WINDOWS_BASEIMAGE_PATH="${package}/src"
'';
}

View File

@ -6,8 +6,7 @@ assert stdenv.isLinux;
let
baseImage = callPackage ./base-image { };
in
{
in {
buildInputs = stdenv.lib.optionals stdenv.isLinux [
conan
nsis

View File

@ -10,7 +10,7 @@ let
platform = callPackage ../../platform.nix { inherit target-os; };
in buildGoPackage rec {
name = "gomobile-${version}";
pname = "gomobile";
version = "20190319-${strings.substring 0 7 rev}";
rev = "167ebed0ec6dd457a6b24a4f61db913f0af11f70";
sha256 = "0lspdhikhnhbwv8v0q6fs3a0pd9sjnhkpg8z03m2dc5h6f84m38w";

View File

@ -4,7 +4,7 @@
let
project = import ./default.nix { inherit target-os pkgs nixpkgs-bootstrap; inherit (nixpkgs-bootstrap) config; };
mkShell = pkgs.callPackage ./nix/bootstrapped-shell.nix { inherit stdenv; inherit (pkgs) mkShell; };
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;
@ -30,6 +30,5 @@ in mkShell {
watchman
];
inputsFrom = [ project.shell ];
TARGET_OS = target-os;
shellHook = project.shell.shellHook;
}