proj: add package tests

Add simple package test by running proj CLI tool.

This change also improves derivation overriding behavior by using
`finalAttrs` function.

Co-authored-by: Robert Scott <github@humanleg.org.uk>
This commit is contained in:
Ivan Mincik 2022-12-12 13:11:48 +01:00
parent ae11c6f4e5
commit 44daadff50
2 changed files with 15 additions and 2 deletions

View File

@ -5,6 +5,7 @@
, cmake
, pkg-config
, buildPackages
, callPackage
, sqlite
, libtiff
, curl
@ -13,7 +14,7 @@
, python3
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
pname = "proj";
version = "9.1.1";
@ -62,6 +63,7 @@ stdenv.mkDerivation rec {
passthru.tests = {
python = python3.pkgs.pyproj;
proj = callPackage ./tests.nix { proj = finalAttrs.finalPackage; };
};
meta = with lib; {
@ -71,4 +73,4 @@ stdenv.mkDerivation rec {
platforms = platforms.unix;
maintainers = with maintainers; [ dotlambda ];
};
}
})

View File

@ -0,0 +1,11 @@
{ runCommand, proj }:
let
inherit (proj) pname;
in
runCommand "${pname}-tests" { meta.timeout = 60; }
''
${proj}/bin/projinfo EPSG:4326 \
| grep '+proj=longlat +datum=WGS84 +no_defs +type=crs'
touch $out
''