Skip to content

Commit

Permalink
nix: add shell.nix for CI builds
Browse files Browse the repository at this point in the history
This currently doesn't work becuase of lack Qml and QtQuick:
```
test.qml:1 module "QtQuick" is not installed
```
NixOS/nixpkgs#51990

Signed-off-by: Jakub Sokołowski <[email protected]>
  • Loading branch information
jakubgs committed Feb 1, 2023
1 parent fc5dbf0 commit 5d7003f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ci/Jenkinsfile.linux
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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)
} }
}

Expand Down
11 changes: 11 additions & 0 deletions nix.conf
Original file line number Diff line number Diff line change
@@ -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 changes: 48 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -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"
'';
}

0 comments on commit 5d7003f

Please sign in to comment.