nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 gtk2-x11,
6 pkg-config,
7 python3,
8 gfortran,
9 cfitsio,
10 getopt,
11 perl,
12 groff,
13 which,
14 darwin,
15 ncurses,
16 makeWrapper,
17}:
18
19let
20 python3Env = python3.withPackages (
21 ps: with ps; [
22 numpy
23 setuptools
24 ]
25 );
26in
27
28stdenv.mkDerivation (finalAttrs: {
29 version = "4.5-01";
30 pname = "imager";
31
32 src = fetchurl {
33 # The recommended download link is on Nextcloud instance that
34 # requires to accept some general terms of use. Use a mirror at
35 # univ-grenoble-alpes.fr instead.
36 url = "https://cloud.univ-grenoble-alpes.fr/s/J6yEqA6yZ8tX9da/download?path=%2F&files=imager-may25.tar.gz";
37 hash = "sha256-E3JjdVGEQ0I/ogYj0G1OZxfQ3hA+sRgA4LAfHK52Sec=";
38 };
39
40 nativeBuildInputs = [
41 pkg-config
42 groff
43 perl
44 getopt
45 gfortran
46 which
47 makeWrapper
48 ];
49
50 buildInputs = [
51 gtk2-x11
52 cfitsio
53 python3Env
54 ncurses
55 ];
56
57 patches = [
58 # Use Clang as the default compiler on Darwin.
59 ./clang.patch
60 # Replace hardcoded cpp with GAG_CPP (see below).
61 ./cpp-darwin.patch
62 # Fix the numpy header detection with numpy > 2.0.0
63 # Patch submitted upstream, it will be included in the next release.
64 ./numpy-header.patch
65 ];
66
67 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument";
68
69 # Workaround for https://github.com/NixOS/nixpkgs/issues/304528
70 env.GAG_CPP = if stdenv.hostPlatform.isDarwin then "${gfortran.outPath}/bin/cpp" else "cpp";
71
72 postPatch = ''
73 substituteInPlace utilities/main/gag-makedepend.pl --replace-fail '/usr/bin/perl' ${lib.getExe perl}
74 '';
75
76 configurePhase = ''
77 source admin/gildas-env.sh -c gfortran -o openmp
78 echo "gag_doc: $out/share/doc/" >> kernel/etc/gag.dico.lcl
79 '';
80
81 postInstall = ''
82 cp -a ../gildas-exe/* $out
83 mv $out/$GAG_EXEC_SYSTEM $out/libexec
84 makeWrapper $out/libexec/bin/imager $out/bin/imager \
85 --set GAG_ROOT_DIR $out \
86 --set GAG_PATH $out/etc \
87 --set GAG_EXEC_SYSTEM libexec \
88 --set GAG_GAG \$HOME/.gag \
89 --set PYTHONHOME ${python3Env} \
90 --prefix PYTHONPATH : $out/libexec/python \
91 --set LD_LIBRARY_PATH $out/libexec/lib/
92 '';
93
94 meta = {
95 description = "Interferometric imaging package";
96 longDescription = ''
97 IMAGER is an interferometric imaging package in the GILDAS software,
98 tailored for usage simplicity and efficiency for multi-spectral data sets.
99
100 IMAGER was developed and optimized to handle large data files.
101 Therefore, IMAGER works mostly on internal buffers and avoids as much as possible
102 saving data to intermediate files.
103 File saving is done ultimately once the data analysis process is complete,
104 which offers an optimum use of the disk bandwidth.
105 '';
106 homepage = "https://imager.oasu.u-bordeaux.fr";
107 license = lib.licenses.free;
108 maintainers = [ lib.maintainers.smaret ];
109 platforms = lib.platforms.linux ++ lib.platforms.darwin;
110 };
111
112})