nix: add shell.nix for CI builds

This currently doesn't work becuase of lack Qml and QtQuick:
```
test.qml:1 module "QtQuick" is not installed
```
https://github.com/NixOS/nixpkgs/issues/51990

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-08-01 09:58:32 +02:00
parent 611598ec71
commit 54c967db3e
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
3 changed files with 68 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.0' library 'status-jenkins-lib@linux-use-nix'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()
@ -72,21 +72,21 @@ pipeline {
stages { stages {
stage('Deps') { stage('Deps') {
steps { steps { script {
sh 'make update' nix.shell('make update', pure: false)
sh 'make deps' nix.shell('make deps', pure: false)
} } }
} }
stage('status-go') { stage('status-go') {
steps { steps { script {
sh 'make status-go' nix.shell('make status-go', pure: false)
} } }
} }
stage('Package') { stage('Package') {
steps { script { steps { script {
linux.bundle('tgz-linux') linux.bundle('tgz-linux', 1)
} } } }
} }

11
nix.conf Normal file
View File

@ -0,0 +1,11 @@
# NOTE: If you are in Asia you might want to add https://nix-cache-cn.status.im/ to extra-substituters
extra-substituters = https://nix-cache.status.im/
substituters = https://cache.nixos.org/
trusted-public-keys = nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
# Some downloads are multiple GB, default is 5 minutes
stalled-download-timeout = 3600
connect-timeout = 10
max-jobs = auto
# Helps avoid removing currently used dependencies via garbage collection
keep-derivations = true
keep-outputs = true

48
shell.nix Normal file
View File

@ -0,0 +1,48 @@
{
source ? builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c140730d40d723c3c74a8d24bceef363495a3aef.zip";
sha256 = "sha256:1bcms35idl4mggickf97z6sydyr8iyjjw93iahhzwczwc42dgs0b";
},
pkgs ? import (source) { }
}:
let
qtCustom = with pkgs.qt515; /* 5.15.8 */
env "qt-custom-${qtbase.version}" ([
qtbase
qtdeclarative
qtlottie
qtmultimedia
qtquickcontrols
qtquickcontrols2
qtsvg
qttools
qtwebengine
]);
in pkgs.mkShell {
name = "status-desktop-build-shell";
buildInputs = with pkgs; [
bash which curl wget git file unzip jq lsb-release
go cmake gnumake pkg-config gnugrep qtCustom
pcre nss pcsclite extra-cmake-modules
xorg.libxcb xorg.libX11 libxkbcommon
] ++ (with gst_all_1; [
gst-libav gstreamer
gst-plugins-bad gst-plugins-base
gst-plugins-good gst-plugins-ugly
]);
# Avoid terminal issues.
TERM = "xterm";
LANG = "en_US.UTF-8";
LANGUAGE = "en_US.UTF-8";
QTDIR = qtCustom;
# https://github.com/NixOS/nixpkgs/pull/109649
QT_INSTALL_PLUGINS = "${qtCustom}/${pkgs.qt515.qtbase.qtPluginPrefix}";
shellHook = ''
export MAKEFLAGS="-j$NIX_BUILD_CORES"
'';
}