···1-# Build one of the packages that come with idris
2# name: The name of the package
3# deps: The dependencies of the package
4{ idris, build-idris-package, lib }: name: deps:
···6 inherit (builtins.parseDrvName idris.name) version;
7in
8build-idris-package {
9- name = "${name}-${version}";
1011- propagatedBuildInputs = deps;
12-13 inherit (idris) src;
140015 postUnpack = ''
16 sourceRoot=$sourceRoot/libs/${name}
17- '';
18-19- postPatch = ''
20- sed -i ${name}.ipkg -e "/^opts/ s|-i \\.\\./|-i $IDRIS_LIBRARY_PATH/|g"
21 '';
2223 meta = idris.meta // {
···1+# Build one of the packages that comes with idris
2# name: The name of the package
3# deps: The dependencies of the package
4{ idris, build-idris-package, lib }: name: deps:
···6 inherit (builtins.parseDrvName idris.name) version;
7in
8build-idris-package {
0910+ inherit name version;
011 inherit (idris) src;
1213+ idrisDeps = deps;
14+15 postUnpack = ''
16 sourceRoot=$sourceRoot/libs/${name}
000017 '';
1819 meta = idris.meta // {
···1# 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
00000000000000000008 '';
910- doCheck = true;
001112 checkPhase = ''
13 if grep -q test *.ipkg; then
14- idris --testpkg *.ipkg
15 fi
16 '';
1718 installPhase = ''
19- idris --install *.ipkg --ibcsubdir $IBCSUBDIR
20 '';
2122- buildInputs = [ gmp idris ];
23-} // args)
00
···1# Build an idris package
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"
27 '';
2829+ buildPhase = ''
30+ ${idris-with-packages}/bin/idris --build *.ipkg
31+ '';
3233 checkPhase = ''
34 if grep -q test *.ipkg; then
35+ ${idris-with-packages}/bin/idris --testpkg *.ipkg
36 fi
37 '';
3839 installPhase = ''
40+ ${idris-with-packages}/bin/idris --install *.ipkg --ibcsubdir $out/libs
41 '';
4243+ buildInputs = [ gmp ] ++ extraBuildInputs;
44+45+ propagatedBuildInputs = idrisDeps;
46+})
+23-8
pkgs/development/idris-modules/default.nix
···25 pruviloj = [ self.prelude self.base ];
26 };
2728- 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)) // {
36 inherit idris-no-deps callPackage;
37 # See #10450 about why we have to wrap the executable
38 idris =
···40 idris-no-deps
41 { path = [ pkgs.gcc ]; lib = [pkgs.gmp]; };
4200000000043 # A list of all of the libraries that come with idris
44 builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins_;
00000000000045 } // builtins_;
46in fix' (extends overrides idrisPackages)
···25 pruviloj = [ self.prelude self.base ];
26 };
2728+ in
29+ {
00000030 inherit idris-no-deps callPackage;
31 # See #10450 about why we have to wrap the executable
32 idris =
···34 idris-no-deps
35 { path = [ pkgs.gcc ]; lib = [pkgs.gmp]; };
3637+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+46 # A list of all of the libraries that come with idris
47 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+60 } // builtins_;
61in fix' (extends overrides idrisPackages)
···11 date = "2017-11-11";
12in
13build-idris-package {
14+ name = "specdris";
15+ version = date;
1617 src = fetchgit {
18 url = "https://github.com/pheymann/specdris";
···20 sha256 = "4813c4be1d4c3dd1dad35964b085f83cf9fb44b16824257c72b468d4bafd0e4f";
21 };
2223+ idrisDeps = [ prelude base effects idris ];
00000000002425+ # The tests attribute is very strange as the tests are a different ipkg
26+ doCheck = false;
02728 meta = {
29 description = "A testing library for Idris";
+11-37
pkgs/development/idris-modules/with-packages.nix
···1# Build a version of idris with a set of packages visible
2# packages: The packages visible to idris
3-{ stdenv, idris }: packages: stdenv.mkDerivation {
4- inherit (idris) name;
5-6- buildInputs = packages;
7-8- preHook = ''
9- mkdir -p $out/lib/${idris.name}
10-11- installIdrisLib () {
12- if [ -d $1/lib/${idris.name} ]; then
13- ln -fsv $1/lib/${idris.name}/* $out/lib/${idris.name}
14- fi
15- }
1617- envHostTargetHooks+=(installIdrisLib)
18- '';
01920- unpackPhase = ''
21- cat >idris.c <<EOF
22- #include <stdlib.h>
23- #include <unistd.h>
24- #include <stdio.h>
2526- 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- '';
3536- buildPhase = ''
37- $CC -O3 -o idris idris.c
38- '';
3940- installPhase = ''
41- mkdir -p $out/bin
42- mv idris $out/bin
43- '';
4445- stripAllList = [ "bin" ];
46}
···1# Build a version of idris with a set of packages visible
2# packages: The packages visible to idris
3+{ stdenv, idris, symlinkJoin, makeWrapper }: packages:
00000000000045+let paths = stdenv.lib.closePropagation packages;
6+in
7+symlinkJoin {
89+ name = idris.name + "-with-packages";
00001011+ paths = paths ++ [idris] ;
000000001213+ buildInputs = [ makeWrapper ];
001415+ postBuild = ''
16+ wrapProgram $out/bin/idris \
17+ --set IDRIS_LIBRARY_PATH $out/libs
18+ '';
19020}