git.iko.soy/typeable/nixpkgs
on master help sign in
Merge branch 'idris-packaging' of git://github.com/mpickering/nixpkgs
commit017154391b4a2a4e418640d3a7677274fe981dc9 authorShea Levy <shea@shealevy.com> dateThu 15 Feb 2018, 10:11 (9 years ago) parent8d7b069947e7d8
10 files changed+95−108
pkgs/development/idris-modules/build-builtin-package.nix+4−8 pkgs/development/idris-modules/build-idris-package.nix+34−11 pkgs/development/idris-modules/default.nix+23−8 pkgs/development/idris-modules/httpclient.nix+10−4 pkgs/development/idris-modules/idris-wrapper.nix−3 pkgs/development/idris-modules/lightyear.nix+5−4 pkgs/development/idris-modules/setup-hook.sh−16 pkgs/development/idris-modules/specdris.nix+5−15 pkgs/development/idris-modules/with-packages.nix+11−37 pkgs/development/idris-modules/wl-pprint.nix+3−2
pkgs/development/idris-modules/build-builtin-package.nix+4−8
@@ -1,4 +1,4 @@
1−# Build one of the packages that come with idris
1+# Build one of the packages that comes with idris
22# name: The name of the package
33# deps: The dependencies of the package
44{ idris, build-idris-package, lib }: name: deps:
@@ -6,20 +6,16 @@ let
66 inherit (builtins.parseDrvName idris.name) version;
77in
88build-idris-package {
9− name = "${name}-${version}";
10−
11− propagatedBuildInputs = deps;
129
10+ inherit name version;
1311 inherit (idris) src;
1412
13+ idrisDeps = deps;
14+
1515 postUnpack = ''
1616 sourceRoot=$sourceRoot/libs/${name}
1717 '';
1818
19− postPatch = ''
20− sed -i ${name}.ipkg -e "/^opts/ s|-i \\.\\./|-i $IDRIS_LIBRARY_PATH/|g"
21− '';
22−
2319 meta = idris.meta // {
2420 description = "${name} builtin Idris library";
2521 };
pkgs/development/idris-modules/build-idris-package.nix+34−11
@@ -1,23 +1,46 @@
11# Build an idris package
2−#
3−# args: Additional arguments to pass to mkDerivation. Generally should include at least
4−# name and src.
5−{ stdenv, idris, gmp }: args: stdenv.mkDerivation ({
6− buildPhase = ''
7− idris --build *.ipkg
2+{ stdenv, idrisPackages, gmp }:
3+ { idrisDeps ? []
4+ , name
5+ , version
6+ , src
7+ , meta
8+ , extraBuildInputs ? []
9+ , postUnpack ? ""
10+ , doCheck ? true
11+ }:
12+let
13+ idris-with-packages = idrisPackages.with-packages idrisDeps;
14+in
15+stdenv.mkDerivation ({
16+
17+ name = "${name}-${version}";
18+
19+ inherit postUnpack src doCheck meta;
20+
21+
22+ # Some packages use the style
23+ # opts = -i ../../path/to/package
24+ # rather than the declarative pkgs attribute so we have to rewrite the path.
25+ postPatch = ''
26+ sed -i *.ipkg -e "/^opts/ s|-i \\.\\./|-i ${idris-with-packages}/libs/|g"
827 '';
928
10− doCheck = true;
29+ buildPhase = ''
30+ ${idris-with-packages}/bin/idris --build *.ipkg
31+ '';
1132
1233 checkPhase = ''
1334 if grep -q test *.ipkg; then
14− idris --testpkg *.ipkg
35+ ${idris-with-packages}/bin/idris --testpkg *.ipkg
1536 fi
1637 '';
1738
1839 installPhase = ''
19− idris --install *.ipkg --ibcsubdir $IBCSUBDIR
40+ ${idris-with-packages}/bin/idris --install *.ipkg --ibcsubdir $out/libs
2041 '';
2142
22− buildInputs = [ gmp idris ];
23−} // args)
43+ buildInputs = [ gmp ] ++ extraBuildInputs;
44+
45+ propagatedBuildInputs = idrisDeps;
46+})
pkgs/development/idris-modules/default.nix+23−8
@@ -25,14 +25,8 @@
2525 pruviloj = [ self.prelude self.base ];
2626 };
2727
28− files = builtins.filter (n: n != "default") (pkgs.lib.mapAttrsToList (name: type: let
29− m = builtins.match "(.*)\\.nix" name;
30− in if m == null then "default" else builtins.head m) (builtins.readDir ./.));
31− in (builtins.listToAttrs (map (name: {
32− inherit name;
33−
34− value = callPackage (./. + "/${name}.nix") {};
35− }) files)) // {
28+ in
29+ {
3630 inherit idris-no-deps callPackage;
3731 # See #10450 about why we have to wrap the executable
3832 idris =
@@ -40,7 +34,28 @@
4034 idris-no-deps
4135 { path = [ pkgs.gcc ]; lib = [pkgs.gmp]; };
4236
37+
38+ with-packages = callPackage ./with-packages.nix {} ;
39+
40+ build-builtin-package = callPackage ./build-builtin-package.nix {};
41+
42+ build-idris-package = callPackage ./build-idris-package.nix {};
43+
44+ # Libraries
45+
4346 # A list of all of the libraries that come with idris
4447 builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins_;
48+
49+ httpclient = callPackage ./httpclient.nix {};
50+
51+ lightyear = callPackage ./lightyear.nix {};
52+
53+ optparse = callPackage ./optparse.nix {};
54+
55+ wl-pprint = callPackage ./wl-pprint.nix {};
56+
57+ specdris = callPackage ./specdris.nix {};
58+
59+
4560 } // builtins_;
4661in fix' (extends overrides idrisPackages)
pkgs/development/idris-modules/httpclient.nix+10−4
@@ -1,17 +1,20 @@
1−{ pkgs
1+{ curl
22, build-idris-package
33, fetchFromGitHub
44, lightyear
55, contrib
6+, effects
7+, prelude
8+, base
69, lib
710, idris
811}:
912
1013let
11− date = "2016-12-20";
1214in
1315build-idris-package {
14− name = "httpclient-${date}";
16+ name = "httpclient";
17+ version = "2016-12-20";
1518
1619 src = fetchFromGitHub {
1720 owner = "justjoheinz";
@@ -20,11 +23,14 @@ build-idris-package {
2023 sha256 = "0sy0q7gri9lwbqdmx9720pby3w1470w7wzn62bf2rir532219hhl";
2124 };
2225
23− propagatedBuildInputs = [ pkgs.curl lightyear contrib ];
26+ idrisDeps = [ prelude base effects lightyear contrib ];
27+
28+ extraBuildInputs = [ curl ];
2429
2530 meta = {
2631 description = "HTTP Client for Idris";
2732 homepage = https://github.com/justjoheinz/idris-httpclient;
2833 inherit (idris.meta) platforms;
34+ broken = true;
2935 };
3036}
pkgs/development/idris-modules/idris-wrapper.nix−3
@@ -10,8 +10,5 @@ symlinkJoin {
1010 wrapProgram $out/bin/idris \
1111 --suffix PATH : ${ stdenv.lib.makeBinPath path } \
1212 --suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib}
13−
14− mkdir -p $out/nix-support
15− substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
1613 '';
1714 }
pkgs/development/idris-modules/lightyear.nix+5−4
@@ -10,8 +10,11 @@
1010let
1111 date = "2017-09-10";
1212in
13−build-idris-package {
14− name = "lightyear-${date}";
13+build-idris-package {
14+ name = "lightyear";
15+ version = date;
16+
17+ idrisDeps = [ prelude base effects ];
1518
1619 src = fetchFromGitHub {
1720 owner = "ziman";
@@ -20,8 +23,6 @@ build-idris-package {
2023 sha256 = "05x66abhpbdm6yr0afbwfk6w04ysdk78gylj5alhgwhy4jqakv29";
2124 };
2225
23− propagatedBuildInputs = [ prelude base effects ];
24−
2526 meta = {
2627 description = "Parser combinators for Idris";
2728 homepage = https://github.com/ziman/lightyear;
pkgs/development/idris-modules/setup-hook.shdeleted−16
@@ -1,16 +0,0 @@
1−# Library import path
2−export IDRIS_LIBRARY_PATH=$PWD/idris-libs
3−mkdir -p $IDRIS_LIBRARY_PATH
4−
5−# Library install path
6−export IBCSUBDIR=$out/lib/@name@
7−mkdir -p $IBCSUBDIR
8−
9−addIdrisLibs () {
10− if [ -d $1/lib/@name@ ]; then
11− ln -sv $1/lib/@name@/* $IDRIS_LIBRARY_PATH
12− fi
13−}
14−
15−# All run-time deps
16−addEnvHooks 1 addIdrisLibs
pkgs/development/idris-modules/specdris.nix+5−15
@@ -11,7 +11,8 @@ let
1111 date = "2017-11-11";
1212in
1313build-idris-package {
14− name = "specdris-${date}";
14+ name = "specdris";
15+ version = date;
1516
1617 src = fetchgit {
1718 url = "https://github.com/pheymann/specdris";
@@ -19,21 +20,10 @@ build-idris-package {
1920 sha256 = "4813c4be1d4c3dd1dad35964b085f83cf9fb44b16824257c72b468d4bafd0e4f";
2021 };
2122
22− propagatedBuildInputs = [ prelude base effects ];
23+ idrisDeps = [ prelude base effects idris ];
2324
24− buildPhase = ''
25− ${idris}/bin/idris --build specdris.ipkg
26− '';
27−
28− checkPhase = ''
29− cd test/
30− ${idris}/bin/idris --testpkg test.ipkg
31− cd ../
32− '';
33−
34− installPhase = ''
35− ${idris}/bin/idris --install specdris.ipkg --ibcsubdir $IBCSUBDIR
36− '';
25+ # The tests attribute is very strange as the tests are a different ipkg
26+ doCheck = false;
3727
3828 meta = {
3929 description = "A testing library for Idris";
pkgs/development/idris-modules/with-packages.nix+11−37
@@ -1,46 +1,20 @@
11# Build a version of idris with a set of packages visible
22# packages: The packages visible to idris
3−{ stdenv, idris }: packages: stdenv.mkDerivation {
4− inherit (idris) name;
3+{ stdenv, idris, symlinkJoin, makeWrapper }: packages:
54
6− buildInputs = packages;
5+let paths = stdenv.lib.closePropagation packages;
6+in
7+symlinkJoin {
78
8− preHook = ''
9− mkdir -p $out/lib/${idris.name}
9+ name = idris.name + "-with-packages";
1010
11− installIdrisLib () {
12− if [ -d $1/lib/${idris.name} ]; then
13− ln -fsv $1/lib/${idris.name}/* $out/lib/${idris.name}
14− fi
15− }
11+ paths = paths ++ [idris] ;
1612
17− envHostTargetHooks+=(installIdrisLib)
18− '';
13+ buildInputs = [ makeWrapper ];
1914
20− unpackPhase = ''
21− cat >idris.c <<EOF
22− #include <stdlib.h>
23− #include <unistd.h>
24− #include <stdio.h>
15+ postBuild = ''
16+ wrapProgram $out/bin/idris \
17+ --set IDRIS_LIBRARY_PATH $out/libs
18+ '';
2519
26− int main (int argc, char ** argv) {
27− /* idris currently only supports a single library path, so respect it if the user set it */
28− setenv("IDRIS_LIBRARY_PATH", "$out/lib/${idris.name}", 0);
29− execv("${idris}/bin/idris", argv);
30− perror("executing ${idris}/bin/idris");
31− return 127;
32− }
33− EOF
34− '';
35−
36− buildPhase = ''
37− $CC -O3 -o idris idris.c
38− '';
39−
40− installPhase = ''
41− mkdir -p $out/bin
42− mv idris $out/bin
43− '';
44−
45− stripAllList = [ "bin" ];
4620}
pkgs/development/idris-modules/wl-pprint.nix+3−2
@@ -6,7 +6,8 @@
66, idris
77}:
88build-idris-package {
9− name = "wl-pprint-2016-09-28";
9+ pkName = "wl-pprint";
10+ version = "2016-09-28";
1011
1112 src = fetchFromGitHub {
1213 owner = "shayan-najd";
@@ -19,7 +20,7 @@ build-idris-package {
1920 # updating this package again.
2021 doCheck = false;
2122
22− propagatedBuildInputs = [ prelude base ];
23+ idrisDeps = [ prelude base ];
2324
2425 meta = {
2526 description = "Wadler-Leijen pretty-printing library";