diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index b2076f5499e..5ee70246135 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.3' +library 'status-jenkins-lib@linux-use-nix' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() @@ -57,21 +57,21 @@ pipeline { stages { stage('Deps') { - steps { - sh 'make update' - sh 'make deps' - } + steps { script { + nix.shell('make update', pure: false) + nix.shell('make deps', pure: false) + } } } stage('status-go') { - steps { - sh 'make status-go' - } + steps { script { + nix.shell('make status-go', pure: false) + } } } stage('Package') { steps { script { - linux.bundle('tgz-linux') + linux.bundle('tgz-linux', 1) } } } diff --git a/nix.conf b/nix.conf new file mode 100644 index 00000000000..6810dd132a1 --- /dev/null +++ b/nix.conf @@ -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 diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000000..8ef37ec4a3b --- /dev/null +++ b/shell.nix @@ -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 curl wget git file unzip jq lsb-release + 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" + ''; +}