about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/chicken/4
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/chicken/4')
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch157
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix76
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/default.nix21
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix27
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/eggDerivation.nix44
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/eggs.nix296
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/eggs.scm5
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh9
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/default.nix25
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/overrides.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/setup-hook.sh7
11 files changed, 677 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch b/nixpkgs/pkgs/development/compilers/chicken/4/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch
new file mode 100644
index 000000000000..ca72ba0119f0
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch
@@ -0,0 +1,157 @@
+From 2877f33747e3871c3a682b3a0c812b8ba2e4da5a Mon Sep 17 00:00:00 2001
+From: Caolan McMahon <caolan@caolanmcmahon.com>
+Date: Sat, 25 Jun 2016 11:52:28 +0100
+Subject: [PATCH] Introduce CHICKEN_REPOSITORY_EXTRA
+
+This environment variable works like CHICKEN_REPOSITORY but supports
+multiple paths separated by `:'. Those paths are searched after
+CHICKEN_REPOSITORY when loading extensions via `require-library' and
+friends. It can be accessed and changed at runtime via the new procedure
+`repository-extra-paths' which is analog to `repository-path'.
+
+Original patch by Moritz Heidkamp.
+Updated by Caolan McMahon for CHICKEN 4.11.0
+---
+ chicken-install.scm | 29 ++++++++++++++++++++++++-----
+ chicken.import.scm  |  1 +
+ eval.scm            | 37 +++++++++++++++++++++++++++++++------
+ 3 files changed, 56 insertions(+), 11 deletions(-)
+
+diff --git a/chicken-install.scm b/chicken-install.scm
+index 7bc6041..f557793 100644
+--- a/chicken-install.scm
++++ b/chicken-install.scm
+@@ -120,6 +120,19 @@
+ 		 (sprintf "lib/chicken/~a" (##sys#fudge 42)))
+ 		(repository-path)))))
+ 
++  (define (repo-paths)
++    (if *deploy*
++	*prefix*
++	(if (and *cross-chicken* (not *host-extension*))
++	    (list (make-pathname C_TARGET_LIB_HOME (sprintf "chicken/~a" C_BINARY_VERSION)))
++	    (cons
++	     (if *prefix*
++		 (make-pathname
++			*prefix*
++			(sprintf "lib/chicken/~a" (##sys#fudge 42)))
++		 (repository-path))
++	     (repository-extra-paths)))))
++
+   (define (get-prefix #!optional runtime)
+     (cond ((and *cross-chicken*
+ 		(not *host-extension*))
+@@ -226,10 +239,13 @@
+            (chicken-version) )
+ 	  ;; Duplication of (extension-information) to get custom
+ 	  ;; prefix.  This should be fixed.
+-          ((let* ((ep (##sys#canonicalize-extension-path x 'ext-version))
+-		  (sf (make-pathname (repo-path) ep "setup-info")))
+-	     (and (file-exists? sf)
+-		  (with-input-from-file sf read))) =>
++      ((let ((ep (##sys#canonicalize-extension-path x 'ext-version)))
++         (let loop ((paths (repo-paths)))
++           (cond ((null? paths) #f)
++                 ((let ((sf (make-pathname (car paths) ep "setup-info")))
++                    (and (file-exists? sf)
++                         (with-input-from-file sf read))))
++                 (else (loop (cdr paths)))))) =>
+            (lambda (info)
+              (let ((a (assq 'version info)))
+                (if a
+@@ -776,7 +792,10 @@
+ 		  "installed extension has no information about which egg it belongs to"
+ 		  (pathname-file sf))
+ 		 #f))))
+-      (glob (make-pathname (repo-path) "*" "setup-info")))
++      (append-map
++       (lambda (path)
++       (glob (make-pathname path "*" "setup-info")))
++       (repo-paths)))
+      equal?))
+ 
+   (define (list-available-extensions trans locn)
+diff --git a/chicken.import.scm b/chicken.import.scm
+index f6e3a19..be1637c 100644
+--- a/chicken.import.scm
++++ b/chicken.import.scm
+@@ -200,6 +200,7 @@
+    repl
+    repl-prompt
+    repository-path
++   repository-extra-paths
+    require
+    reset
+    reset-handler
+diff --git a/eval.scm b/eval.scm
+index 6242f62..f7d76d4 100644
+--- a/eval.scm
++++ b/eval.scm
+@@ -81,6 +81,7 @@
+ (define-constant source-file-extension ".scm")
+ (define-constant setup-file-extension "setup-info")
+ (define-constant repository-environment-variable "CHICKEN_REPOSITORY")
++(define-constant repository-extra-environment-variable "CHICKEN_REPOSITORY_EXTRA")
+ (define-constant prefix-environment-variable "CHICKEN_PREFIX")
+ 
+ ; these are actually in unit extras, but that is used by default
+@@ -1176,6 +1177,25 @@
+ 
+ (define ##sys#repository-path repository-path)
+ 
++(define ##sys#repository-extra-paths
++  (let* ((repaths (get-environment-variable repository-extra-environment-variable))
++	 (repaths (if repaths
++		      (let ((len (string-length repaths)))
++			(let loop ((i 0) (offset 0) (res '()))
++			  (cond ((> i len)
++				 (reverse res))
++				((or (= i len) (eq? #\: (string-ref repaths i)))
++				 (loop (+ i 1) (+ i 1) (cons (substring repaths offset i) res)))
++				(else
++				 (loop (+ i 1) offset res)))))
++		      '())))
++    (lambda (#!optional val)
++      (if val
++	  (set! repaths val)
++	  repaths))))
++
++(define repository-extra-paths ##sys#repository-extra-paths)
++
+ (define ##sys#setup-mode #f)
+ 
+ (define ##sys#find-extension
+@@ -1193,6 +1213,7 @@
+ 	(let loop ((paths (##sys#append
+ 			   (if ##sys#setup-mode '(".") '())
+ 			   (if rp (list rp) '())
++			   (##sys#repository-extra-paths)
+ 			   (if inc? ##sys#include-pathnames '())
+ 			   (if ##sys#setup-mode '() '("."))) ))
+ 	  (and (pair? paths)
+@@ -1252,12 +1273,16 @@
+ 	[string-append string-append]
+ 	[read read] )
+     (lambda (id loc)
+-      (and-let* ((rp (##sys#repository-path)))
+-	(let* ((p (##sys#canonicalize-extension-path id loc))
+-	       (rpath (string-append rp "/" p ".")) )
+-	  (cond ((file-exists? (string-append rpath setup-file-extension))
+-		 => (cut with-input-from-file <> read) )
+-		(else #f) ) ) ) ) ))
++      (let loop ((rpaths (cons (##sys#repository-path) (##sys#repository-extra-paths))))
++	(and (pair? rpaths)
++	     (let ((rp (car rpaths)))
++	       (if (not rp)
++		   (loop (cdr rpaths))
++		   (let* ((p (##sys#canonicalize-extension-path id loc))
++			  (rpath (string-append rp "/" p ".")) )
++		     (cond ((file-exists? (string-append rpath setup-file-extension))
++			    => (cut with-input-from-file <> read) )
++			   (else (loop (cdr rpaths))) ) )) ))) ) ))
+ 
+ (define (extension-information ext)
+   (##sys#extension-information ext 'extension-information) )
+-- 
+2.1.4
+
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix b/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix
new file mode 100644
index 000000000000..ceeff56330b2
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix
@@ -0,0 +1,76 @@
+{ stdenv, fetchurl, makeWrapper, bootstrap-chicken ? null }:
+
+let
+  version = "4.13.0";
+  platform = with stdenv;
+    if isDarwin then "macosx"
+    else if isCygwin then "cygwin"
+    else if (isFreeBSD || isOpenBSD) then "bsd"
+    else if isSunOS then "solaris"
+    else "linux"; # Should be a sane default
+  lib = stdenv.lib;
+in
+stdenv.mkDerivation {
+  name = "chicken-${version}";
+
+  binaryVersion = 8;
+
+  src = fetchurl {
+    url = "https://code.call-cc.org/releases/${version}/chicken-${version}.tar.gz";
+    sha256 = "0hvckhi5gfny3mlva6d7y9pmx7cbwvq0r7mk11k3sdiik9hlkmdd";
+  };
+
+  setupHook = lib.ifEnable (bootstrap-chicken != null) ./setup-hook.sh;
+
+  buildFlags = "PLATFORM=${platform} PREFIX=$(out) VARDIR=$(out)/var/lib";
+  installFlags = "PLATFORM=${platform} PREFIX=$(out) VARDIR=$(out)/var/lib";
+
+  # We need a bootstrap-chicken to regenerate the c-files after
+  # applying a patch to add support for CHICKEN_REPOSITORY_EXTRA
+  patches = lib.ifEnable (bootstrap-chicken != null) [
+    ./0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch
+  ];
+
+  buildInputs = [
+    makeWrapper
+  ] ++ (lib.ifEnable (bootstrap-chicken != null) [
+    bootstrap-chicken
+  ]);
+
+  preBuild = lib.ifEnable (bootstrap-chicken != null) ''
+    # Backup the build* files - those are generated from hostname,
+    # git-tag, etc. and we don't need/want that
+    mkdir -p build-backup
+    mv buildid buildbranch buildtag.h build-backup
+
+    # Regenerate eval.c after the patch
+    make spotless $buildFlags
+
+    mv build-backup/* .
+  '';
+
+  postInstall = ''
+    for f in $out/bin/*
+    do
+      wrapProgram $f \
+        --prefix PATH : ${stdenv.cc}/bin
+    done
+  '';
+
+  # TODO: Assert csi -R files -p '(pathname-file (repository-path))' == binaryVersion
+
+  meta = {
+    homepage = http://www.call-cc.org/;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [ the-kenny ];
+    platforms = stdenv.lib.platforms.linux; # Maybe other non-darwin Unix
+    description = "A portable compiler for the Scheme programming language";
+    longDescription = ''
+      CHICKEN is a compiler for the Scheme programming language.
+      CHICKEN produces portable and efficient C, supports almost all
+      of the R5RS Scheme language standard, and includes many
+      enhancements and extensions. CHICKEN runs on Linux, macOS,
+      Windows, and many Unix flavours.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/default.nix b/nixpkgs/pkgs/development/compilers/chicken/4/default.nix
new file mode 100644
index 000000000000..8d29c7c9a2b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/default.nix
@@ -0,0 +1,21 @@
+{ newScope } :
+let
+  callPackage = newScope self;
+
+  self = {
+    pkgs = self;
+
+    fetchegg = callPackage ./fetchegg { };
+
+    eggDerivation = callPackage ./eggDerivation.nix { };
+
+    chicken = callPackage ./chicken.nix {
+      bootstrap-chicken = self.chicken.override { bootstrap-chicken = null; };
+    };
+
+    chickenEggs = callPackage ./eggs.nix { };
+
+    egg2nix = callPackage ./egg2nix.nix { };
+  };
+
+in self
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix b/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix
new file mode 100644
index 000000000000..d0f3b8a4e261
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix
@@ -0,0 +1,27 @@
+{ stdenv, eggDerivation, fetchurl, chickenEggs }:
+
+# Note: This mostly reimplements the default.nix already contained in
+# the tarball. Is there a nicer way than duplicating code?
+
+let
+  version = "0.5";
+in
+eggDerivation {
+  src = fetchurl {
+    url = "https://github.com/the-kenny/egg2nix/archive/${version}.tar.gz";
+    sha256 = "0adal428v4i7h9lzs7sfq75q2mxhsbf1qqwzrsjv8j41paars20y";
+  };
+
+  name = "egg2nix-${version}";
+  buildInputs = with chickenEggs; [
+    matchable http-client
+  ];
+
+  meta = {
+    description = "Generate nix-expression from CHICKEN scheme eggs";
+    homepage = https://github.com/the-kenny/egg2nix;
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.the-kenny ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/eggDerivation.nix b/nixpkgs/pkgs/development/compilers/chicken/4/eggDerivation.nix
new file mode 100644
index 000000000000..4dc7ebe66717
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/eggDerivation.nix
@@ -0,0 +1,44 @@
+{ stdenv, chicken, makeWrapper }:
+{ name, src
+, buildInputs ? []
+, chickenInstallFlags ? []
+, cscOptions          ? []
+, ...} @ args:
+
+let
+  libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
+  overrides = import ./overrides.nix;
+  baseName = (builtins.parseDrvName name).name;
+  override = if builtins.hasAttr baseName overrides
+   then
+     builtins.getAttr baseName overrides
+   else
+     {};
+in
+stdenv.mkDerivation ({
+  name = "chicken-${name}";
+  propagatedBuildInputs = buildInputs;
+  buildInputs = [ makeWrapper chicken ];
+
+  CSC_OPTIONS = stdenv.lib.concatStringsSep " " cscOptions;
+
+  CHICKEN_REPOSITORY = libPath;
+  CHICKEN_INSTALL_PREFIX = "$out";
+
+  installPhase = ''
+    runHook preInstall
+
+    chicken-install -p $out ${stdenv.lib.concatStringsSep " " chickenInstallFlags}
+
+    for f in $out/bin/*
+    do
+      wrapProgram $f \
+        --set CHICKEN_REPOSITORY $CHICKEN_REPOSITORY \
+        --prefix CHICKEN_REPOSITORY_EXTRA : "$out/lib/chicken/${toString chicken.binaryVersion}/:$CHICKEN_REPOSITORY_EXTRA" \
+        --prefix CHICKEN_INCLUDE_PATH \; "$CHICKEN_INCLUDE_PATH;$out/share/" \
+        --prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_EXTRA:$CHICKEN_REPOSITORY"
+    done
+
+    runHook postInstall
+  '';
+} // (builtins.removeAttrs args ["name" "buildInputs"]) // override)
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/eggs.nix b/nixpkgs/pkgs/development/compilers/chicken/4/eggs.nix
new file mode 100644
index 000000000000..1f786f127c91
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/eggs.nix
@@ -0,0 +1,296 @@
+{ pkgs }:
+rec {
+  inherit (pkgs) eggDerivation fetchegg;
+
+  base64 = eggDerivation {
+    name = "base64-3.3.1";
+
+    src = fetchegg {
+      name = "base64";
+      version = "3.3.1";
+      sha256 = "0wmldiwwg1jpcn07wb906nc53si5j7sa83wgyq643xzqcx4v4x1d";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  blob-utils = eggDerivation {
+    name = "blob-utils-1.0.3";
+
+    src = fetchegg {
+      name = "blob-utils";
+      version = "1.0.3";
+      sha256 = "17vdn02fnxnjx5ixgqimln93lqvzyq4y9w02fw7xnbdcjzqm0xml";
+    };
+
+    buildInputs = [
+      setup-helper
+      string-utils
+    ];
+  };
+
+  check-errors = eggDerivation {
+    name = "check-errors-1.13.0";
+
+    src = fetchegg {
+      name = "check-errors";
+      version = "1.13.0";
+      sha256 = "12a0sn82n98jybh72zb39fdddmr5k4785xglxb16750fhy8rmjwi";
+    };
+
+    buildInputs = [
+      setup-helper
+    ];
+  };
+
+  defstruct = eggDerivation {
+    name = "defstruct-1.6";
+
+    src = fetchegg {
+      name = "defstruct";
+      version = "1.6";
+      sha256 = "0lsgl32nmb5hxqiii4r3292cx5vqh50kp6v062nfiyid9lhrj0li";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  http-client = eggDerivation {
+    name = "http-client-0.7.1";
+
+    src = fetchegg {
+      name = "http-client";
+      version = "0.7.1";
+      sha256 = "1s03zgmb7kb99ld0f2ylqgicrab9qgza53fkgsqvg7bh5njmzhxr";
+    };
+
+    buildInputs = [
+      intarweb
+      uri-common
+      message-digest
+      md5
+      string-utils
+      sendfile
+    ];
+  };
+
+  intarweb = eggDerivation {
+    name = "intarweb-1.3";
+
+    src = fetchegg {
+      name = "intarweb";
+      version = "1.3";
+      sha256 = "0izlby78c25py29bdcbc0vapb6h7xgchqrzi6i51d0rb3mnwy88h";
+    };
+
+    buildInputs = [
+      defstruct
+      uri-common
+      base64
+    ];
+  };
+
+  lookup-table = eggDerivation {
+    name = "lookup-table-1.13.5";
+
+    src = fetchegg {
+      name = "lookup-table";
+      version = "1.13.5";
+      sha256 = "1nzly6rhynawlvzlyilk8z8cxz57cf9n5iv20glkhh28pz2izmrb";
+    };
+
+    buildInputs = [
+      setup-helper
+      check-errors
+      miscmacros
+      record-variants
+      synch
+    ];
+  };
+
+  matchable = eggDerivation {
+    name = "matchable-3.3";
+
+    src = fetchegg {
+      name = "matchable";
+      version = "3.3";
+      sha256 = "07y3lpzgm4djiwi9y2adc796f9kwkmdr28fkfkw65syahdax8990";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  md5 = eggDerivation {
+    name = "md5-3.1.0";
+
+    src = fetchegg {
+      name = "md5";
+      version = "3.1.0";
+      sha256 = "0bka43nx8x9b0b079qpvml2fl20km19ny0qjmhwzlh6rwmzazj2a";
+    };
+
+    buildInputs = [
+      message-digest
+    ];
+  };
+
+  message-digest = eggDerivation {
+    name = "message-digest-3.1.0";
+
+    src = fetchegg {
+      name = "message-digest";
+      version = "3.1.0";
+      sha256 = "1w6bax19dwgih78vcimiws0rja7qsd8hmbm6qqg2hf9cw3vab21s";
+    };
+
+    buildInputs = [
+      setup-helper
+      miscmacros
+      check-errors
+      variable-item
+      blob-utils
+      string-utils
+    ];
+  };
+
+  miscmacros = eggDerivation {
+    name = "miscmacros-2.96";
+
+    src = fetchegg {
+      name = "miscmacros";
+      version = "2.96";
+      sha256 = "1ajdgjrni10i2hmhcp4rawnxajjxry3kmq1krdmah4sf0kjrgajc";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  record-variants = eggDerivation {
+    name = "record-variants-0.5.1";
+
+    src = fetchegg {
+      name = "record-variants";
+      version = "0.5.1";
+      sha256 = "15wgysxkm8m4hx9nhhw9akchzipdnqc7yj3qd3zn0z7sxg4sld1h";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  sendfile = eggDerivation {
+    name = "sendfile-1.7.29";
+
+    src = fetchegg {
+      name = "sendfile";
+      version = "1.7.29";
+      sha256 = "1dc02cbkx5kixhbqjy26g6gs680vy7krc9qis1p1v4aa0b2lgj7k";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  setup-helper = eggDerivation {
+    name = "setup-helper-1.5.4";
+
+    src = fetchegg {
+      name = "setup-helper";
+      version = "1.5.4";
+      sha256 = "1k644y0md2isdcvazqfm4nyc8rh3dby6b0j3r4na4w8ryspqp6gj";
+    };
+
+    buildInputs = [
+      
+    ];
+  };
+
+  string-utils = eggDerivation {
+    name = "string-utils-1.2.4";
+
+    src = fetchegg {
+      name = "string-utils";
+      version = "1.2.4";
+      sha256 = "07alvghg0dahilrm4jg44bndl0x69sv1zbna9l20cbdvi35i0jp1";
+    };
+
+    buildInputs = [
+      setup-helper
+      miscmacros
+      lookup-table
+      check-errors
+    ];
+  };
+
+  synch = eggDerivation {
+    name = "synch-2.1.2";
+
+    src = fetchegg {
+      name = "synch";
+      version = "2.1.2";
+      sha256 = "1m9mnbq0m5jsxmd1a3rqpwpxj0l1b7vn1fknvxycc047pmlcyl00";
+    };
+
+    buildInputs = [
+      setup-helper
+      check-errors
+    ];
+  };
+
+  uri-common = eggDerivation {
+    name = "uri-common-1.4";
+
+    src = fetchegg {
+      name = "uri-common";
+      version = "1.4";
+      sha256 = "01ds1gixcn4rz657x3hr4rhw2496hsjff42ninw0k39l8i1cbh7c";
+    };
+
+    buildInputs = [
+      uri-generic
+      defstruct
+      matchable
+    ];
+  };
+
+  uri-generic = eggDerivation {
+    name = "uri-generic-2.41";
+
+    src = fetchegg {
+      name = "uri-generic";
+      version = "2.41";
+      sha256 = "1r5jbzjllbnmhm5n0m3fcx0g6dc2c2jzp1dcndkfmxz0cl99zxac";
+    };
+
+    buildInputs = [
+      matchable
+      defstruct
+    ];
+  };
+
+  variable-item = eggDerivation {
+    name = "variable-item-1.3.1";
+
+    src = fetchegg {
+      name = "variable-item";
+      version = "1.3.1";
+      sha256 = "19b3mhb8kr892sz9yyzq79l0vv28dgilw9cf415kj6aq16yp4d5n";
+    };
+
+    buildInputs = [
+      setup-helper
+      check-errors
+    ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/eggs.scm b/nixpkgs/pkgs/development/compilers/chicken/4/eggs.scm
new file mode 100644
index 000000000000..d847ae9e29b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/eggs.scm
@@ -0,0 +1,5 @@
+;; Eggs used by egg2nix
+http-client
+intarweb
+matchable
+uri-common
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh b/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh
new file mode 100644
index 000000000000..204661063090
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh
@@ -0,0 +1,9 @@
+source $stdenv/setup
+
+header "exporting egg ${eggName} (version $version) into $out"
+
+mkdir -p $out
+chicken-install -r "${eggName}:${version}"
+cp -r ${eggName}/* $out/
+
+stopNest
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/default.nix b/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/default.nix
new file mode 100644
index 000000000000..d4d33a5593c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/default.nix
@@ -0,0 +1,25 @@
+# Fetches a chicken egg from henrietta using `chicken-install -r'
+# See: http://wiki.call-cc.org/chicken-projects/egg-index-4.html
+
+{ stdenvNoCC, chicken }:
+{ name, version, md5 ? "", sha256 ? "" }:
+
+if md5 != "" then
+  throw "fetchegg does not support md5 anymore, please use sha256"
+else
+stdenvNoCC.mkDerivation {
+  name = "chicken-${name}-export-${version}";
+  builder = ./builder.sh;
+  nativeBuildInputs = [ chicken ];
+
+  outputHashAlgo = "sha256";
+  outputHashMode = "recursive";
+  outputHash = sha256;
+
+  inherit version;
+
+  eggName = name;
+
+  impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
+}
+
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/overrides.nix b/nixpkgs/pkgs/development/compilers/chicken/4/overrides.nix
new file mode 100644
index 000000000000..9fdda9b6d9fe
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/overrides.nix
@@ -0,0 +1,10 @@
+{
+  setup-helper = {
+    preBuild = ''
+      substituteInPlace setup-helper.setup \
+        --replace "(chicken-home)" \"$out/share/\"
+
+        cat setup-helper.setup
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/setup-hook.sh b/nixpkgs/pkgs/development/compilers/chicken/4/setup-hook.sh
new file mode 100644
index 000000000000..b0d9b53b5378
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/setup-hook.sh
@@ -0,0 +1,7 @@
+addChickenRepositoryPath() {
+    addToSearchPathWithCustomDelimiter : CHICKEN_REPOSITORY_EXTRA "$1/lib/chicken/8/"
+    # addToSearchPathWithCustomDelimiter \; CHICKEN_INCLUDE_PATH "$1/share/"
+    export CHICKEN_INCLUDE_PATH="$1/share;$CHICKEN_INCLUDE_PATH"
+}
+
+addEnvHooks "$targetOffset" addChickenRepositoryPath