Integrate ghcjs

Use nixpkgs.haskellPackages_ghcjs to build packages with ghcjs.
This commit is contained in:
Ryan Trinkle 2014-08-26 13:35:29 -04:00
parent c72fdf4f48
commit 4394858433
17 changed files with 859 additions and 23 deletions

View File

@ -0,0 +1,278 @@
# generic builder for Cabal packages
{ stdenv, fetchurl, lib, pkgconfig, ghcjs, ghc, Cabal, jailbreakCabal, glibcLocales
, gnugrep, coreutils, hscolour # hscolour is unused
, enableLibraryProfiling ? false
, enableSharedLibraries ? false
, enableSharedExecutables ? false
, enableStaticLibraries ? true
, enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version
, enableHyperlinkSource ? false
, extension ? (self : super : {})
}:
let
enableFeature = stdenv.lib.enableFeature;
versionOlder = stdenv.lib.versionOlder;
optional = stdenv.lib.optional;
optionals = stdenv.lib.optionals;
optionalString = stdenv.lib.optionalString;
filter = stdenv.lib.filter;
in
{
mkDerivation =
args : # arguments for the individual package, can modify the defaults
let # These attributes are removed in the end. This is in order not to spoil the build
# environment overly, but also to keep hash-backwards-compatible with the old cabal.nix.
internalAttrs = [
"internalAttrs" "buildDepends" "buildTools" "extraLibraries" "pkgconfigDepends"
"isLibrary" "isExecutable" "testDepends"
];
# Stuff happening after the user preferences have been processed. We remove
# internal attributes and strip null elements from the dependency lists, all
# in the interest of keeping hashes stable.
postprocess =
x : (removeAttrs x internalAttrs) // {
buildInputs = filter (y : ! (y == null)) x.buildInputs;
propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
doCheck = enableCheckPhase && x.doCheck;
hyperlinkSource = enableHyperlinkSource && x.hyperlinkSource;
};
defaults =
self : { # self is the final version of the attribute set
# pname should be defined by the client to be the package basename
# version should be defined by the client to be the package version
# fname is the internal full name of the package
fname = "${self.pname}-${self.version}";
# name is the external full name of the package; usually we prefix
# all packages with haskell- to avoid name clashes for libraries;
# if that is not desired (for applications), name can be set to
# fname.
name = if self.isLibrary then
if enableLibraryProfiling && self.enableSharedLibraries then
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-profiling-shared"
else if enableLibraryProfiling && !self.enableSharedLibraries then
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-profiling"
else if !enableLibraryProfiling && self.enableSharedLibraries then
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-shared"
else
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}"
else
"${self.pname}-${self.version}";
# the default download location for Cabal packages is Hackage,
# you still have to specify the checksum
src = fetchurl {
url = "mirror://hackage/${self.pname}/${self.fname}.tar.gz";
inherit (self) sha256;
};
# default buildInputs are just ghc, if more buildInputs are required
# buildInputs can be extended by the client by using extraBuildInputs,
# but often propagatedBuildInputs is preferable anyway
buildInputs = [ghc ghc.ghc.parent.CabalGhcjs] ++ self.extraBuildInputs;
extraBuildInputs = self.buildTools ++
(optionals self.doCheck self.testDepends) ++
(if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++
(if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends);
# we make sure that propagatedBuildInputs is defined, so that we don't
# have to check for its existence
propagatedBuildInputs = if self.isLibrary then self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends else [];
# By default, also propagate all dependencies to the user environment. This is required, otherwise packages would be broken, because
# GHC also needs all dependencies to be available.
propagatedUserEnvPkgs = if self.isLibrary then self.buildDepends else [];
# library directories that have to be added to the Cabal files
extraLibDirs = [];
# build-depends Cabal field
buildDepends = [];
# target(s) passed to the cabal build phase as an argument
buildTarget = "";
# build-depends Cabal fields stated in test-suite stanzas
testDepends = [];
# target(s) passed to the cabal test phase as an argument
testTarget = "";
# build-tools Cabal field
buildTools = [];
# extra-libraries Cabal field
extraLibraries = [];
# pkgconfig-depends Cabal field
pkgconfigDepends = [];
isLibrary = ! self.isExecutable;
isExecutable = false;
# ignore version restrictions on the build inputs that the cabal file might specify
jailbreak = false;
# pass the '--enable-split-objs' flag to cabal in the configure stage
enableSplitObjs = false; # !stdenv.isDarwin; # http://hackage.haskell.org/trac/ghc/ticket/4013
# pass the '--enable-tests' flag to cabal in the configure stage
# and run any regression test suites the package might have
doCheck = false; #enableCheckPhase;
# pass the '--hyperlink-source' flag to ./Setup haddock
hyperlinkSource = enableHyperlinkSource;
# abort the build if the configure phase detects that the package
# depends on multiple versions of the same build input
strictConfigurePhase = true;
# pass the '--enable-library-vanilla' flag to cabal in the
# configure stage to enable building shared libraries
inherit enableStaticLibraries;
# pass the '--enable-shared' flag to cabal in the configure
# stage to enable building shared libraries
inherit enableSharedLibraries;
# pass the '--enable-executable-dynamic' flag to cabal in
# the configure stage to enable linking shared libraries
inherit enableSharedExecutables;
extraConfigureFlags = [
(enableFeature self.enableSplitObjs "split-objs")
(enableFeature enableLibraryProfiling "library-profiling")
(enableFeature true "shared")
(optional (versionOlder "7" ghc.version) (enableFeature self.enableStaticLibraries "library-vanilla"))
(optional (versionOlder "7.4" ghc.version) (enableFeature self.enableSharedExecutables "executable-dynamic"))
(optional (versionOlder "7" ghc.version) (enableFeature self.doCheck "tests"))
];
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
# compiles Setup and configures
configurePhase = ''
eval "$preConfigure"
${optionalString self.jailbreak "${ghc.ghc.parent.jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
PATH=$PATH:${ghc.ghc.ghc}/bin
for i in Setup.hs Setup.lhs; do
test -f $i && ghc --make $i
done
for p in $extraBuildInputs $propagatedBuildInputs $propagatedNativeBuildInputs; do
PkgDir="$p/lib/ghcjs-${ghc.ghc.version}_ghc-${ghc.ghc.ghc.version}/package.conf.d"
if [ -f "$PkgDir/package.cache" ]; then
extraConfigureFlags+=" --package-db=$PkgDir"
continue;
fi
if [ -d "$p/include" ]; then
extraConfigureFlags+=" --extra-include-dirs=$p/include"
fi
for d in lib{,64}; do
if [ -d "$p/$d" ]; then
extraConfigureFlags+=" --extra-lib-dirs=$p/$d"
fi
done
done
configureFlags+=" --package-db=${ghc.ghc}/share/ghcjs/x86_64-linux-0.1.0-7.8.2/ghcjs/package.conf.d"
${optionalString (self.enableSharedExecutables && self.stdenv.isLinux) ''
configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}";
''}
${optionalString (self.enableSharedExecutables && self.stdenv.isDarwin) ''
configureFlags+=" --ghc-option=-optl=-Wl,-headerpad_max_install_names";
''}
echo "configure flags: $extraConfigureFlags $configureFlags"
./Setup configure --ghcjs --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \
--libsubdir='$pkgid' $extraConfigureFlags $configureFlags 2>&1 \
${optionalString self.strictConfigurePhase ''
| ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log"
if ${gnugrep}/bin/egrep -q '^Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
echo >&2 "*** abort because of serious configure-time warning from Cabal"
exit 1
fi
''}
eval "$postConfigure"
'';
# builds via Cabal
buildPhase = ''
eval "$preBuild"
./Setup build ${self.buildTarget}
export GHC_PACKAGE_PATH=$(${ghc.GHCPackages})
#test -n "$noHaddock" || ./Setup haddock --html --hoogle \
# ${optionalString self.hyperlinkSource "--hyperlink-source"}
eval "$postBuild"
'';
checkPhase = optional self.doCheck ''
eval "$preCheck"
./Setup test ${self.testTarget}
eval "$postCheck"
'';
# installs via Cabal; creates a registration file for nix-support
# so that the package can be used in other Haskell-builds; also
# adds all propagated build inputs to the user environment packages
installPhase = ''
eval "$preInstall"
./Setup copy
ensureDir $out/bin # necessary to get it added to PATH
local confDir=$out/lib/ghcjs-${ghc.ghc.version}_ghc-${ghc.ghc.ghc.version}/package.conf.d
local installedPkgConf=$confDir/${self.fname}.installedconf
local pkgConf=$confDir/${self.fname}.conf
ensureDir $confDir
./Setup register --gen-pkg-config=$pkgConf
if test -f $pkgConf; then
echo '[]' > $installedPkgConf
GHC_PACKAGE_PATH=$installedPkgConf ghcjs-pkg --global register $pkgConf --force --package-db=$confDir || true
ghcjs-pkg recache --package-db=$confDir
fi
if test -f $out/nix-support/propagated-native-build-inputs; then
ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages
fi
${optionalString (self.enableSharedExecutables && self.isExecutable && self.stdenv.isDarwin) ''
for exe in $out/bin/* ; do
install_name_tool -add_rpath \
$out/lib/${ghc.ghc.name}/${self.pname}-${self.version} $exe
done
''}
eval "$postInstall"
'';
# We inherit stdenv and ghc so that they can be used
# in Cabal derivations.
inherit stdenv ghc;
};
in
stdenv.mkDerivation (postprocess (let super = defaults self // args self;
self = super // extension self super;
in self));
}

View File

@ -0,0 +1,72 @@
{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time
, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2
, parallel, safe, shelly, split, stringsearch, syb, systemFileio
, systemFilepath, tar, terminfo, textBinary, unorderedContainers
, vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
, automake, libtool, cabalInstallGhcjs, gmp
}:
cabal.mkDerivation (self: rec {
pname = "ghcjs";
version = "0.1.0";
src = fetchgit {
url = git://github.com/ghcjs/ghcjs.git;
rev = "c9ce6b9d87296b1236d5ef0f7d5236b2cedcff84";
sha256 = "0cla5bchprc8g5n39fkssnv3lj378h948irsnr7dslaki6laaagw";
};
bootSrc = fetchgit {
url = git://github.com/ghcjs/ghcjs-boot.git;
rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81";
sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8";
};
shims = fetchgit {
url = git://github.com/ghcjs/shims.git;
rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35";
sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax";
};
isLibrary = true;
isExecutable = true;
jailbreak = true;
noHaddock = true;
buildDepends = [
filepath HTTP mtl network random stm time zlib aeson attoparsec
bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta
lens optparseApplicative_0_7_0_2 parallel safe shelly split
stringsearch syb systemFileio systemFilepath tar terminfo textBinary
unorderedContainers vector wlPprintText yaml
alex happy git gnumake gcc autoconf automake libtool patch gmp
];
testDepends = [
HUnit regexPosix testFramework testFrameworkHunit
];
postConfigure = ''
echo Patching ghcjs with absolute paths to the Nix store
sed -i -e "s|getAppUserDataDirectory \"ghcjs\"|return \"$out/share/ghcjs\"|" \
src/Compiler/Info.hs
sed -i -e "s|str = \\[\\]|str = [\"--prefix=$out\", \"--libdir=$prefix/lib/$compiler\", \"--libsubdir=$pkgid\"]|" \
src-bin/Boot.hs
'';
postInstall = ''
export HOME=$(pwd)
cp -R ${bootSrc} ghcjs-boot
cd ghcjs-boot
( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot )
chmod -R u+w . # because fetchgit made it read-only
local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2
ensureDir $GHCJS_LIBDIR
cp -R ${shims} $GHCJS_LIBDIR/shims
${cabalInstallGhcjs}/bin/cabal-js update
PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --init --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib
'';
meta = {
homepage = "https://github.com/ghcjs/ghcjs";
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.jwiegley ];
};
})

View File

@ -0,0 +1,77 @@
{ stdenv, ghc, makeWrapper, coreutils, writeScript }:
let
ghcjs = ghc;
packageDBFlag = "-package-db";
GHCGetPackages = writeScript "ghc-get-packages.sh" ''
#! ${stdenv.shell}
# Usage:
# $1: version of GHC
# $2: invocation path of GHC
# $3: prefix
version="$1"
if test -z "$3"; then
prefix="${packageDBFlag} "
else
prefix="$3"
fi
PATH="$PATH:$2"
IFS=":"
for p in $PATH; do
for i in "$p/../share/ghcjs/$system-${ghcjs.version}-${ghcjs.ghc.version}"{,/lib,/ghcjs}"/package.conf.d" "$p/../lib/ghcjs-${ghc.version}_ghc-${ghc.ghc.version}/package.conf.d" ; do
# output takes place here
test -f $i/package.cache && echo -n " $prefix$i"
done
done
'';
GHCPackages = writeScript "ghc-packages.sh" ''
#! ${stdenv.shell} -e
declare -A GHC_PACKAGES_HASH # using bash4 hashs to get uniq paths
for arg in $(${GHCGetPackages} ${ghcjs.version} "$(dirname $0)"); do # Why is ghc.version passed in from here instead of captured in the other script directly?
case "$arg" in
${packageDBFlag}) ;;
*)
CANONICALIZED="$(${coreutils}/bin/readlink -f -- "$arg")"
GHC_PACKAGES_HASH["$CANONICALIZED"]= ;;
esac
done
for path in ''${!GHC_PACKAGES_HASH[@]}; do
echo -n "$path:"
done
'';
in
stdenv.mkDerivation {
name = "ghcjs-ghc${ghcjs.ghc.version}-${ghcjs.version}-wrapper";
buildInputs = [makeWrapper];
propagatedBuildInputs = [ghcjs];
unpackPhase = "true";
installPhase = ''
runHook preInstall
mkdir -p $out/bin
for prg in ghcjs ; do
makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$(${GHCGetPackages} ${ghcjs.version} \"\$(dirname \$0)\")"
done
for prg in ghcjs-pkg ; do
makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$(${GHCGetPackages} ${ghcjs.version} \"\$(dirname \$0)\" -${packageDBFlag}=)"
done
mkdir -p $out/nix-support
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
mkdir -p $out/share/doc
ln -s $ghc/lib $out/lib
ln -s $ghc/share/doc/ghc $out/share/doc/ghc-${ghcjs.version}
runHook postInstall
'';
ghc = ghcjs;
inherit GHCGetPackages GHCPackages;
inherit (ghcjs) meta version;
}

View File

@ -1,6 +1,4 @@
# This file was auto-generated by cabal2nix. Please do NOT edit manually!
{ cabal, filepath, haskellSrcExts, syb, transformers, uniplate }:
{ cabal, process, filepath, haskellSrcExts, syb, transformers, uniplate }:
cabal.mkDerivation (self: {
pname = "derive";
@ -9,12 +7,13 @@ cabal.mkDerivation (self: {
isLibrary = true;
isExecutable = true;
buildDepends = [
filepath haskellSrcExts syb transformers uniplate
process filepath haskellSrcExts syb transformers uniplate
];
meta = {
homepage = "http://community.haskell.org/~ndm/derive/";
description = "A program and library to derive instances for data types";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.andres ];
};
})

View File

@ -1,12 +1,15 @@
# This file was auto-generated by cabal2nix. Please do NOT edit manually!
{ cabal, ghcjsBase, mtl, text }:
{ cabal, fetchgit, ghcjsBase, mtl }:
cabal.mkDerivation (self: {
pname = "ghcjs-dom";
version = "0.1.0.0";
sha256 = "0qm43bd4m7w14p6ag643h09pll4fp09j1mzjyqvp0dhal03dc723";
buildDepends = [ ghcjsBase mtl text ];
src = fetchgit {
url = git://github.com/ghcjs/ghcjs-dom.git;
rev = "81805e75ccd41501774b90c04efd9e00d52e9798";
sha256 = "3aa56fb81974533661aa056ed080edab29bef8ab26dae61999de4452f95949f6";
};
buildDepends = [ ghcjsBase mtl ];
meta = {
description = "DOM library that supports both GHCJS and WebKitGTK";
license = self.stdenv.lib.licenses.mit;

View File

@ -0,0 +1,32 @@
{ cabal, bifunctors, comonad, contravariant, deepseq, distributive
, doctest, exceptions, filepath, free, genericDeriving, hashable
, hlint, HUnit, mtl, nats, parallel, primitive, profunctors
, QuickCheck, reflection, semigroupoids, semigroups, simpleReflect
, split, tagged, testFramework, testFrameworkHunit
, testFrameworkQuickcheck2, testFrameworkTh, text, transformers
, transformersCompat, unorderedContainers, vector, void, zlib
}:
cabal.mkDerivation (self: {
pname = "lens";
version = "4.4";
sha256 = "06ha4px4ywfbi0n3imy2qqjq3656snsz1b0ggkwzvdzmi550sh8w";
buildDepends = [
bifunctors comonad contravariant distributive exceptions filepath
free hashable mtl parallel primitive profunctors reflection
semigroupoids semigroups split tagged text transformers
transformersCompat unorderedContainers vector void zlib
];
testDepends = [
deepseq doctest filepath genericDeriving hlint HUnit mtl nats
parallel QuickCheck semigroups simpleReflect split testFramework
testFrameworkHunit testFrameworkQuickcheck2 testFrameworkTh text
transformers unorderedContainers vector
];
meta = {
homepage = "http://github.com/ekmett/lens/";
description = "Lenses, Folds and Traversals";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
})

View File

@ -0,0 +1,12 @@
{ cabal }:
cabal.mkDerivation (self: {
pname = "old-time";
version = "1.1.0.2";
sha256 = "1nrqbpwxsmga13gcyn7bg25gkm61fmix07gm76d1f1i4impgqw1r";
meta = {
description = "Time library";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
})

View File

@ -0,0 +1,14 @@
{ cabal, binary, text }:
cabal.mkDerivation (self: {
pname = "text-binary";
version = "0.1.0";
sha256 = "0wc501j8hqspnhf4d1hyb18f1wgc4kl2qx1b5s4bkxv0dfbwrk6z";
buildDepends = [ binary text ];
meta = {
homepage = "https://github.com/kawu/text-binary";
description = "Binary instances for text types";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
})

View File

@ -0,0 +1,14 @@
{ cabal, transformers }:
cabal.mkDerivation (self: {
pname = "transformers-compat";
version = "0.3.3.3";
sha256 = "18cqghf0gc97j9qnlfnwwhvfm8j4sk99rm0xv3bf6ml8slk7njx7";
buildDepends = [ transformers ];
meta = {
homepage = "http://github.com/ekmett/transformers-compat/";
description = "A small compatibility shim exposing the new types from transformers 0.3 and 0.4 to older Haskell platforms.";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
})

View File

@ -0,0 +1,42 @@
{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck
, random, stm, testFramework, testFrameworkHunit
, testFrameworkQuickcheck2, time, zlib, fetchgit
}:
cabal.mkDerivation (self: {
pname = "Cabal";
version = "9e87d6a3";
src = fetchgit {
url = git://github.com/ghcjs/cabal.git;
rev = "520591876ee57dbecba1b2de602dc79f4f67ecce"; # Must be from the ghcjs branch
sha256 = "f59182661707c65a2a014aa91b5e0d53cbefb6c999c1982757f476619b6728c0";
};
preConfigure = "cd Cabal";
configureFlags = "--program-suffix=-js";
# jww (2014-05-31): Why is this failing?
# BuildDeps/InternalLibrary4:
# : [Failed]
# expected: 'setup install' should succeed
# output: "/private/var/folders/8h/tky3qz1d63l05l5jp_nzwzjr0000gn/T/nix-build-haskell-Cabal-ghcjs-ghc7.8.2-9e87d6a3-shared.drv-0/git-export/Cabal/tests/Setup configure --user -w /nix/store/v1gr2sk0117ycn9bmwyp3whgxqkbd5sl-ghc-7.8.2-wrapper/bin/ghc" in PackageTests/BuildDeps/InternalLibrary4/to-install
# Configuring InternalLibrary4-0.2...
# Setup: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
# Cabal. Use the flag --package-db to specify a package database (it can be used
# multiple times).
doCheck = false;
buildDepends = [
filepath HTTP mtl network random stm time zlib QuickCheck
];
testDepends = [
filepath HTTP HUnit mtl network QuickCheck stm testFramework
testFrameworkHunit testFrameworkQuickcheck2 time zlib
];
meta = {
homepage = "http://www.haskell.org/cabal/";
description = "The command-line interface for Cabal and Hackage";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.andres ];
};
})

View File

@ -0,0 +1,33 @@
{ cabal, CabalGhcjs, filepath, HTTP, HUnit, mtl, network, QuickCheck
, random, stm, testFramework, testFrameworkHunit
, testFrameworkQuickcheck2, time, zlib, fetchgit
}:
cabal.mkDerivation (self: {
pname = "cabal-install-ghcjs";
version = "9e87d6a3";
src = CabalGhcjs.src;
isLibrary = true;
isExecutable = true;
doCheck = false;
configureFlags = "--program-suffix=-js";
preConfigure = "cd cabal-install";
buildDepends = [
CabalGhcjs filepath HTTP mtl network random stm time zlib
];
testDepends = [
CabalGhcjs filepath HTTP HUnit mtl network QuickCheck stm testFramework
testFrameworkHunit testFrameworkQuickcheck2 time zlib
];
postInstall = ''
mkdir $out/etc
mv bash-completion $out/etc/bash_completion.d
'';
meta = {
homepage = "http://www.haskell.org/cabal/";
description = "The command-line interface for Cabal and Hackage";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.andres ];
};
})

View File

@ -0,0 +1,103 @@
{ nodejs, cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time
, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative
, parallel, safe, shelly, split, stringsearch, syb, systemFileio
, systemFilepath, tar, terminfo, textBinary, unorderedContainers
, vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
, automake, libtool, cabalInstallGhcjs, gmp, base16Bytestring
, cryptohash, executablePath, transformersCompat
, haddock, hspec, xhtml, primitive
}:
cabal.mkDerivation (self: rec {
pname = "ghcjs";
version = "0.1.0";
src = fetchgit {
url = git://github.com/ghcjs/ghcjs.git;
rev = "fd034b7e6fb61120d22f1c314398f37a673b8b1d";
sha256 = "0182bb706cc263a6d268eb61e243214186abae7b81dec420187c858e989c4dba";
};
/*
bootSrc = fetchgit {
url = git://github.com/ghcjs/ghcjs-boot.git;
rev = "f9f79d0cf40212943bcc1ad2672f2e0a7af2b7c9";
sha256 = "83f1706bcf7e666f6fb6dee455517e0efb019aabd1393f444c80169f04b9d3b8";
};
*/
shims = fetchgit {
url = git://github.com/ghcjs/shims.git;
rev = "dc5bb54778f3dbba4b463f4f7df5f830f14d1cb6";
sha256 = "fcef2879df0735b1011a8642a7c3e0e3f39b7d395830b91a992658f4ff67c9ce";
};
isLibrary = true;
isExecutable = true;
jailbreak = true;
noHaddock = true;
haddockInternal = cabal.mkDerivation (self: {
pname = "haddock-internal";
version = "2.14.3";
src = fetchgit {
url = git://github.com/ghcjs/haddock-internal.git;
rev = "47758773d6b20c395a1c76a93830070fde71dbab";
sha256 = "df1a024631b7781fcbda09d2b33a56650959b8ab6c831151b456133226ab90b2";
};
buildDepends = [ QuickCheck ghcPaths haddock hspec xhtml ]; # Can't specify Cabal here, or it ends up being the wrong version
doCheck = false;
});
ghcjsPrim = cabal.mkDerivation (self: {
pname = "ghcjs-prim";
version = "0.1.0.0";
src = fetchgit {
url = git://github.com/ghcjs/ghcjs-prim.git;
rev = "659d6ceb45b1b8ef526c7451d90afff80d76e2f5";
sha256 = "55b64d93cdc8220042a35ea12f8c53e82f78b51bc0f87ddd12300ad56e4b7ba7";
};
buildDepends = [ primitive ];
});
buildDepends = [
filepath HTTP mtl network random stm time zlib aeson attoparsec
bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta
lens optparseApplicative parallel safe shelly split
stringsearch syb systemFileio systemFilepath tar terminfo textBinary
unorderedContainers vector wlPprintText yaml
alex happy git gnumake gcc autoconf automake libtool patch gmp
base16Bytestring cryptohash executablePath haddockInternal
transformersCompat QuickCheck haddock hspec xhtml
ghcjsPrim
];
buildTools = [ nodejs git ];
testDepends = [
HUnit regexPosix testFramework testFrameworkHunit
];
postConfigure = ''
echo Patching ghcjs with absolute paths to the Nix store
sed -i -e "s|getAppUserDataDirectory \"ghcjs\"|return \"$out/share/ghcjs\"|" \
src/Compiler/Info.hs
sed -i -e "s|str = \\[\\]|str = [\"--prefix=$out\", \"--libdir=$prefix/lib/$compiler\", \"--libsubdir=$pkgid\"]|" \
src-bin/Boot.hs
'';
postInstall = ''
export HOME=$(pwd)
export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt
git clone git://github.com/ghcjs/ghcjs-boot.git
cd ghcjs-boot
git checkout f9f79d0cf40212943bcc1ad2672f2e0a7af2b7c9
git submodule update --init --recursive
( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot )
chmod -R u+w . # because fetchgit made it read-only
local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2
ensureDir $GHCJS_LIBDIR
cp -R ${shims} $GHCJS_LIBDIR/shims
${cabalInstallGhcjs}/bin/cabal-js update
PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --dev --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib
'';
meta = {
homepage = "https://github.com/ghcjs/ghcjs";
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.jwiegley ];
};
})

View File

@ -1,6 +1,4 @@
# This file was auto-generated by cabal2nix. Please do NOT edit manually!
{ cabal, polyparse }:
{ cabal, polyparse, oldTime }:
cabal.mkDerivation (self: {
pname = "cpphs";
@ -8,11 +6,12 @@ cabal.mkDerivation (self: {
sha256 = "0bqfz0wkfnxvv711fgmhmh6rbwffgna1pfqbj7whb6crqji9w7g7";
isLibrary = true;
isExecutable = true;
buildDepends = [ polyparse ];
buildDepends = [ oldTime polyparse ];
meta = {
homepage = "http://projects.haskell.org/cpphs/";
description = "A liberalised re-implementation of cpp, the C pre-processor";
license = "LGPL";
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.andres ];
};
})

View File

@ -2991,6 +2991,7 @@ let
haskellPackages_ghc783_profiling = recurseIntoAttrs haskell.packages_ghc783.profiling;
haskellPackages_ghc783 = recurseIntoAttrs haskell.packages_ghc783.highPrio;
haskellPackages_ghcHEAD = haskell.packages_ghcHEAD;
haskellPackages_ghcjs = haskell.packages_ghcjs;
haskellPlatformPackages = recurseIntoAttrs (import ../development/libraries/haskell/haskell-platform { inherit pkgs; });

View File

@ -143,20 +143,23 @@
# Abstraction for Haskell packages collections
packagesFun = makeOverridable
({ ghcPath
({ ghcPath ? null
, ghc ? callPackage ghcPath ({ ghc = ghcBinary; } // extraArgs)
, ghcBinary ? ghc6101Binary
, prefFun
, extension ? (self : super : {})
, profExplicit ? false, profDefault ? false
, modifyPrio ? lowPrio
, extraArgs ? {}
, cabalPackage ? import ../build-support/cabal
, ghcWrapperPackage ? import ../development/compilers/ghc/wrapper.nix
} :
let haskellPackagesClass = import ./haskell-packages.nix {
inherit pkgs newScope modifyPrio;
inherit pkgs newScope modifyPrio cabalPackage ghcWrapperPackage;
enableLibraryProfiling =
if profExplicit then profDefault
else config.cabal.libraryProfiling or profDefault;
ghc = callPackage ghcPath ({ ghc = ghcBinary; } // extraArgs);
inherit ghc;
};
haskellPackagesPrefsClass = self : let super = haskellPackagesClass self; in super // prefFun self super;
haskellPackagesExtensionClass = self : let super = haskellPackagesPrefsClass self; in super // extension self super;
@ -228,6 +231,136 @@
prefFun = ghc783Prefs;
};
packages_ghcjs =
let parent = packages_ghc783.override {
extension = self: super: {
ghcjs = super.ghcjs.override {
Cabal = packages_ghc783.CabalGhcjs;
};
transformersCompat = super.transformersCompat_0_3_3_3;
haddock = super.haddock.override {
Cabal = null;
};
};
};
in packages {
ghc = parent.ghcjs // { inherit parent; };
cabalPackage = import ../build-support/cabal/ghcjs.nix;
ghcWrapperPackage = import ../development/compilers/ghcjs/wrapper.nix;
prefFun = self : super : super // {
# This is the list of packages that are built into a booted ghcjs installation
# It can be generated with the command:
# nix-shell '<nixpkgs>' -A pkgs.haskellPackages_ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/-\(.\)/\U\1/' | sed 's/^\([^_]*\)\(.*\)$/\1\2 = null;\n\1 = self.\1\2;/'"
Cabal_1_21_0_0 = null;
Cabal = self.Cabal_1_21_0_0;
aeson_0_8_0_0 = null;
aeson = self.aeson_0_8_0_0;
array_0_5_0_0 = null;
array = self.array_0_5_0_0;
async_2_0_1_5 = null;
async = self.async_2_0_1_5;
attoparsec_0_12_1_0 = null;
attoparsec = self.attoparsec_0_12_1_0;
base_4_7_0_1 = null;
base = self.base_4_7_0_1;
binary_0_7_2_1 = null;
binary = self.binary_0_7_2_1;
rts_1_0 = null;
rts = self.rts_1_0;
# bytestring_0_10_4_1 = null;
# bytestring = self.bytestring_0_10_4_1;
caseInsensitive_1_2_0_0 = null;
caseInsensitive = self.caseInsensitive_1_2_0_0;
containers_0_5_5_1 = null;
containers = self.containers_0_5_5_1;
deepseq_1_3_0_2 = null;
deepseq = self.deepseq_1_3_0_2;
directory_1_2_1_0 = null;
directory = self.directory_1_2_1_0;
dlist_0_7_0_1 = null;
dlist = self.dlist_0_7_0_1;
extensibleExceptions_0_1_1_3 = null;
extensibleExceptions = self.extensibleExceptions_0_1_1_3;
filepath_1_3_0_2 = null;
filepath = self.filepath_1_3_0_2;
ghcPrim_0_3_1_0 = null;
ghcPrim = self.ghcPrim_0_3_1_0;
ghcjsBase_0_1_0_0 = null;
ghcjsBase = self.ghcjsBase_0_1_0_0;
ghcjsPrim_0_1_0_0 = null;
ghcjsPrim = self.ghcjsPrim_0_1_0_0;
hashable_1_2_2_0 = null;
hashable = self.hashable_1_2_2_0;
integerGmp_0_5_1_0 = null;
integerGmp = self.integerGmp_0_5_1_0;
mtl_2_2_1 = null;
mtl = self.mtl_2_2_1;
oldLocale_1_0_0_6 = null;
oldLocale = self.oldLocale_1_0_0_6;
oldTime_1_1_0_2 = null;
oldTime = self.oldTime_1_1_0_2;
parallel_3_2_0_4 = null;
parallel = self.parallel_3_2_0_4;
pretty_1_1_1_1 = null;
pretty = self.pretty_1_1_1_1;
primitive_0_5_3_0 = null;
primitive = self.primitive_0_5_3_0;
process_1_2_0_0 = null;
process = self.process_1_2_0_0;
scientific_0_3_3_0 = null;
scientific = self.scientific_0_3_3_0;
stm_2_4_3 = null;
stm = self.stm_2_4_3;
syb_0_4_2 = null;
syb = self.syb_0_4_2;
# templateHaskell_2_9_0_0 = null;
# templateHaskell = self.templateHaskell_2_9_0_0;
text_1_1_1_3 = null;
text = self.text_1_1_1_3;
time_1_4_2 = null;
time = self.time_1_4_2;
transformers_0_4_1_0 = null;
transformers = self.transformers_0_4_1_0;
unix_2_7_0_1 = null;
unix = self.unix_2_7_0_1;
unorderedContainers_0_2_5_0 = null;
unorderedContainers = self.unorderedContainers_0_2_5_0;
vector_0_10_11_0 = null;
vector = self.vector_0_10_11_0;
# This is necessary because haskell-packages will refuse to generate tfRandom for this version of ghc (0.1.0)
#TODO: haskell-packages shouldn't use the ghcjs version as the ghc version
tfRandom = self.callPackage ../development/libraries/haskell/tf-random {};
/*
buildLocalCabalWithArgs = { src, name, args ? {}, cabalDrvArgs ? { jailbreak = true; }, cabal2nix ? packages_ghc783.cabal2nix }: let
cabalExpr = pkgs.stdenv.mkDerivation ({
name = "${name}.nix";
buildCommand = ''
${cabal2nix}/bin/cabal2nix ${src + "/${name}.cabal"} --sha256=FILTERME \
| grep -v FILTERME | sed \
-e 's/licenses.proprietary/licenses.unfree/' \
-e 's/{ cabal/{ cabal, cabalInstall, cabalDrvArgs ? {}, src/' \
-e 's/cabal.mkDerivation (self: {/cabal.mkDerivation (self: cabalDrvArgs \/\/ {/' \
-e 's/buildDepends = \[/buildDepends = \[ cabalInstall/' \
-e 's/pname = \([^\n]*\)/pname = \1\n inherit src;\n/' > $out
'';
} // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
});
in self.callPackage cabalExpr ({ inherit src cabalDrvArgs; } // args);
*/
};
extension = self: super: {
buildLocalCabalWithArgs = args: super.buildLocalCabalWithArgs (args // {
cabal2nix = packages_ghc783.cabal2nix;
});
};
};
packages_ghc763 =
packages { ghcPath = ../development/compilers/ghc/7.6.3.nix;
ghcBinary = ghc704Binary;

View File

@ -43,7 +43,7 @@
#
# For most packages, however, we keep only one version, and use default.nix.
{ pkgs, newScope, ghc, modifyPrio ? (x : x)
{ pkgs, newScope, ghc, cabalPackage, ghcWrapperPackage, modifyPrio ? (x : x)
, enableLibraryProfiling ? false
, enableSharedLibraries ? pkgs.stdenv.lib.versionOlder "7.7" ghc.version
, enableSharedExecutables ? pkgs.stdenv.lib.versionOlder "7.7" ghc.version
@ -74,7 +74,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
# refers to the function argument at the
# top of this file.
ghc = callPackage ../development/compilers/ghc/wrapper.nix {
ghc = callPackage ghcWrapperPackage {
ghc = ghc; # refers to ghcPlain
};
@ -94,7 +94,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
# This is the Cabal builder, the function we use to build most Haskell
# packages. It isn't the Cabal library, which is spelled "Cabal".
cabal = callPackage ../build-support/cabal {
cabal = callPackage cabalPackage {
Cabal = null; # prefer the Cabal version shipped with the compiler
hscolour = self.hscolourBootstrap;
inherit enableLibraryProfiling enableCheckPhase
@ -895,7 +895,11 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
cabal = self.cabal.override { enableLibraryProfiling = false; }; # pkg cannot be built with profiling enabled
};
ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {};
ghcjs = callPackage ../development/tools/haskell/ghcjs {
Cabal = self.Cabal_1_18_1_3;
};
ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-dom {};
ghcjsCodemirror = callPackage ../development/libraries/haskell/ghcjs-codemirror {};
@ -1455,7 +1459,9 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
lazysmallcheck = callPackage ../development/libraries/haskell/lazysmallcheck {};
lens = callPackage ../development/libraries/haskell/lens {};
lens_4_2 = callPackage ../development/libraries/haskell/lens/4.2.nix {};
lens_4_4 = callPackage ../development/libraries/haskell/lens/4.4.nix {};
lens = self.lens_4_4;
lensAeson = callPackage ../development/libraries/haskell/lens-aeson {};
@ -2462,6 +2468,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
text_1_1_1_3 = callPackage ../development/libraries/haskell/text/1.1.1.3.nix {};
text = self.text_1_1_1_3;
textBinary = callPackage ../development/libraries/haskell/text-binary {};
textFormat = callPackage ../development/libraries/haskell/text-format {};
textIcu = callPackage ../development/libraries/haskell/text-icu {};
@ -2531,6 +2539,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
transformersBase = callPackage ../development/libraries/haskell/transformers-base {};
transformersCompat_0_3_3 = callPackage ../development/libraries/haskell/transformers-compat/0.3.3.nix {};
transformersCompat_0_3_3_3 = callPackage ../development/libraries/haskell/transformers-compat/0.3.3.3.nix {};
transformersCompat_0_3_3_4 = callPackage ../development/libraries/haskell/transformers-compat/0.3.3.4.nix {};
transformersCompat = self.transformersCompat_0_3_3_4;
@ -2884,6 +2893,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
cake3 = callPackage ../development/tools/haskell/cake3 {};
oldTime_1_1_0_2 = callPackage ../development/libraries/haskell/old-time/1.1.0.2.nix {};
oldTime = null; # By default, use the built-in old-time library
cpphs = callPackage ../development/tools/misc/cpphs {};
DrIFT = callPackage ../development/tools/haskell/DrIFT {};
@ -2997,12 +3008,12 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
cabal2nix = callPackage ../development/tools/haskell/cabal2nix {};
# Build a cabal package given a local .cabal file
buildLocalCabalWithArgs = { src, name, args ? {}, cabalDrvArgs ? { jailbreak = true; } }: let
buildLocalCabalWithArgs = { src, name, args ? {}, cabalDrvArgs ? { jailbreak = true; }, cabal2nix }: let
cabalExpr = pkgs.stdenv.mkDerivation ({
name = "${name}.nix";
buildCommand = ''
${self.cabal2nix}/bin/cabal2nix ${src + "/${name}.cabal"} --sha256=FILTERME \
${cabal2nix}/bin/cabal2nix ${src + "/${name}.cabal"} --sha256=FILTERME \
| grep -v FILTERME | sed \
-e 's/licenses.proprietary/licenses.unfree/' \
-e 's/{ cabal/{ cabal, cabalInstall, cabalDrvArgs ? {}, src/' \
@ -3044,6 +3055,19 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
cabalInstall_1_20_0_3 = callPackage ../tools/package-management/cabal-install/1.20.0.3.nix { Cabal = self.Cabal_1_20_0_2; };
cabalInstall = self.cabalInstall_1_20_0_3;
CabalGhcjs = callPackage ../development/tools/haskell/Cabal-ghcjs {
QuickCheck = self.QuickCheck_2_6;
testFrameworkQuickcheck2 = self.testFrameworkQuickcheck2.override {
QuickCheck = self.QuickCheck_2_6;
};
};
cabalInstallGhcjs = callPackage ../development/tools/haskell/cabal-install-ghcjs {
QuickCheck = self.QuickCheck_2_6;
testFrameworkQuickcheck2 = self.testFrameworkQuickcheck2.override {
QuickCheck = self.QuickCheck_2_6;
};
};
codex = callPackage ../development/tools/haskell/codex {};
commandQq = callPackage ../development/libraries/haskell/command-qq {};