Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, pkgs, fetchurl, zlib, gmp, lib }: 2 3# from justinwoo/easy-purescript-nix 4# https://github.com/justinwoo/easy-purescript-nix/blob/d383972c82620a712ead4033db14110497bc2c9c/purs.nix 5 6let 7 dynamic-linker = stdenv.cc.bintools.dynamicLinker; 8 9 patchelf = libPath : 10 if stdenv.isDarwin 11 then "" 12 else 13 '' 14 chmod u+w $PURS 15 patchelf --interpreter ${dynamic-linker} --set-rpath ${libPath} $PURS 16 chmod u-w $PURS 17 ''; 18 19in stdenv.mkDerivation rec { 20 pname = "purescript"; 21 version = "0.15.9"; 22 23 # These hashes can be updated automatically by running the ./update.sh script. 24 src = 25 if stdenv.isDarwin 26 then 27 (if stdenv.isAarch64 28 then 29 fetchurl { 30 url = "https://github.com/${pname}/${pname}/releases/download/v${version}/macos-arm64.tar.gz"; 31 sha256 = "16ci26pgrw0zmnyn1zj129y9624cqwzrhqglc8mgfg4k7rxvqy2a"; 32 } 33 else 34 fetchurl { 35 url = "https://123.github.com/${pname}/${pname}/releases/download/v${version}/macos.tar.gz"; 36 sha256 = "1xxg79rlf7li9f73wdbwif1dyy4hnzpypy6wx4zbnvap53habq9f"; 37 }) 38 else 39 fetchurl { 40 url = "https://github.com/${pname}/${pname}/releases/download/v${version}/linux64.tar.gz"; 41 sha256 = "0rabinklsd8bs16f03zv7ij6d1lv4w2xwvzzgkwc862gpqvz9jq3"; 42 }; 43 44 45 buildInputs = [ zlib gmp ]; 46 libPath = lib.makeLibraryPath buildInputs; 47 dontStrip = true; 48 49 installPhase = '' 50 mkdir -p $out/bin 51 PURS="$out/bin/purs" 52 53 install -D -m555 -T purs $PURS 54 ${patchelf libPath} 55 56 mkdir -p $out/share/bash-completion/completions 57 $PURS --bash-completion-script $PURS > $out/share/bash-completion/completions/purs-completion.bash 58 ''; 59 60 passthru = { 61 updateScript = ./update.sh; 62 tests = { 63 minimal-module = pkgs.callPackage ./test-minimal-module {}; 64 }; 65 }; 66 67 meta = with lib; { 68 description = "A strongly-typed functional programming language that compiles to JavaScript"; 69 homepage = "https://www.purescript.org/"; 70 license = licenses.bsd3; 71 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 72 maintainers = with maintainers; [ justinwoo mbbx6spp cdepillabout ]; 73 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; 74 mainProgram = "purs"; 75 changelog = "https://github.com/purescript/purescript/releases/tag/v${version}"; 76 }; 77}