11 dataRepo ? fetchFromGitHub {
13 repo = "dssat-csm-data";
15 hash = "sha256-hbSBKEvdSd1lfbemfp4Lk4/JcGMXGVjm1x7P7lmmuA0=";
19 # Temporary patch to fix 80 chars limit on paths
20 # https://github.com/DSSAT/dssat-csm-os/pull/417/
21 charLimitPatch = fetchpatch {
22 url = "https://github.com/DSSAT/dssat-csm-os/pull/417/commits/9215012a297c074f392b5e7eb90b8c20495f13f7.patch";
23 hash = "sha256-WwJR5lnWtR3aYWZmk8pBC0/qaRqY0UrWHIaYp2ajImE=";
26 stdenv.mkDerivation (final: {
30 src = fetchFromGitHub {
32 repo = "dssat-csm-os";
33 rev = "refs/tags/v${final.version}";
34 hash = "sha256-8OaTM7IXFZjlelx5O4O+bVNQj4dIhGzIk2iCfpqI8uA=";
37 # maintainers are on windows and have CRLF endings in their files
38 # And github returns a patch file in unix format only.
41 cp ${charLimitPatch} ./limit-path.patch
42 unix2dos ./limit-path.patch
43 patch --binary -p1 < ./limit-path.patch
54 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ glibc.static ];
56 cmakeFlags = [ "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/share/dssat/" ];
59 mkdir -p $out/share/dssat/Data
60 cp -r $src/Data/* $out/share/dssat/Data/
61 cp -r ${dataRepo}/* $out/share/dssat/Data/
62 makeWrapper $out/share/dssat/dscsm048 $out/bin/dscsm048
66 homepage = "https://github.com/DSSAT/dssat-csm-os";
67 description = "Cropping System Model";
68 mainProgram = "dscsm048";
69 license = lib.licenses.bsd3;
70 maintainers = with lib.maintainers; [ pcboy ];
71 platforms = lib.platforms.unix;
72 broken = stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux;