nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 74 lines 2.0 kB view raw
1{ 2 stdenv, 3 lib, 4 cmake, 5 glibc, 6 gfortran, 7 makeWrapper, 8 fetchFromGitHub, 9 fetchpatch, 10 dos2unix, 11 dataRepo ? fetchFromGitHub { 12 owner = "DSSAT"; 13 repo = "dssat-csm-data"; 14 rev = "v4.8.2.8"; 15 hash = "sha256-hbSBKEvdSd1lfbemfp4Lk4/JcGMXGVjm1x7P7lmmuA0="; 16 }, 17}: 18let 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="; 24 }; 25in 26stdenv.mkDerivation (final: { 27 pname = "dssat"; 28 version = "4.8.2.12"; 29 30 src = fetchFromGitHub { 31 owner = "DSSAT"; 32 repo = "dssat-csm-os"; 33 tag = "v${final.version}"; 34 hash = "sha256-8OaTM7IXFZjlelx5O4O+bVNQj4dIhGzIk2iCfpqI8uA="; 35 }; 36 37 # maintainers are on windows and have CRLF endings in their files 38 # And github returns a patch file in unix format only. 39 patchPhase = '' 40 runHook prePatch 41 cp ${charLimitPatch} ./limit-path.patch 42 unix2dos ./limit-path.patch 43 patch --binary -p1 < ./limit-path.patch 44 runHook postPatch 45 ''; 46 47 nativeBuildInputs = [ 48 cmake 49 dos2unix 50 gfortran 51 makeWrapper 52 ]; 53 54 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ glibc.static ]; 55 56 cmakeFlags = [ "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/share/dssat/" ]; 57 58 postInstall = '' 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 63 ''; 64 65 meta = { 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; 73 }; 74})