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 // Run a Nix build to build/fetch everything that is necessary to instantiate shell.nix for TARGET_OS=all
sh ''' sh '''
. ~/.nix-profile/etc/profile.d/nix.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 --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; { meta = with stdenv.lib; {
description = "A tool to automate building and releasing iOS and Android apps"; 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."; 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 // { in fastlane
shellHook = ''
[ -z "$STATUS_REACT_HOME" ] && echo "STATUS_REACT_HOME is empty!" && exit 1
export FASTLANE_PLUGINFILE_PATH=$STATUS_REACT_HOME/fastlane/Pluginfile
'';
}
## This nix file cannot currently be used for iOS due to an error in BUILD TARGET ReactNativeConfig OF PROJECT ReactNativeConfig WITH CONFIGURATION Release ## 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: ## The log shows:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,10 +6,10 @@ with darwin.apple_sdk.frameworks;
assert stdenv.isDarwin; assert stdenv.isDarwin;
let let
inherit (stdenv.lib) concatStrings catAttrs;
baseImage = callPackage ./base-image { }; baseImage = callPackage ./base-image { };
in in {
{
buildInputs = [ buildInputs = [
baseImage status-go.buildInputs baseImage status-go.buildInputs
qt5.full qt5.full
@ -17,8 +17,7 @@ in
]; ];
shellHook = shellHook =
baseImage.shellHook + concatStrings (catAttrs "shellHook" [ baseImage status-go ] ) + ''
status-go.shellHook + ''
export NIX_TARGET_LDFLAGS="-F${CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_TARGET_LDFLAGS" export NIX_TARGET_LDFLAGS="-F${CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_TARGET_LDFLAGS"
export QT_PATH="${qt5.full}" export QT_PATH="${qt5.full}"
export QT_BASEBIN_PATH="${qt5.qtbase.bin}" export QT_BASEBIN_PATH="${qt5.qtbase.bin}"

View File

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

View File

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

View File

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

View File

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