Skip to content
Permalink
Browse files

Reformat libosmium example and build it on CI

  • Loading branch information
nmattia committed Jan 11, 2020
1 parent e58e182 commit b8a4ba73648ee4e6078718dbcd1b1e048e7d7531
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,37 @@
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {
overlays = [
(_: _: { inherit sources; })
(import ./overlay.nix)
];
};
in
with pkgs;

stdenv.mkDerivation {
name = "nix-cpp-demo";
nativeBuildInputs = [ cmake pkgconfig ];
src = pkgs.lib.cleanSource ./.;

# tell Cmake location of all headers
cmakeFlags = [
"-DEXTERNAL_INCLUDE_DIRECTORIES=${stdenv.lib.strings.makeSearchPathOutput "dev" "include" libosmium.buildInputs}"
];

buildInputs = stdenv.lib.lists.concatLists [
# We want to check if dependencies exist using find_package
[
libosmium.buildInputs
]
# dependencies
[
libosmium
]
];

installPhase = ''
mkdir -p $out/bin
cp bin/hello-world $out/bin
'';
}
File renamed without changes.
@@ -19,7 +19,7 @@ let
pkgs.fetchzip { inherit (spec) url sha256; };

fetch_git = spec:
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };

fetch_builtin-tarball = spec:
builtins.trace
@@ -125,12 +125,14 @@ let
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? ./sources.json
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
, pkgs ? mkPkgs sources
}: rec {
# The sources, i.e. the attribute set of spec name to spec
sources = builtins.fromJSON (builtins.readFile sourcesFile);
inherit sources;

# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
pkgs = mkPkgs sources;
inherit pkgs;
};
in
mkSources (mkConfig {}) //
{ __functor = _: settings: mkSources (mkConfig settings); }
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
@@ -1,3 +1,3 @@
self: super: {
libosmium = self.callPackage ./overlay/libosmium.nix {};
}
}
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, protozero, expat, zlib, bzip2, boost, sources ? import ../nix/sources.nix }:
{ stdenv, cmake, protozero, expat, zlib, bzip2, boost, sources }:

stdenv.mkDerivation rec {
name = "libosmium";
@@ -13,10 +13,10 @@ stdenv.mkDerivation rec {
"-DBUILD_TESTING=OFF"
];
buildInputs = [
protozero
protozero
expat
zlib
bzip2
zlib
bzip2
boost
];
}
}
File renamed without changes.
File renamed without changes.

This file was deleted.

@@ -15,6 +15,10 @@ nixargs=(
"--max-jobs" "10"
)

targets=(

)


if [[ ! $OSTYPE =~ darwin ]]; then
echo "Not testing on darwin"
@@ -23,11 +27,11 @@ if [[ ! $OSTYPE =~ darwin ]]; then
else
echo "Testing on darwin"
echo "Not enabling sandbox, not running integration"
nixargs+=("-A" "niv-test")
targets+=("-A" "niv-test")
fi

# Build and create a root
nix-build ${nixargs[@]}
nix-build ${nixargs[@]} ${targets[@]}

echo "Formatting"
if ! nixpkgs-fmt --check . ; then
@@ -36,4 +40,12 @@ if ! nixpkgs-fmt --check . ; then
exit 1
fi

echo "Building examples"
for example in examples/*; do
echo " - $(basename $example)"
pushd $example
nix-build ${nixargs[@]}
popd
done

echo "all good"

0 comments on commit b8a4ba7

Please sign in to comment.
You can’t perform that action at this time.