From 834c731a7204c31a9129220a13628d08396f94e8 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 18 Apr 2015 13:20:06 -0500 Subject: [PATCH] nixpkgs: add kdb+ 3.2 Signed-off-by: Austin Seipp --- pkgs/applications/misc/kdbplus/default.nix | 75 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 77 insertions(+) create mode 100644 pkgs/applications/misc/kdbplus/default.nix diff --git a/pkgs/applications/misc/kdbplus/default.nix b/pkgs/applications/misc/kdbplus/default.nix new file mode 100644 index 000000000000..ffde422c18b3 --- /dev/null +++ b/pkgs/applications/misc/kdbplus/default.nix @@ -0,0 +1,75 @@ +{ stdenv, requireFile, unzip, rlwrap, bash }: + +assert (stdenv.system == "i686-linux"); + +let + libPath = stdenv.lib.makeLibraryPath + [ stdenv.cc.libc stdenv.cc.cc ]; +in +stdenv.mkDerivation rec { + name = "kdbplus-${version}"; + version = "3.2"; + + src = requireFile { + message = '' + Nix can't download kdb+ for you automatically. Go to + http://kx.com and download the free, 32-bit version for + Linux. Then run "nix-prefetch-url file:///linux.zip" in the + directory where you saved it. Note you need version 3.2. + ''; + name = "linux.zip"; + sha256 = "0ah1kfvxnrck1kg8j7rpzgj6amji62zbm4ya6q55l54gm3qq6q0r"; + }; + + dontStrip = true; + buildInputs = [ unzip ]; + + phases = "unpackPhase installPhase"; + unpackPhase = "mkdir ${name} && cd ${name} && unzip -qq ${src}"; + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4aa233f873c5..eb39c73abd94 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1757,6 +1757,8 @@ let kalibrate-rtl = callPackage ../tools/misc/kalibrate-rtl { }; + kdbplus = callPackage_i686 ../applications/misc/kdbplus { }; + kexectools = callPackage ../os-specific/linux/kexectools { }; keybase-node-client = callPackage ../applications/misc/keybase-node-client { };