Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 60 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 unzip, 6 file, 7 licenseFile ? null, 8 optgamsFile ? null, 9}: 10 11stdenv.mkDerivation rec { 12 version = "25.0.2"; 13 pname = "gams"; 14 src = fetchurl { 15 url = "https://d37drm4t2jghv5.cloudfront.net/distributions/${version}/linux/linux_x64_64_sfx.exe"; 16 sha256 = "4f95389579f33ff7c2586838a2c19021aa0746279555cbb51aa6e0efd09bd297"; 17 }; 18 unpackCmd = "unzip $src"; 19 nativeBuildInputs = [ unzip ]; 20 buildInputs = [ file ]; 21 dontBuild = true; 22 23 installPhase = 24 assert licenseFile != null; 25 '' 26 mkdir -p "$out/bin" "$out/share/gams" 27 cp -a * "$out/share/gams" 28 29 cp ${licenseFile} $out/share/gams/gamslice.txt 30 '' 31 + lib.optionalString (optgamsFile != null) '' 32 cp ${optgamsFile} $out/share/gams/optgams.def 33 ln -s $out/share/gams/optgams.def $out/bin/optgams.def 34 ''; 35 36 postFixup = '' 37 for f in $out/share/gams/*; do 38 if [[ -x $f ]] && [[ -f $f ]] && [[ ! $f =~ .*\.so$ ]]; then 39 if patchelf \ 40 --set-rpath "$out/share/gams" \ 41 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $f; then 42 ln -s $f $out/bin/$(basename $f) 43 fi 44 fi 45 done 46 ''; 47 48 meta = with lib; { 49 description = "General Algebraic Modeling System"; 50 longDescription = '' 51 The General Algebraic Modeling System is a high-level modeling system for mathematical optimization. 52 GAMS is designed for modeling and solving linear, nonlinear, and mixed-integer optimization problems. 53 ''; 54 homepage = "https://www.gams.com/"; 55 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 56 license = licenses.unfree; 57 maintainers = [ maintainers.Scriptkiddi ]; 58 platforms = platforms.linux; 59 }; 60}