prop/nix/wgrib2.nix
Graham McIntire b8a255ac91
Some checks failed
Build and Push / Build and Push Docker Image (push) Failing after 13m8s
fix: add wgrib2 nix derivation and DataCase Req.Test shared mode
- nix/wgrib2.nix: build wgrib2 3.8.0 from source with NCEPLIBS-g2c 2.3.0,
  matching the Dockerfile.base build.
- flake.nix: wire wgrib2 derivation into dev shell so direnv loads it.
- DataCase: call Req.Test.set_req_test_from_context/1 in setup so
  async:false tests get shared Req.Test mode, making stubs visible
  to Tasks spawned by async_stream_nolink.
2026-08-04 13:50:18 -05:00

90 lines
1.5 KiB
Nix

{
stdenv,
lib,
cmake,
gfortran,
zlib,
libaec,
libpng,
openjpeg,
pkg-config,
fetchFromGitHub,
fetchurl,
}:
let
g2cVersion = "2.3.0";
g2c = stdenv.mkDerivation {
pname = "nceplibs-g2c";
version = g2cVersion;
src = fetchFromGitHub {
owner = "NOAA-EMC";
repo = "NCEPLIBS-g2c";
rev = "v${g2cVersion}";
hash = "sha256-9z0QipDqX5e/IgcK6y0q9ovja5jxwszLbWNUQQBIsss=";
};
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
zlib
libaec
libpng
openjpeg
];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DUSE_PNG=ON"
"-DUSE_AEC=ON"
"-DUSE_OpenJPEG=ON"
"-DUSE_Jasper=OFF"
];
};
in
stdenv.mkDerivation {
pname = "wgrib2";
version = "3.8.0";
src = fetchFromGitHub {
owner = "NOAA-EMC";
repo = "wgrib2";
rev = "v3.8.0";
hash = "sha256-cJR8CdkAWYVj54saYjigqncKCFXHpekWZ4yAMdYHYYg=";
};
nativeBuildInputs = [
cmake
gfortran
];
buildInputs = [
zlib
libaec
libpng
openjpeg
g2c
];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DUSE_AEC=ON"
"-DUSE_G2CLIB_LOW=ON"
# Help CMake find the g2c library from our local build
"-DCMAKE_PREFIX_PATH=${g2c}"
];
postInstall = ''
strip $out/bin/wgrib2
'';
meta = {
description = "Utility to read and write GRIB2 files";
homepage = "https://github.com/NOAA-EMC/wgrib2";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.linux;
};
}