Add check to nix flake: compile C library with gcc and clang

This commit is contained in:
Hubert Chathi 2022-05-12 17:05:22 -04:00
parent a4a700739e
commit e116efa752

View file

@ -12,7 +12,10 @@
outputs = { self, nixpkgs, flake-utils, npmlock2nix }: outputs = { self, nixpkgs, flake-utils, npmlock2nix }:
( (
flake-utils.lib.eachDefaultSystem (system: # some systems cause issues, e.g. i686-linux is unsupported by gradle,
# which causes "nix flake check" to fail. Investigate more later, but for
# now, we will just allow x86_64-linux
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
@ -25,6 +28,64 @@
node_modules = pkgs.npmlock2nix.node_modules { src = ./javascript; }; node_modules = pkgs.npmlock2nix.node_modules { src = ./javascript; };
in in
rec { rec {
checks.gcc-cmake = pkgs.stdenv.mkDerivation {
name = "olm";
buildInputs = with pkgs; [ gcc cmake ];
src = ./.;
buildPhase = ''
cmake . -Bbuild
cmake --build build
'';
checkPhase = ''
cd build/tests
ctest .
cd ../..
'';
};
checks.clang-cmake = pkgs.stdenv.mkDerivation {
name = "olm";
buildInputs = with pkgs; [ clang cmake ];
src = ./.;
buildPhase = ''
cmake . -Bbuild
cmake --build build
'';
checkPhase = ''
cd build/tests
ctest .
cd ../..
'';
};
checks.gcc-make = pkgs.stdenv.mkDerivation {
name = "olm";
buildInputs = with pkgs; [ gcc gnumake ];
src = ./.;
buildPhase = ''
make
'';
checkPhase = ''
make test
'';
installPhase = ''
make install PREFIX=$out
'';
};
packages.javascript = pkgs.buildEmscriptenPackage { packages.javascript = pkgs.buildEmscriptenPackage {
pname = "olm"; pname = "olm";
inherit (builtins.fromJSON (builtins.readFile ./javascript/package.json)) version; inherit (builtins.fromJSON (builtins.readFile ./javascript/package.json)) version;