nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 wrapQtAppsHook,
6 cmake,
7 bzip2,
8 qtbase,
9 qttools,
10 libnova,
11 proj,
12 libpng,
13 openjpeg,
14}:
15
16stdenv.mkDerivation {
17 version = "unstable-2022-05-16";
18 pname = "xygrib";
19
20 src = fetchFromGitHub {
21 owner = "opengribs";
22 repo = "XyGrib";
23 rev = "88c425ca2d7f4ba5d7ab75bfa25e177bee02d310";
24 sha256 = "sha256-qMMeRYIQqJpVRE3YjbXIiXHwS/CHs9l2QihszwQIr/A=";
25 };
26
27 nativeBuildInputs = [
28 cmake
29 qttools
30 wrapQtAppsHook
31 ];
32 buildInputs = [
33 bzip2
34 qtbase
35 libnova
36 proj
37 openjpeg
38 libpng
39 ];
40 cmakeFlags = [
41 "-DOPENJPEG_INCLUDE_DIR=${openjpeg.dev}/include/openjpeg-${lib.versions.majorMinor openjpeg.version}"
42 ]
43 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DLIBNOVA_LIBRARY=${libnova}/lib/libnova.dylib" ];
44
45 postInstall =
46 if stdenv.hostPlatform.isDarwin then
47 ''
48 mkdir -p "$out/Applications" "$out/XyGrib/XyGrib.app/Contents/Resources"
49 cp "../data/img/xyGrib.icns" "$out/XyGrib/XyGrib.app/Contents/Resources/xyGrib.icns"
50 mv $out/XyGrib/XyGrib.app $out/Applications
51 wrapQtApp "$out/Applications/XyGrib.app/Contents/MacOS/XyGrib"
52 ''
53 else
54 ''
55 wrapQtApp $out/XyGrib/XyGrib
56 mkdir -p $out/bin
57 ln -s $out/XyGrib/XyGrib $out/bin/xygrib
58 install -Dm444 $src/debian/xygrib.png -t $out/share/icons/hicolor/32x32/apps
59 install -Dm444 $src/debian/xygrib.desktop -t $out/share/applications
60 substituteInPlace $out/share/applications/xygrib.desktop \
61 --replace 'Exec=XyGrib' 'Exec=xygrib'
62 '';
63
64 meta = with lib; {
65 homepage = "https://opengribs.org";
66 description = "Weather Forecast Visualization";
67 mainProgram = "xygrib";
68 longDescription = ''
69 XyGrib is a leading opensource weather visualization package.
70 It interacts with OpenGribs's Grib server providing a choice
71 of global and large area atmospheric and wave models.
72 '';
73 license = licenses.gpl3;
74 platforms = platforms.all;
75 maintainers = with maintainers; [ j03 ];
76 };
77}