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