Merge branch 'idris-packaging' of git://github.com/mpickering/nixpkgs

+95 -108
+4 -8
pkgs/development/idris-modules/build-builtin-package.nix
··· 1 - # Build one of the packages that come with idris 1 + # Build one of the packages that comes with idris 2 2 # name: The name of the package 3 3 # deps: The dependencies of the package 4 4 { idris, build-idris-package, lib }: name: deps: ··· 6 6 inherit (builtins.parseDrvName idris.name) version; 7 7 in 8 8 build-idris-package { 9 - name = "${name}-${version}"; 10 9 11 - propagatedBuildInputs = deps; 12 - 10 + inherit name version; 13 11 inherit (idris) src; 14 12 13 + idrisDeps = deps; 14 + 15 15 postUnpack = '' 16 16 sourceRoot=$sourceRoot/libs/${name} 17 - ''; 18 - 19 - postPatch = '' 20 - sed -i ${name}.ipkg -e "/^opts/ s|-i \\.\\./|-i $IDRIS_LIBRARY_PATH/|g" 21 17 ''; 22 18 23 19 meta = idris.meta // {
+34 -11
pkgs/development/idris-modules/build-idris-package.nix
··· 1 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 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" 8 27 ''; 9 28 10 - doCheck = true; 29 + buildPhase = '' 30 + ${idris-with-packages}/bin/idris --build *.ipkg 31 + ''; 11 32 12 33 checkPhase = '' 13 34 if grep -q test *.ipkg; then 14 - idris --testpkg *.ipkg 35 + ${idris-with-packages}/bin/idris --testpkg *.ipkg 15 36 fi 16 37 ''; 17 38 18 39 installPhase = '' 19 - idris --install *.ipkg --ibcsubdir $IBCSUBDIR 40 + ${idris-with-packages}/bin/idris --install *.ipkg --ibcsubdir $out/libs 20 41 ''; 21 42 22 - buildInputs = [ gmp idris ]; 23 - } // args) 43 + buildInputs = [ gmp ] ++ extraBuildInputs; 44 + 45 + propagatedBuildInputs = idrisDeps; 46 + })
+23 -8
pkgs/development/idris-modules/default.nix
··· 25 25 pruviloj = [ self.prelude self.base ]; 26 26 }; 27 27 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 + { 36 30 inherit idris-no-deps callPackage; 37 31 # See #10450 about why we have to wrap the executable 38 32 idris = ··· 40 34 idris-no-deps 41 35 { path = [ pkgs.gcc ]; lib = [pkgs.gmp]; }; 42 36 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 + 43 46 # A list of all of the libraries that come with idris 44 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 + 45 60 } // builtins_; 46 61 in fix' (extends overrides idrisPackages)
+10 -4
pkgs/development/idris-modules/httpclient.nix
··· 1 - { pkgs 1 + { curl 2 2 , build-idris-package 3 3 , fetchFromGitHub 4 4 , lightyear 5 5 , contrib 6 + , effects 7 + , prelude 8 + , base 6 9 , lib 7 10 , idris 8 11 }: 9 12 10 13 let 11 - date = "2016-12-20"; 12 14 in 13 15 build-idris-package { 14 - name = "httpclient-${date}"; 16 + name = "httpclient"; 17 + version = "2016-12-20"; 15 18 16 19 src = fetchFromGitHub { 17 20 owner = "justjoheinz"; ··· 20 23 sha256 = "0sy0q7gri9lwbqdmx9720pby3w1470w7wzn62bf2rir532219hhl"; 21 24 }; 22 25 23 - propagatedBuildInputs = [ pkgs.curl lightyear contrib ]; 26 + idrisDeps = [ prelude base effects lightyear contrib ]; 27 + 28 + extraBuildInputs = [ curl ]; 24 29 25 30 meta = { 26 31 description = "HTTP Client for Idris"; 27 32 homepage = https://github.com/justjoheinz/idris-httpclient; 28 33 inherit (idris.meta) platforms; 34 + broken = true; 29 35 }; 30 36 }
-3
pkgs/development/idris-modules/idris-wrapper.nix
··· 10 10 wrapProgram $out/bin/idris \ 11 11 --suffix PATH : ${ stdenv.lib.makeBinPath path } \ 12 12 --suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib} 13 - 14 - mkdir -p $out/nix-support 15 - substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook 16 13 ''; 17 14 }
+5 -4
pkgs/development/idris-modules/lightyear.nix
··· 10 10 let 11 11 date = "2017-09-10"; 12 12 in 13 - build-idris-package { 14 - name = "lightyear-${date}"; 13 + build-idris-package { 14 + name = "lightyear"; 15 + version = date; 16 + 17 + idrisDeps = [ prelude base effects ]; 15 18 16 19 src = fetchFromGitHub { 17 20 owner = "ziman"; ··· 19 22 rev = "f737e25a09c1fe7c5fff063c53bd7458be232cc8"; 20 23 sha256 = "05x66abhpbdm6yr0afbwfk6w04ysdk78gylj5alhgwhy4jqakv29"; 21 24 }; 22 - 23 - propagatedBuildInputs = [ prelude base effects ]; 24 25 25 26 meta = { 26 27 description = "Parser combinators for Idris";
-16
pkgs/development/idris-modules/setup-hook.sh
··· 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
+5 -15
pkgs/development/idris-modules/specdris.nix
··· 11 11 date = "2017-11-11"; 12 12 in 13 13 build-idris-package { 14 - name = "specdris-${date}"; 14 + name = "specdris"; 15 + version = date; 15 16 16 17 src = fetchgit { 17 18 url = "https://github.com/pheymann/specdris"; ··· 19 20 sha256 = "4813c4be1d4c3dd1dad35964b085f83cf9fb44b16824257c72b468d4bafd0e4f"; 20 21 }; 21 22 22 - propagatedBuildInputs = [ prelude base effects ]; 23 - 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 - ''; 23 + idrisDeps = [ prelude base effects idris ]; 33 24 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; 37 27 38 28 meta = { 39 29 description = "A testing library for Idris";
+11 -37
pkgs/development/idris-modules/with-packages.nix
··· 1 1 # Build a version of idris with a set of packages visible 2 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 - } 3 + { stdenv, idris, symlinkJoin, makeWrapper }: packages: 16 4 17 - envHostTargetHooks+=(installIdrisLib) 18 - ''; 5 + let paths = stdenv.lib.closePropagation packages; 6 + in 7 + symlinkJoin { 19 8 20 - unpackPhase = '' 21 - cat >idris.c <<EOF 22 - #include <stdlib.h> 23 - #include <unistd.h> 24 - #include <stdio.h> 9 + name = idris.name + "-with-packages"; 25 10 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 - ''; 11 + paths = paths ++ [idris] ; 35 12 36 - buildPhase = '' 37 - $CC -O3 -o idris idris.c 38 - ''; 13 + buildInputs = [ makeWrapper ]; 39 14 40 - installPhase = '' 41 - mkdir -p $out/bin 42 - mv idris $out/bin 43 - ''; 15 + postBuild = '' 16 + wrapProgram $out/bin/idris \ 17 + --set IDRIS_LIBRARY_PATH $out/libs 18 + ''; 44 19 45 - stripAllList = [ "bin" ]; 46 20 }
+3 -2
pkgs/development/idris-modules/wl-pprint.nix
··· 6 6 , idris 7 7 }: 8 8 build-idris-package { 9 - name = "wl-pprint-2016-09-28"; 9 + pkName = "wl-pprint"; 10 + version = "2016-09-28"; 10 11 11 12 src = fetchFromGitHub { 12 13 owner = "shayan-najd"; ··· 19 20 # updating this package again. 20 21 doCheck = false; 21 22 22 - propagatedBuildInputs = [ prelude base ]; 23 + idrisDeps = [ prelude base ]; 23 24 24 25 meta = { 25 26 description = "Wadler-Leijen pretty-printing library";