Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 101 lines 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5}: 6let 7 version = "110.99.8"; 8 baseurl = "https://smlnj.cs.uchicago.edu/dist/working/${version}"; 9 10 arch = if stdenv.hostPlatform.is64bit then "64" else "32"; 11 12 hashes = builtins.fromJSON (builtins.readFile ./hashes.json); 13 14 fetchSource = 15 name: 16 fetchurl { 17 url = "${baseurl}/${name}"; 18 hash = hashes.${name}; 19 }; 20 21 bootSource = if stdenv.hostPlatform.is64bit then "boot.amd64-unix.tgz" else "boot.x86-unix.tgz"; 22 23 sources = map fetchSource [ 24 bootSource 25 "config.tgz" 26 "cm.tgz" 27 "compiler.tgz" 28 "runtime.tgz" 29 "system.tgz" 30 "MLRISC.tgz" 31 "smlnj-lib.tgz" 32 "old-basis.tgz" 33 "ckit.tgz" 34 "nlffi.tgz" 35 "cml.tgz" 36 "eXene.tgz" 37 "ml-lpt.tgz" 38 "ml-lex.tgz" 39 "ml-yacc.tgz" 40 "ml-burg.tgz" 41 "pgraph.tgz" 42 "trace-debug-profile.tgz" 43 "heap2asm.tgz" 44 "smlnj-c.tgz" 45 "doc.tgz" 46 "asdl.tgz" 47 ]; 48 49in 50stdenv.mkDerivation { 51 pname = "smlnj"; 52 inherit version sources; 53 54 unpackPhase = '' 55 for s in $sources; do 56 b=$(basename $s) 57 cp $s ''${b#*-} 58 done 59 unpackFile config.tgz 60 mkdir base 61 ./config/unpack $TMP runtime 62 ''; 63 64 patchPhase = '' 65 sed -i '/^PATH=/d' config/_arch-n-opsys base/runtime/config/gen-posix-names.sh 66 echo SRCARCHIVEURL="file:/$TMP" > config/srcarchiveurl 67 ''; 68 69 buildPhase = '' 70 ./config/install.sh -default ${arch} 71 ''; 72 73 installPhase = '' 74 mkdir -pv $out 75 cp -rv bin lib $out 76 77 cd $out/bin 78 for i in *; do 79 sed -i "2iSMLNJ_HOME=$out/" $i 80 done 81 ''; 82 83 passthru.updateScript = ./update.sh; 84 85 meta = { 86 description = "Standard ML of New Jersey, a compiler"; 87 homepage = "http://smlnj.org"; 88 license = lib.licenses.bsd3; 89 platforms = [ 90 "x86_64-linux" 91 "i686-linux" 92 "x86_64-darwin" 93 "aarch64-darwin" 94 ]; 95 maintainers = with lib.maintainers; [ 96 skyesoss 97 thoughtpolice 98 ]; 99 mainProgram = "sml"; 100 }; 101}