Created
October 3, 2017 18:29
-
-
Save sifmelcara/c5d5b0670bf82693a5bdc9468bb16fb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# { stdenv, fetchurl, boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm_4, makeWrapper }: | |
let | |
pkgs = import <nixpkgs> {}; | |
stdenv = pkgs.stdenv; | |
fetchurl = pkgs.fetchurl; | |
boehmgc = pkgs.boehmgc; | |
libatomic_ops = pkgs.libatomic_ops; | |
pcre = pkgs.pcre; | |
libevent = pkgs.libevent; | |
libiconv = pkgs.libiconv; | |
llvm_4 = pkgs.llvm_4; | |
makeWrapper = pkgs.makeWrapper; | |
crystal_old = pkgs.crystal; | |
in | |
stdenv.mkDerivation rec { | |
version = "0.23.1"; | |
name = "crystal-${version}"; | |
src = fetchurl { | |
url = "https://github.com/crystal-lang/crystal/archive/${version}.tar.gz"; | |
sha256 = "8cf1b9a4eab29fca2f779ea186ae18f7ce444ce189c621925fa1a0c61dd5ff55"; | |
}; | |
nativeBuildInputs = [ crystal_old ]; | |
# crystal on Darwin needs libiconv to build | |
buildInputs = [ | |
boehmgc libatomic_ops pcre libevent llvm_4 makeWrapper | |
] ++ stdenv.lib.optionals stdenv.isDarwin [ | |
libiconv | |
]; | |
libPath = stdenv.lib.makeLibraryPath ([ | |
boehmgc libatomic_ops pcre libevent | |
] ++ stdenv.lib.optionals stdenv.isDarwin [ | |
libiconv | |
]); | |
unpackPhase = '' | |
tar zxf ${src} | |
''; | |
sourceRoot = "."; | |
buildPhase = '' | |
cd crystal-${version} | |
make | |
make doc | |
''; | |
installPhase = '' | |
./.build/crystal --version | |
install -Dm755 .build/crystal $out/bin/crystal | |
wrapProgram $out/bin/crystal \ | |
--suffix CRYSTAL_PATH : $out/lib/crystal \ | |
--suffix LIBRARY_PATH : $libPath | |
install -dm755 $out/lib/crystal | |
cp -r src/* $out/lib/crystal/ | |
install -dm755 $out/share/doc/crystal/api | |
cp -r doc/* $out/share/doc/crystal/api/ | |
cp -r samples $out/share/doc/crystal/ | |
install -Dm644 etc/completion.bash $out/share/bash-completion/completions/crystal | |
install -Dm644 etc/completion.zsh $out/share/zsh/site-functions/_crystal | |
install -Dm644 man/crystal.1 $out/share/man/man1/crystal.1 | |
install -Dm644 LICENSE $out/share/licenses/crystal/LICENSE | |
''; | |
dontStrip = true; | |
meta = { | |
description = "A compiled language with Ruby like syntax and type inference"; | |
homepage = https://crystal-lang.org/; | |
license = stdenv.lib.licenses.asl20; | |
maintainers = with stdenv.lib.maintainers; [ mingchuan ]; | |
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment