1 import ./make-test-python.nix ({ pkgs, lib, ... }:
6 meta.maintainers = [ lib.maintainers.erictapen ];
8 machine = { config, pkgs, ... }:{
15 osrm-data = pkgs.stdenv.mkDerivation {
18 buildInputs = [ pkgs.osrm-backend ];
20 # This is a pbf file of monaco, downloaded at 2019-01-04 from
21 # http://download.geofabrik.de/europe/monaco-latest.osm.pbf
22 # as apparently no provider of OSM files guarantees immutability,
23 # this is hosted as a gist on GitHub.
25 url = "https://gist.github.com/erictapen/01e39f73a6c856eac53ba809a94cdb83";
26 rev = "9b1ff0f24deb40e5cf7df51f843dbe860637b8ce";
27 sha256 = "1scqhmrfnpwsy5i2a9jpggqnvfgj4hv9p4qyvc79321pzkbv59nx";
31 cp $src/${filename}.osm.pbf .
32 ${pkgs.osrm-backend}/bin/osrm-extract -p ${pkgs.osrm-backend}/share/osrm/profiles/car.lua ${filename}.osm.pbf
33 ${pkgs.osrm-backend}/bin/osrm-partition ${filename}.osrm
34 ${pkgs.osrm-backend}/bin/osrm-customize ${filename}.osrm
39 in "${osrm-data}/${filename}.osrm";
42 environment.systemPackages = [ pkgs.jq ];
46 query = "http://localhost:${toString port}/route/v1/driving/7.41720,43.73304;7.42463,43.73886?steps=true";
48 machine.wait_for_unit("osrm.service")
49 machine.wait_for_open_port(${toString port})
50 assert "Boulevard Rainier III" in machine.succeed(
51 "curl --silent '${query}' | jq .waypoints[0].name"
53 assert "Avenue de la Costa" in machine.succeed(
54 "curl --silent '${query}' | jq .waypoints[1].name"