Port nix CI to flakes
Change bscpkgs repo url to sourcehut
This commit is contained in:
parent
b6903bc445
commit
d100b42e5a
@ -14,44 +14,44 @@ build:debian-testing:
|
||||
paths:
|
||||
- install/
|
||||
|
||||
build:rt-tests:
|
||||
build:local:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link --tarball-ttl 0 --file nix/rt.nix bsc.ovni-rt
|
||||
- nix build -L --no-link .#ovniPackages.local
|
||||
|
||||
build:rt:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link .#ovniPackages.rt
|
||||
|
||||
build:debug:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link .#ovniPackages.debug
|
||||
|
||||
build:asan:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link --tarball-ttl 0 --file nix/rt.nix bsc.ovni-asan
|
||||
- nix build -L --no-link .#ovniPackages.asan
|
||||
|
||||
build:no-mpi:
|
||||
build:nompi:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link --tarball-ttl 0 --file nix/rt.nix bsc.ovni-nompi
|
||||
- nix build -L --no-link .#ovniPackages.nompi
|
||||
|
||||
build:old-gcc:
|
||||
build:compilers:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link --tarball-ttl 0 --file nix/rt.nix bsc.oldOvnis
|
||||
|
||||
build:old-gcc-no-lto:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link --tarball-ttl 0 --file nix/rt.nix bsc.oldOvnisNoLTO
|
||||
|
||||
build:old-gcc-release:
|
||||
stage: build
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L --no-link --tarball-ttl 0 --file nix/rt.nix bsc.oldOvnisRelease
|
||||
- nix build -L --no-link .#ovniPackages.compilers
|
||||
|
45
flake.lock
Normal file
45
flake.lock
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"nodes": {
|
||||
"bscpkgs": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1696596732,
|
||||
"narHash": "sha256-9kvkzMo6X1PyDpPfmPsEBZrMOIWqvEFNoa/3n5i37fI=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "91cdc91738cbe7df4e283d31cf0fff74a31cdd1d",
|
||||
"revCount": 892,
|
||||
"type": "git",
|
||||
"url": "https://git.sr.ht/~rodarima/bscpkgs"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.sr.ht/~rodarima/bscpkgs"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1693663421,
|
||||
"narHash": "sha256-ImMIlWE/idjcZAfxKK8sQA7A1Gi/O58u5/CJA+mxvl8=",
|
||||
"path": "/nix/store/wl5m5xfayd69ycyspzyd4rilfgl6wmh0-source",
|
||||
"rev": "e56990880811a451abd32515698c712788be5720",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"bscpkgs": "bscpkgs",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
89
flake.nix
Normal file
89
flake.nix
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
inputs.nixpkgs.url = "nixpkgs";
|
||||
inputs.bscpkgs.url = "git+https://git.sr.ht/~rodarima/bscpkgs";
|
||||
inputs.bscpkgs.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
nixConfig.bash-prompt = "\[nix-develop\]$ ";
|
||||
|
||||
outputs = { self, nixpkgs, bscpkgs }:
|
||||
let
|
||||
pkgs = bscpkgs.outputs.legacyPackages.x86_64-linux;
|
||||
compilerList = with pkgs; [
|
||||
#gcc49Stdenv # broken
|
||||
gcc6Stdenv
|
||||
gcc7Stdenv
|
||||
gcc8Stdenv
|
||||
gcc9Stdenv
|
||||
gcc10Stdenv
|
||||
gcc11Stdenv
|
||||
gcc12Stdenv
|
||||
gcc13Stdenv
|
||||
];
|
||||
lib = pkgs.lib;
|
||||
in {
|
||||
packages.x86_64-linux.ovniPackages = rec {
|
||||
# Build with the current source
|
||||
local = pkgs.ovni.overrideAttrs (old: {
|
||||
pname = "ovni-local";
|
||||
src = self;
|
||||
});
|
||||
|
||||
# Build in Debug mode
|
||||
debug = local.overrideAttrs (old: {
|
||||
pname = "ovni-debug";
|
||||
cmakeBuildType = "Debug";
|
||||
});
|
||||
|
||||
# Without MPI
|
||||
nompi = local.overrideAttrs (old: {
|
||||
pname = "ovni-nompi";
|
||||
buildInputs = lib.filter (x: x != pkgs.mpi ) old.buildInputs;
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DUSE_MPI=OFF" ];
|
||||
});
|
||||
|
||||
# Helper function to build with different compilers
|
||||
genOvniCC = stdenv: (local.override {
|
||||
stdenv = stdenv;
|
||||
}).overrideAttrs (old: {
|
||||
name = "ovni-gcc" + stdenv.cc.cc.version;
|
||||
cmakeFlags = old.cmakeFlags ++ [
|
||||
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF"
|
||||
];
|
||||
});
|
||||
|
||||
# Test several gcc versions
|
||||
compilers = let
|
||||
drvs = map genOvniCC compilerList;
|
||||
in pkgs.runCommand "ovni-compilers" { } ''
|
||||
printf "%s\n" ${builtins.toString drvs} > $out
|
||||
'';
|
||||
|
||||
# Enable RT tests
|
||||
rt = (local.override {
|
||||
# Provide the clang compiler as default
|
||||
stdenv = pkgs.stdenvClangOmpss2;
|
||||
}).overrideAttrs (old: {
|
||||
pname = "ovni-rt";
|
||||
# We need to be able to exit the chroot to run Nanos6 tests, as they
|
||||
# require access to /sys for hwloc
|
||||
__noChroot = true;
|
||||
buildInputs = old.buildInputs ++ (with pkgs; [ nosv nanos6 nodes ]);
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DENABLE_ALL_TESTS=ON" ];
|
||||
preConfigure = old.preConfigure or "" + ''
|
||||
export NODES_HOME="${pkgs.nodes}"
|
||||
export NANOS6_HOME="${pkgs.nanos6}"
|
||||
'';
|
||||
});
|
||||
|
||||
# Build with ASAN and pass RT tests
|
||||
asan = rt.overrideAttrs (old: {
|
||||
pname = "ovni-asan";
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DCMAKE_BUILD_TYPE=Asan" ];
|
||||
# Ignore leaks in tests for now, only check memory errors
|
||||
preCheck = old.preCheck + ''
|
||||
export ASAN_OPTIONS=detect_leaks=0
|
||||
'';
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
33
nix/ovni.nix
33
nix/ovni.nix
@ -1,33 +0,0 @@
|
||||
{
|
||||
stdenv
|
||||
, cmake
|
||||
, mpi
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ovni";
|
||||
|
||||
buildInputs = [ cmake mpi ];
|
||||
|
||||
# Prevent accidental reutilization of previous builds, as we are taking the
|
||||
# current directory as-is
|
||||
preConfigure = ''
|
||||
rm -rf build install
|
||||
|
||||
# There is no /bin/bash
|
||||
patchShebangs test/*.sh
|
||||
'';
|
||||
|
||||
cmakeBuildType = "Debug";
|
||||
cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
|
||||
buildFlags = [ "VERBOSE=1" ];
|
||||
preCheck = ''
|
||||
export CTEST_OUTPUT_ON_FAILURE=1
|
||||
'';
|
||||
dontStrip = true;
|
||||
doCheck = true;
|
||||
checkTarget = "test";
|
||||
hardeningDisable = [ "all" ];
|
||||
|
||||
src = ../.;
|
||||
}
|
103
nix/rt.nix
103
nix/rt.nix
@ -1,103 +0,0 @@
|
||||
let
|
||||
pkgs = import (builtins.fetchTarball
|
||||
"https://pm.bsc.es/gitlab/rarias/bscpkgs/-/archive/master/bscpkgs-master.tar.gz");
|
||||
|
||||
rWrapper = pkgs.rWrapper.override {
|
||||
packages = with pkgs.rPackages; [ tidyverse rjson jsonlite egg viridis ];
|
||||
};
|
||||
|
||||
# Recursively set MPI
|
||||
bsc = pkgs.bsc.extend (last: prev: {
|
||||
|
||||
include-what-you-use = let
|
||||
gcc = pkgs.gcc;
|
||||
targetConfig = pkgs.stdenv.targetPlatform.config;
|
||||
in pkgs.wrapCCWith rec {
|
||||
cc = pkgs.include-what-you-use;
|
||||
extraBuildCommands = ''
|
||||
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
|
||||
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
|
||||
echo "-isystem${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}/include" >> $out/nix-support/cc-cflags
|
||||
wrap include-what-you-use $wrapper $ccPath/include-what-you-use
|
||||
substituteInPlace "$out/bin/include-what-you-use" --replace 'dontLink=0' 'dontLink=1'
|
||||
'';
|
||||
};
|
||||
|
||||
ovni-local = last.callPackage ./ovni.nix { };
|
||||
|
||||
# Build ovni with old gcc versions
|
||||
genOldOvni = stdenv: (last.ovni-local.override {
|
||||
stdenv = stdenv;
|
||||
}).overrideAttrs (old: {
|
||||
pname = old.name + "@" + stdenv.cc.cc.version;
|
||||
cmakeFlags = old.cmakeFlags ++ [
|
||||
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF"
|
||||
];
|
||||
});
|
||||
|
||||
oldCompilers = [
|
||||
#pkgs.gcc49Stdenv # broken
|
||||
pkgs.gcc6Stdenv
|
||||
pkgs.gcc7Stdenv
|
||||
pkgs.gcc8Stdenv
|
||||
pkgs.gcc9Stdenv
|
||||
pkgs.gcc10Stdenv
|
||||
pkgs.gcc11Stdenv
|
||||
pkgs.gcc12Stdenv
|
||||
];
|
||||
|
||||
oldOvnis = map last.genOldOvni last.oldCompilers;
|
||||
|
||||
genOldOvniNoLTO = stdenv: (last.genOldOvni stdenv).overrideAttrs (old: {
|
||||
cmakeFlags = old.cmakeFlags ++ [
|
||||
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF"
|
||||
];
|
||||
});
|
||||
|
||||
oldOvnisNoLTO = map last.genOldOvniNoLTO last.oldCompilers;
|
||||
|
||||
genOldOvniRelease = stdenv: (last.genOldOvni stdenv).overrideAttrs (old: {
|
||||
cmakeBuildType = "Release";
|
||||
});
|
||||
|
||||
oldOvnisRelease = map last.genOldOvniRelease last.oldCompilers;
|
||||
|
||||
ovni-nompi = last.ovni-local.overrideAttrs (old: {
|
||||
buildInputs = pkgs.lib.filter (x: x != last.mpi ) old.buildInputs;
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DUSE_MPI=OFF" ];
|
||||
});
|
||||
|
||||
# Now we rebuild ovni with the Nanos6 and nOS-V versions, which were
|
||||
# linked to the previous ovni. We need to be able to exit the chroot
|
||||
# to run Nanos6 tests, as they require access to /sys for hwloc
|
||||
ovni-rt = (last.ovni-local.override {
|
||||
stdenv = last.stdenvClangOmpss2;
|
||||
}).overrideAttrs (old: {
|
||||
__noChroot = true;
|
||||
buildInputs = old.buildInputs ++ [
|
||||
last.include-what-you-use
|
||||
pkgs.gdb
|
||||
last.nosv
|
||||
last.nanos6
|
||||
last.nodes
|
||||
pkgs.strace
|
||||
];
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DENABLE_ALL_TESTS=ON" ];
|
||||
preConfigure = old.preConfigure + ''
|
||||
export NODES_HOME="${last.nodes}"
|
||||
export NANOS6_HOME="${last.nanos6}"
|
||||
'';
|
||||
});
|
||||
|
||||
ovni-asan = last.ovni-rt.overrideAttrs (old: {
|
||||
cmakeFlags = old.cmakeFlags ++ [ "-DCMAKE_BUILD_TYPE=Asan" ];
|
||||
# Ignore leaks in tests for now, only check memory errors
|
||||
preCheck = old.preCheck + ''
|
||||
export ASAN_OPTIONS=detect_leaks=0
|
||||
'';
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
in
|
||||
pkgs // { bsc = bsc; }
|
Loading…
Reference in New Issue
Block a user