From 56f0be1ba13293cced0bd6ebd19f15f82f42fb1f Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 13 Oct 2013 10:57:30 +0400 Subject: [PATCH] Adding lisp-packages subset. Adding a few test packages without dependencies. --- .../lisp-modules/define-package.nix | 45 ++++++++++++++++++ .../lisp-modules/lisp-packages.nix | 47 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 +++ 3 files changed, 98 insertions(+) create mode 100644 pkgs/development/lisp-modules/define-package.nix create mode 100644 pkgs/development/lisp-modules/lisp-packages.nix diff --git a/pkgs/development/lisp-modules/define-package.nix b/pkgs/development/lisp-modules/define-package.nix new file mode 100644 index 000000000000..4fe3bb68373a --- /dev/null +++ b/pkgs/development/lisp-modules/define-package.nix @@ -0,0 +1,45 @@ +args @ {stdenv, clwrapper, baseName, version ? "latest", src, description, deps, + buildInputs ? [], meta ? {}, overrides?(x: {})}: +let + deployConfigScript = '' + config_script="$out"/lib/common-lisp-settings/${args.baseName}-shell-config.sh + mkdir -p "$(dirname "$config_script")" + touch "$config_script" + chmod a+x "$config_script" + echo "export NIX_LISP_COMMAND='$NIX_LISP_COMMAND'" >> "$config_script" + echo "export NIX_LISP_ASDF='$NIX_LISP_ASDF'" >> "$config_script" + echo "export CL_SOURCE_REGISTRY="\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}"'$CL_SOURCE_REGISTRY:$out/lib/common-lisp/${args.baseName}/'" >> "$config_script" + ''; + deployLaunchScript = '' + launch_script="$out"/bin/${args.baseName}-lisp-launcher.sh + mkdir -p "$(dirname "$launch_script")" + touch "$launch_script" + chmod a+x "$launch_script" + echo "#! /bin/sh" >> "$launch_script" + echo "source '$config_script'" >> "$launch_script" + echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script" + ''; +basePackage = { + name = "lisp-${baseName}-${version}"; + inherit src; + + inherit deployConfigScript deployLaunchScript; + installPhase = '' + mkdir -p "$out"/share/doc/${args.baseName}; + mkdir -p "$out"/lib/common-lisp/${args.baseName}; + cp -r . "$out"/lib/common-lisp/${args.baseName}; + cp -rf doc/* LICENCE LICENSE COPYING README README.html README.md readme.html "$out"/share/doc/${args.baseName} || true + + ${deployConfigScript} + ${deployLaunchScript} + ''; + propagatedBuildInputs = args.deps ++ [clwrapper clwrapper.lisp]; + buildInputs = buildInputs; + dontStrip=true; + meta = { + inherit description version; + } // meta; +}; +package = basePackage // (overrides basePackage); +in +stdenv.mkDerivation package diff --git a/pkgs/development/lisp-modules/lisp-packages.nix b/pkgs/development/lisp-modules/lisp-packages.nix new file mode 100644 index 000000000000..e6270784b255 --- /dev/null +++ b/pkgs/development/lisp-modules/lisp-packages.nix @@ -0,0 +1,47 @@ +{stdenv, clwrapper, pkgs}: +let lispPackages = rec { + inherit pkgs clwrapper stdenv; + nixLib = pkgs.lib; + callPackage = nixLib.callPackageWith lispPackages; + + buildLispPackage = callPackage ./define-package.nix; + + cl-ppcre = buildLispPackage rec { + baseName = "cl-ppcre"; + version = "2.0.4"; + description = "Regular expression library for Common Lisp"; + deps = []; + src = pkgs.fetchurl { + url = "https://github.com/edicl/cl-ppcre/archive/v${version}.tar.gz"; + sha256 = "16nkfg6j7nn8qkzxn462kqpdlbajpz2p55pdl12sia6yqkj3lh97"; + }; + }; + + clx = buildLispPackage rec { + baseName = "clx"; + version = "2013-09"; + description = "X11 bindings for Common Lisp"; + deps = []; + src = pkgs.fetchgit { + url = "https://github.com/sharplispers/clx/"; + rev = "e2b762ac93d78d6eeca4f36698c8dfd1537ce998"; + sha256 = "0jcrmlaayz7m8ixgriq7id3pdklyk785qvpcxdpcp4aqnfiiqhij"; + }; + }; + + iterate = buildLispPackage rec { + baseName = "iterate"; + version = "1.4.3"; + description = "Iteration package for Common Lisp"; + deps = []; + src = pkgs.fetchdarcs { + url = "http://common-lisp.net/project/iterate/darcs/iterate"; + sha256 = "0m3q0s7h5s8varwx584m2akgdslj14df7kg4w1bj1fbgzsag5m1w"; + tag=version; + }; + overrides = x: { + configurePhase="buildPhase(){ true; }"; + }; + }; +}; +in lispPackages diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d14d84ea2c1f..b2e5b21b4de0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5883,6 +5883,12 @@ let asdf = callPackage ../development/lisp-modules/asdf {}; clwrapperFunction = callPackage ../development/lisp-modules/clwrapper; wrapLisp = lisp: clwrapperFunction {lisp=lisp;}; + lispPackagesFor = clwrapper: callPackage ../development/lisp-modules/lisp-packages.nix{ + inherit clwrapper; + }; + lispPackagesClisp = lispPackagesFor (wrapLisp clisp); + lispPackagesSBCL = lispPackagesFor (wrapLisp sbcl); + lispPackages = recurseIntoAttrs lispPackagesSBCL; ### DEVELOPMENT / PERL MODULES