From ce9a68fc7eff1784a22353fea8a618a9a1fa134a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 13 Jan 2022 13:17:32 +0100 Subject: [PATCH] Simplify nix-build and enable verbose tests --- .gitlab-ci.yml | 4 ++-- nix/old-glibc.nix | 33 ++++++++++++++++++++++++++ nix/shell-glibc-2.26.nix | 50 ---------------------------------------- 3 files changed, 35 insertions(+), 52 deletions(-) create mode 100644 nix/old-glibc.nix delete mode 100644 nix/shell-glibc-2.26.nix diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10ae14c..a4d72cb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,8 +12,8 @@ build:debian-latest: paths: - install/ -build:nixpkgs-glibc-2.26: +build:old-glibc: image: nixos/nix:latest stage: build script: - - nix-build nix/shell-glibc-2.26.nix -A ovni + - nix-build nix/old-glibc.nix diff --git a/nix/old-glibc.nix b/nix/old-glibc.nix new file mode 100644 index 0000000..ac9517a --- /dev/null +++ b/nix/old-glibc.nix @@ -0,0 +1,33 @@ +# Build with `nix-build nix/old-glibc.nix` +let + # Define the set of packages from the old 2018.03 nixos release, so we get a + # glibc 2.26 which doesn't define the gettid() function, and one of the lowest + # cmake versions supported (3.10.2). + url = "https://github.com/NixOS/nixpkgs/archive/3e1be2206b4c1eb3299fb633b8ce9f5ac1c32898.tar.gz"; + pkgs = import (builtins.fetchTarball { inherit url; }) {}; + +in + + with pkgs; + + stdenv.mkDerivation rec { + name = "ovni"; + + buildInputs = [ cmake openmpi ]; + + # Prevent accidental reutilization of previous builds, as we are taking the + # current directory as-is + preConfigure = '' + rm -rf build install + ''; + + cmakeBuildType = "Debug"; + cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ]; + buildFlags = [ "VERBOSE=1" ]; + checkFlags = [ "CTEST_OUTPUT_ON_FAILURE=1" "ARGS=-V" ]; + dontStrip = true; + doCheck = true; + checkTarget = "test"; + + src = ../.; + } diff --git a/nix/shell-glibc-2.26.nix b/nix/shell-glibc-2.26.nix deleted file mode 100644 index b879ccb..0000000 --- a/nix/shell-glibc-2.26.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs ? import ( - builtins.fetchTarball { - # Use nixpkgs 18.03 with old glibc and cmake - url = "https://github.com/NixOS/nixpkgs/archive/3e1be2206b4c1eb3299fb633b8ce9f5ac1c32898.tar.gz"; - } - ) {} - -# By default use debug -, enableDebug ? true -}: - -with pkgs; - -{ - ovni = stdenv.mkDerivation rec { - name = "ovni"; - - buildInputs = [ cmake openmpi ]; - - cmakeBuildType = if (enableDebug) then "Debug" else "Release"; - cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ]; - buildFlags = [ "VERBOSE=1" ]; - checkFlags = [ "CTEST_OUTPUT_ON_FAILURE=1" ]; - dontStrip = true; - doCheck = true; - checkTarget = "test"; - - src = ../.; - }; - - shell = pkgs.mkShell { - nativeBuildInputs = [ cmake openmpi ]; - NIX_ENFORCE_PURITY = 0; - shellHook = '' - set -e - curdir=$(pwd) - rm -rf build install - mkdir build install - cd build - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DENABLE_DEBUG_LOG=ON \ - -DCMAKE_INSTALL_PREFIX="$curdir/install" .. - make VERBOSE=1 - make test CTEST_OUTPUT_ON_FAILURE=1 - make install - exit 0 - ''; - }; -}