Add builtin idris packages to idrisPackages

This commit is contained in:
Shea Levy 2015-11-27 09:35:59 -05:00
parent 5898c20604
commit efbee054fd
4 changed files with 82 additions and 10 deletions

View file

@ -0,0 +1,12 @@
{ idris, buildIdrisPackage }: name: deps: buildIdrisPackage (args: {
inherit name;
propagatedBuildInputs = deps;
inherit (idris) src;
postUnpack = ''
mv $sourceRoot/libs/${name} $IDRIS_LIBRARY_PATH
sourceRoot=$IDRIS_LIBRARY_PATH/${name}
'';
})

View file

@ -0,0 +1,34 @@
{ stdenv, idris }: argf: let args = {
preHook = ''
mkdir idris-libs
export IDRIS_LIBRARY_PATH=$PWD/idris-libs
addIdrisLibs () {
if [ -d $1/lib/${idris.name} ]; then
ln -sv $1/lib/${idris.name}/* $IDRIS_LIBRARY_PATH
fi
}
envHooks+=(addIdrisLibs)
'';
configurePhase = ''
export TARGET=$out/lib/${idris.name}
'';
buildPhase = ''
${idris}/bin/idris --build *.ipkg
'';
doCheck = true;
checkPhase = ''
if grep -q test *.ipkg; then
${idris}/bin/idris --testpkg *.ipkg
fi
'';
installPhase = ''
${idris}/bin/idris --install *.ipkg
'';
}; in stdenv.mkDerivation (args // (argf args))

View file

@ -12,7 +12,27 @@
defaultScope = mkScope self;
callPackage = callPackageWithScope defaultScope;
buildBuiltinPackage = callPackage ./build-builtin-package.nix {};
builtins = pkgs.lib.mapAttrs buildBuiltinPackage {
prelude = [];
base = [ self.prelude ];
contrib = [ self.prelude self.base ];
effects = [ self.prelude self.base ];
pruviloj = [ self.prelude self.base ];
};
in {
withPackages = packages: callPackage ./with-packages-wrapper.nix { inherit packages idris; };
};
inherit idris;
withPackages = callPackage ./with-packages-wrapper.nix {};
buildIdrisPackage = callPackage ./build-idris-package.nix {};
builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins;
} // builtins;
in fix' (extends overrides idrisPackages)

View file

@ -1,7 +1,19 @@
{ stdenv, idris, packages }: stdenv.mkDerivation {
{ stdenv, idris }: buildInputs: stdenv.mkDerivation {
inherit (idris) name;
inherit packages;
inherit buildInputs;
preHook = ''
mkdir -p $out/lib/${idris.name}
installIdrisLib () {
if [ -d $1/lib/${idris.name} ]; then
ln -sv $1/lib/${idris.name}/* $out/lib/${idris.name}
fi
}
envHooks+=(installIdrisLib)
'';
unpackPhase = ''
cat >idris.c <<EOF
@ -24,12 +36,6 @@
'';
installPhase = ''
mkdir -p $out/lib/${idris.name}
for package in $packages
do
ln -sv $package/lib/${idris.name}/* $out/lib/${idris.name}
done
mkdir -p $out/bin
mv idris $out/bin
'';