1 { lib, stdenv, requireFile, unzip, rlwrap, bash, zlib }:
3 assert (stdenv.hostPlatform.system == "i686-linux");
6 libPath = lib.makeLibraryPath
7 [ stdenv.cc.libc stdenv.cc.cc zlib ];
9 stdenv.mkDerivation rec {
13 src = requireFile rec {
15 Nix can't download kdb+ for you automatically. Go to
16 http://kx.com and download the free, 32-bit version for
17 Linux. Then run "nix-prefetch-url file://\$PWD/${name}" in
18 the directory where you saved it. Note you need version ${version}.
20 name = "linuxx86.zip";
21 sha256 = "0w6znd9warcqx28vf648n0vgmxyyy9kvsfpsfw37d1kp5finap4p";
25 nativeBuildInputs = [ unzip ];
27 phases = "unpackPhase installPhase";
28 unpackPhase = "mkdir ${pname}-${version} && cd ${pname}-${version} && unzip -qq ${src}";
30 mkdir -p $out/bin $out/libexec
33 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
34 --set-rpath ${libPath} \
36 mv ./q/l32/q $out/libexec/q
38 # Shell script wrappers to make things more convenient...
40 cat > $out/bin/q-install <<- EOF
42 if [ -f \$HOME/q/q.k ]; then
43 echo "kdb has already been unpacked in \$HOME. Skipping..."
46 echo -n "Unzipping ${src} into \$HOME... "
47 cd \$HOME && ${unzip}/bin/unzip -qq ${src}
51 cat > $out/bin/q <<- EOF
53 if [ ! -f \$HOME/q/q.k ]; then
54 echo "ERROR: You need to unzip the Q sources into \$HOME before running q."
57 echo " cd \$HOME && unzip ${src}"
58 echo "(or run q-install)"
62 exec ${rlwrap}/bin/rlwrap $out/libexec/q \$@
65 chmod +x $out/bin/q $out/bin/q-install
69 description = "Analytics and time-series database";
70 homepage = "http://www.kx.com/";
71 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
72 license = lib.licenses.unfree;
73 platforms = [ "i686-linux" ];
74 maintainers = [ lib.maintainers.thoughtpolice ];