2019-09-12 19:02:03 +02:00
|
|
|
{ stdenv, requireFile, unzip, rlwrap, bash, zlib }:
|
2015-04-18 20:20:06 +02:00
|
|
|
|
2018-08-20 21:11:29 +02:00
|
|
|
assert (stdenv.hostPlatform.system == "i686-linux");
|
2015-04-18 20:20:06 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
libPath = stdenv.lib.makeLibraryPath
|
2019-09-12 19:02:03 +02:00
|
|
|
[ stdenv.cc.libc stdenv.cc.cc zlib ];
|
2015-04-18 20:20:06 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "kdbplus";
|
2019-09-12 10:30:13 +02:00
|
|
|
version = "3.6";
|
2015-04-18 20:20:06 +02:00
|
|
|
|
2019-09-12 10:30:13 +02:00
|
|
|
src = requireFile rec {
|
2015-04-18 20:20:06 +02:00
|
|
|
message = ''
|
|
|
|
Nix can't download kdb+ for you automatically. Go to
|
|
|
|
http://kx.com and download the free, 32-bit version for
|
2019-09-12 10:30:13 +02:00
|
|
|
Linux. Then run "nix-prefetch-url file://\$PWD/${name}" in
|
|
|
|
the directory where you saved it. Note you need version ${version}.
|
2015-04-18 20:20:06 +02:00
|
|
|
'';
|
2019-09-12 10:30:13 +02:00
|
|
|
name = "linuxx86.zip";
|
|
|
|
sha256 = "0w6znd9warcqx28vf648n0vgmxyyy9kvsfpsfw37d1kp5finap4p";
|
2015-04-18 20:20:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
buildInputs = [ unzip ];
|
|
|
|
|
|
|
|
phases = "unpackPhase installPhase";
|
2019-08-15 14:41:18 +02:00
|
|
|
unpackPhase = "mkdir ${pname}-${version} && cd ${pname}-${version} && unzip -qq ${src}";
|
2015-04-18 20:20:06 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/libexec
|
|
|
|
|
|
|
|
patchelf \
|
|
|
|
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath ${libPath} \
|
|
|
|
./q/l32/q
|
|
|
|
mv ./q/l32/q $out/libexec/q
|
|
|
|
|
|
|
|
# Shell script wrappers to make things more convenient...
|
|
|
|
|
|
|
|
cat > $out/bin/q-install <<- EOF
|
|
|
|
#!${bash}/bin/bash
|
|
|
|
if [ -f \$HOME/q/q.k ]; then
|
|
|
|
echo "kdb has already been unpacked in \$HOME. Skipping..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo -n "Unzipping ${src} into \$HOME... "
|
|
|
|
cd \$HOME && ${unzip}/bin/unzip -qq ${src}
|
|
|
|
echo "Done"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > $out/bin/q <<- EOF
|
|
|
|
#!${bash}/bin/bash
|
|
|
|
if [ ! -f \$HOME/q/q.k ]; then
|
|
|
|
echo "ERROR: You need to unzip the Q sources into \$HOME before running q."
|
|
|
|
echo
|
|
|
|
echo "Try:"
|
|
|
|
echo " cd \$HOME && unzip ${src}"
|
|
|
|
echo "(or run q-install)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec ${rlwrap}/bin/rlwrap $out/libexec/q \$@
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x $out/bin/q $out/bin/q-install
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Analytics and time-series database";
|
|
|
|
homepage = "http://www.kx.com/";
|
|
|
|
license = stdenv.lib.licenses.unfree;
|
|
|
|
platforms = [ "i686-linux" ];
|
|
|
|
maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
|
|
|
|
};
|
|
|
|
}
|