Merge branch 'idris-packaging' of git://github.com/mpickering/nixpkgs
This commit is contained in:
commit
017154391b
|
@ -1,4 +1,4 @@
|
||||||
# Build one of the packages that come with idris
|
# Build one of the packages that comes with idris
|
||||||
# name: The name of the package
|
# name: The name of the package
|
||||||
# deps: The dependencies of the package
|
# deps: The dependencies of the package
|
||||||
{ idris, build-idris-package, lib }: name: deps:
|
{ idris, build-idris-package, lib }: name: deps:
|
||||||
|
@ -6,20 +6,16 @@ let
|
||||||
inherit (builtins.parseDrvName idris.name) version;
|
inherit (builtins.parseDrvName idris.name) version;
|
||||||
in
|
in
|
||||||
build-idris-package {
|
build-idris-package {
|
||||||
name = "${name}-${version}";
|
|
||||||
|
|
||||||
propagatedBuildInputs = deps;
|
|
||||||
|
|
||||||
|
inherit name version;
|
||||||
inherit (idris) src;
|
inherit (idris) src;
|
||||||
|
|
||||||
|
idrisDeps = deps;
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
sourceRoot=$sourceRoot/libs/${name}
|
sourceRoot=$sourceRoot/libs/${name}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
sed -i ${name}.ipkg -e "/^opts/ s|-i \\.\\./|-i $IDRIS_LIBRARY_PATH/|g"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = idris.meta // {
|
meta = idris.meta // {
|
||||||
description = "${name} builtin Idris library";
|
description = "${name} builtin Idris library";
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,23 +1,46 @@
|
||||||
# Build an idris package
|
# Build an idris package
|
||||||
#
|
{ stdenv, idrisPackages, gmp }:
|
||||||
# args: Additional arguments to pass to mkDerivation. Generally should include at least
|
{ idrisDeps ? []
|
||||||
# name and src.
|
, name
|
||||||
{ stdenv, idris, gmp }: args: stdenv.mkDerivation ({
|
, version
|
||||||
buildPhase = ''
|
, src
|
||||||
idris --build *.ipkg
|
, meta
|
||||||
|
, extraBuildInputs ? []
|
||||||
|
, postUnpack ? ""
|
||||||
|
, doCheck ? true
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
idris-with-packages = idrisPackages.with-packages idrisDeps;
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation ({
|
||||||
|
|
||||||
|
name = "${name}-${version}";
|
||||||
|
|
||||||
|
inherit postUnpack src doCheck meta;
|
||||||
|
|
||||||
|
|
||||||
|
# Some packages use the style
|
||||||
|
# opts = -i ../../path/to/package
|
||||||
|
# rather than the declarative pkgs attribute so we have to rewrite the path.
|
||||||
|
postPatch = ''
|
||||||
|
sed -i *.ipkg -e "/^opts/ s|-i \\.\\./|-i ${idris-with-packages}/libs/|g"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doCheck = true;
|
buildPhase = ''
|
||||||
|
${idris-with-packages}/bin/idris --build *.ipkg
|
||||||
|
'';
|
||||||
|
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
if grep -q test *.ipkg; then
|
if grep -q test *.ipkg; then
|
||||||
idris --testpkg *.ipkg
|
${idris-with-packages}/bin/idris --testpkg *.ipkg
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
idris --install *.ipkg --ibcsubdir $IBCSUBDIR
|
${idris-with-packages}/bin/idris --install *.ipkg --ibcsubdir $out/libs
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs = [ gmp idris ];
|
buildInputs = [ gmp ] ++ extraBuildInputs;
|
||||||
} // args)
|
|
||||||
|
propagatedBuildInputs = idrisDeps;
|
||||||
|
})
|
||||||
|
|
|
@ -25,14 +25,8 @@
|
||||||
pruviloj = [ self.prelude self.base ];
|
pruviloj = [ self.prelude self.base ];
|
||||||
};
|
};
|
||||||
|
|
||||||
files = builtins.filter (n: n != "default") (pkgs.lib.mapAttrsToList (name: type: let
|
in
|
||||||
m = builtins.match "(.*)\\.nix" name;
|
{
|
||||||
in if m == null then "default" else builtins.head m) (builtins.readDir ./.));
|
|
||||||
in (builtins.listToAttrs (map (name: {
|
|
||||||
inherit name;
|
|
||||||
|
|
||||||
value = callPackage (./. + "/${name}.nix") {};
|
|
||||||
}) files)) // {
|
|
||||||
inherit idris-no-deps callPackage;
|
inherit idris-no-deps callPackage;
|
||||||
# See #10450 about why we have to wrap the executable
|
# See #10450 about why we have to wrap the executable
|
||||||
idris =
|
idris =
|
||||||
|
@ -40,7 +34,28 @@
|
||||||
idris-no-deps
|
idris-no-deps
|
||||||
{ path = [ pkgs.gcc ]; lib = [pkgs.gmp]; };
|
{ path = [ pkgs.gcc ]; lib = [pkgs.gmp]; };
|
||||||
|
|
||||||
|
|
||||||
|
with-packages = callPackage ./with-packages.nix {} ;
|
||||||
|
|
||||||
|
build-builtin-package = callPackage ./build-builtin-package.nix {};
|
||||||
|
|
||||||
|
build-idris-package = callPackage ./build-idris-package.nix {};
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
|
||||||
# A list of all of the libraries that come with idris
|
# A list of all of the libraries that come with idris
|
||||||
builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins_;
|
builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins_;
|
||||||
|
|
||||||
|
httpclient = callPackage ./httpclient.nix {};
|
||||||
|
|
||||||
|
lightyear = callPackage ./lightyear.nix {};
|
||||||
|
|
||||||
|
optparse = callPackage ./optparse.nix {};
|
||||||
|
|
||||||
|
wl-pprint = callPackage ./wl-pprint.nix {};
|
||||||
|
|
||||||
|
specdris = callPackage ./specdris.nix {};
|
||||||
|
|
||||||
|
|
||||||
} // builtins_;
|
} // builtins_;
|
||||||
in fix' (extends overrides idrisPackages)
|
in fix' (extends overrides idrisPackages)
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
{ pkgs
|
{ curl
|
||||||
, build-idris-package
|
, build-idris-package
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, lightyear
|
, lightyear
|
||||||
, contrib
|
, contrib
|
||||||
|
, effects
|
||||||
|
, prelude
|
||||||
|
, base
|
||||||
, lib
|
, lib
|
||||||
, idris
|
, idris
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
date = "2016-12-20";
|
|
||||||
in
|
in
|
||||||
build-idris-package {
|
build-idris-package {
|
||||||
name = "httpclient-${date}";
|
name = "httpclient";
|
||||||
|
version = "2016-12-20";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "justjoheinz";
|
owner = "justjoheinz";
|
||||||
|
@ -20,11 +23,14 @@ build-idris-package {
|
||||||
sha256 = "0sy0q7gri9lwbqdmx9720pby3w1470w7wzn62bf2rir532219hhl";
|
sha256 = "0sy0q7gri9lwbqdmx9720pby3w1470w7wzn62bf2rir532219hhl";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [ pkgs.curl lightyear contrib ];
|
idrisDeps = [ prelude base effects lightyear contrib ];
|
||||||
|
|
||||||
|
extraBuildInputs = [ curl ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "HTTP Client for Idris";
|
description = "HTTP Client for Idris";
|
||||||
homepage = https://github.com/justjoheinz/idris-httpclient;
|
homepage = https://github.com/justjoheinz/idris-httpclient;
|
||||||
inherit (idris.meta) platforms;
|
inherit (idris.meta) platforms;
|
||||||
|
broken = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,5 @@ symlinkJoin {
|
||||||
wrapProgram $out/bin/idris \
|
wrapProgram $out/bin/idris \
|
||||||
--suffix PATH : ${ stdenv.lib.makeBinPath path } \
|
--suffix PATH : ${ stdenv.lib.makeBinPath path } \
|
||||||
--suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib}
|
--suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib}
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,11 @@
|
||||||
let
|
let
|
||||||
date = "2017-09-10";
|
date = "2017-09-10";
|
||||||
in
|
in
|
||||||
build-idris-package {
|
build-idris-package {
|
||||||
name = "lightyear-${date}";
|
name = "lightyear";
|
||||||
|
version = date;
|
||||||
|
|
||||||
|
idrisDeps = [ prelude base effects ];
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ziman";
|
owner = "ziman";
|
||||||
|
@ -20,8 +23,6 @@ build-idris-package {
|
||||||
sha256 = "05x66abhpbdm6yr0afbwfk6w04ysdk78gylj5alhgwhy4jqakv29";
|
sha256 = "05x66abhpbdm6yr0afbwfk6w04ysdk78gylj5alhgwhy4jqakv29";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [ prelude base effects ];
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Parser combinators for Idris";
|
description = "Parser combinators for Idris";
|
||||||
homepage = https://github.com/ziman/lightyear;
|
homepage = https://github.com/ziman/lightyear;
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
# Library import path
|
|
||||||
export IDRIS_LIBRARY_PATH=$PWD/idris-libs
|
|
||||||
mkdir -p $IDRIS_LIBRARY_PATH
|
|
||||||
|
|
||||||
# Library install path
|
|
||||||
export IBCSUBDIR=$out/lib/@name@
|
|
||||||
mkdir -p $IBCSUBDIR
|
|
||||||
|
|
||||||
addIdrisLibs () {
|
|
||||||
if [ -d $1/lib/@name@ ]; then
|
|
||||||
ln -sv $1/lib/@name@/* $IDRIS_LIBRARY_PATH
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# All run-time deps
|
|
||||||
addEnvHooks 1 addIdrisLibs
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
date = "2017-11-11";
|
date = "2017-11-11";
|
||||||
in
|
in
|
||||||
build-idris-package {
|
build-idris-package {
|
||||||
name = "specdris-${date}";
|
name = "specdris";
|
||||||
|
version = date;
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
url = "https://github.com/pheymann/specdris";
|
url = "https://github.com/pheymann/specdris";
|
||||||
|
@ -19,21 +20,10 @@ build-idris-package {
|
||||||
sha256 = "4813c4be1d4c3dd1dad35964b085f83cf9fb44b16824257c72b468d4bafd0e4f";
|
sha256 = "4813c4be1d4c3dd1dad35964b085f83cf9fb44b16824257c72b468d4bafd0e4f";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [ prelude base effects ];
|
idrisDeps = [ prelude base effects idris ];
|
||||||
|
|
||||||
buildPhase = ''
|
# The tests attribute is very strange as the tests are a different ipkg
|
||||||
${idris}/bin/idris --build specdris.ipkg
|
doCheck = false;
|
||||||
'';
|
|
||||||
|
|
||||||
checkPhase = ''
|
|
||||||
cd test/
|
|
||||||
${idris}/bin/idris --testpkg test.ipkg
|
|
||||||
cd ../
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
${idris}/bin/idris --install specdris.ipkg --ibcsubdir $IBCSUBDIR
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "A testing library for Idris";
|
description = "A testing library for Idris";
|
||||||
|
|
|
@ -1,46 +1,20 @@
|
||||||
# Build a version of idris with a set of packages visible
|
# Build a version of idris with a set of packages visible
|
||||||
# packages: The packages visible to idris
|
# packages: The packages visible to idris
|
||||||
{ stdenv, idris }: packages: stdenv.mkDerivation {
|
{ stdenv, idris, symlinkJoin, makeWrapper }: packages:
|
||||||
inherit (idris) name;
|
|
||||||
|
|
||||||
buildInputs = packages;
|
let paths = stdenv.lib.closePropagation packages;
|
||||||
|
in
|
||||||
|
symlinkJoin {
|
||||||
|
|
||||||
preHook = ''
|
name = idris.name + "-with-packages";
|
||||||
mkdir -p $out/lib/${idris.name}
|
|
||||||
|
|
||||||
installIdrisLib () {
|
paths = paths ++ [idris] ;
|
||||||
if [ -d $1/lib/${idris.name} ]; then
|
|
||||||
ln -fsv $1/lib/${idris.name}/* $out/lib/${idris.name}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
envHostTargetHooks+=(installIdrisLib)
|
buildInputs = [ makeWrapper ];
|
||||||
'';
|
|
||||||
|
|
||||||
unpackPhase = ''
|
postBuild = ''
|
||||||
cat >idris.c <<EOF
|
wrapProgram $out/bin/idris \
|
||||||
#include <stdlib.h>
|
--set IDRIS_LIBRARY_PATH $out/libs
|
||||||
#include <unistd.h>
|
'';
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main (int argc, char ** argv) {
|
|
||||||
/* idris currently only supports a single library path, so respect it if the user set it */
|
|
||||||
setenv("IDRIS_LIBRARY_PATH", "$out/lib/${idris.name}", 0);
|
|
||||||
execv("${idris}/bin/idris", argv);
|
|
||||||
perror("executing ${idris}/bin/idris");
|
|
||||||
return 127;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
$CC -O3 -o idris idris.c
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
mv idris $out/bin
|
|
||||||
'';
|
|
||||||
|
|
||||||
stripAllList = [ "bin" ];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
, idris
|
, idris
|
||||||
}:
|
}:
|
||||||
build-idris-package {
|
build-idris-package {
|
||||||
name = "wl-pprint-2016-09-28";
|
pkName = "wl-pprint";
|
||||||
|
version = "2016-09-28";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "shayan-najd";
|
owner = "shayan-najd";
|
||||||
|
@ -19,7 +20,7 @@ build-idris-package {
|
||||||
# updating this package again.
|
# updating this package again.
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
propagatedBuildInputs = [ prelude base ];
|
idrisDeps = [ prelude base ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Wadler-Leijen pretty-printing library";
|
description = "Wadler-Leijen pretty-printing library";
|
||||||
|
|
Loading…
Reference in New Issue