git.iko.soy/typeable/cabal2nix
on master help sign in
7 files changed+57−56
since splitsnapshots
unifiedsplit
.travis.yml+38−44 cabal2nix.cabal+5−5 hackage2nix/Main.hs+1−1 src/Cabal2nix.hs+1−2 src/Distribution/Nixpkgs/Haskell/Derivation.hs+1−1 src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+2−1 src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+9−2
.travis.yml+38−44
@@ -4,9 +4,11 @@
44#
55# For more information, see https://github.com/haskell-CI/haskell-ci
66#
7−# version: 0.5.20190916
7+# version: 0.9.20200306
88#
9+version: ~> 1.0
910language: c
11+os: linux
1012dist: xenial
1113git:
1214 # whether to recursively clone submodules
@@ -15,6 +17,7 @@ cache:
1517 directories:
1618 - $HOME/.cabal/packages
1719 - $HOME/.cabal/store
20+ - $HOME/.hlint
1821before_cache:
1922 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2023 # remove files that are regenerated by 'cabal update'
@@ -24,14 +27,20 @@ before_cache:
2427 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
2528 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
2629 - rm -rfv $CABALHOME/packages/head.hackage
27−matrix:
30+jobs:
2831 include:
29− - compiler: ghc-8.8.1
30− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
32+ - compiler: ghc-8.10.1
33+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}}
34+ os: linux
35+ - compiler: ghc-8.8.3
36+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.0"]}}
37+ os: linux
3138 - compiler: ghc-8.6.5
32− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
39+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
40+ os: linux
3341 allow_failures:
34− - compiler: ghc-8.8.1
42+ - compiler: ghc-8.8.3
43+ - compiler: ghc-8.10.1
3544before_install:
3645 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
3746 - WITHCOMPILER="-w $HC"
@@ -44,29 +53,8 @@ before_install:
4453 - TOP=$(pwd)
4554 - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
4655 - echo $HCNUMVER
47− - CABAL="$CABAL -vnormal+nowrap+markoutput"
56+ - CABAL="$CABAL -vnormal+nowrap"
4857 - set -o pipefail
49− - |
50− echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
51− echo 'BEGIN { state = "output"; }' >> .colorful.awk
52− echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
53− echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
54− echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
55− echo ' if (state == "cabal") {' >> .colorful.awk
56− echo ' print blue($0)' >> .colorful.awk
57− echo ' } else {' >> .colorful.awk
58− echo ' print $0' >> .colorful.awk
59− echo ' }' >> .colorful.awk
60− echo '}' >> .colorful.awk
61− - cat .colorful.awk
62− - |
63− color_cabal_output () {
64− awk -f $TOP/.colorful.awk
65− }
66− - echo text | color_cabal_output
67−install:
68− - ${CABAL} --version
69− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
7058 - TEST=--enable-tests
7159 - BENCH=--enable-benchmarks
7260 - HEADHACKAGE=false
@@ -99,14 +87,20 @@ install:
9987 echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config
10088 echo " key-threshold: 3" >> $CABALHOME/config
10189 fi
90+install:
91+ - ${CABAL} --version
92+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
10293 - |
10394 echo "program-default-options" >> $CABALHOME/config
10495 echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
10596 - cat $CABALHOME/config
10697 - rm -fv cabal.project cabal.project.local cabal.project.freeze
10798 - travis_retry ${CABAL} v2-update -v
108− - (cd /tmp && ${CABAL} v2-install $WITHCOMPILER -j2 doctest --constraint='doctest ==0.16.*' | color_cabal_output)
109− - if [ $HCNUMVER -lt 80800 ] ; then (cd /tmp && ${CABAL} v2-install $WITHCOMPILER -j2 hlint --constraint='hlint ==2.1.*' | color_cabal_output) ; fi
99+ - (cd /tmp && ${CABAL} v2-install $WITHCOMPILER -j2 doctest --constraint='doctest ==0.16.2.*')
100+ - if [ $HCNUMVER -lt 80800 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $WITHCOMPILER --dry-run hlint --constraint='hlint ==2.2.*' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi
101+ - "if [ $HCNUMVER -lt 80800 ] ; then if [ ! -e $HOME/.hlint/hlint-$HLINTVER/hlint ]; then echo \"Downloading HLint version $HLINTVER\"; mkdir -p $HOME/.hlint; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\\n' --silent --location --output $HOME/.hlint/hlint-$HLINTVER.tar.gz \"https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz\"; tar -xzv -f $HOME/.hlint/hlint-$HLINTVER.tar.gz -C $HOME/.hlint; fi ; fi"
102+ - if [ $HCNUMVER -lt 80800 ] ; then mkdir -p $CABALHOME/bin && ln -sf "$HOME/.hlint/hlint-$HLINTVER/hlint" $CABALHOME/bin/hlint ; fi
103+ - if [ $HCNUMVER -lt 80800 ] ; then hlint --version ; fi
110104 # Generate cabal.project
111105 - rm -rf cabal.project cabal.project.local cabal.project.freeze
112106 - touch cabal.project
@@ -117,15 +111,15 @@ install:
117111 - cat cabal.project || true
118112 - cat cabal.project.local || true
119113 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
120− - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
114+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
121115 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
122116 - rm cabal.project.freeze
123− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
124− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
117+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
118+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
125119script:
126120 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
127121 # Packaging...
128− - ${CABAL} v2-sdist all | color_cabal_output
122+ - ${CABAL} v2-sdist all
129123 # Unpacking...
130124 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
131125 - cd ${DISTDIR} || false
@@ -143,25 +137,25 @@ script:
143137 - cat cabal.project.local || true
144138 # Building...
145139 # this builds all libraries and executables (without tests/benchmarks)
146− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
140+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
147141 # Building with tests and benchmarks...
148142 # build & run tests, build benchmarks
149− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
143+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
150144 # Testing...
151− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
145+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
152146 # Doctest...
153− - (cd ${PKGDIR_cabal2nix} && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen -XMonadFailDesugaring src)
147+ - (cd ${PKGDIR_cabal2nix} && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen src)
154148 # HLint..
155− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint -XMonadFailDesugaring src) ; fi
156− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint -XMonadFailDesugaring hackage2nix) ; fi
157− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint -XMonadFailDesugaring cabal2nix) ; fi
149+ - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint src) ; fi
150+ - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint hackage2nix) ; fi
151+ - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint cabal2nix) ; fi
158152 # cabal check...
159153 - (cd ${PKGDIR_cabal2nix} && ${CABAL} -vnormal check)
160154 # haddock...
161− - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
155+ - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
162156 # Building without installed constraints for packages in global-db...
163157 - rm -f cabal.project.local
164− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
158+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
165159
166−# REGENDATA ["--installed=+all -Cabal","--hlint","--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","-o",".travis.yml","cabal2nix.cabal","--head-hackage","--head-hackage-jobs","> 8.8"]
160+# REGENDATA ("0.9.20200306",["--installed=+all -Cabal","--hlint","--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","-o",".travis.yml","cabal2nix.cabal","--head-hackage","--head-hackage-jobs","> 8.8"])
167161# EOF
cabal2nix.cabal+5−5
@@ -1,5 +1,5 @@
11name: cabal2nix
2−version: 2.15.0
2+version: 2.15.1
33synopsis: Convert Cabal files into Nix build instructions.
44description:
55 Convert Cabal files into Nix build instructions. Users of Nix can install the latest
@@ -27,7 +27,7 @@ author: Peter Simons, Andres Loeh, Benno Fünfstück, Mateusz Kowalc
2727 gebbert, laMudri, Александр Цамутали
2828maintainer: Peter Simons <simons@cryp.to>
2929stability: stable
30−tested-with: GHC == 8.6.5, GHC == 8.8.1
30+tested-with: GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.1
3131category: Distribution, Nix
3232homepage: https://github.com/nixos/cabal2nix#readme
3333bug-reports: https://github.com/nixos/cabal2nix/issues
@@ -61,7 +61,7 @@ library
6161 other-modules: Paths_cabal2nix
6262 hs-source-dirs: src
6363 build-depends: base > 4.11
64− , Cabal > 3
64+ , Cabal == 3.0.*
6565 , aeson > 1
6666 , ansi-wl-pprint
6767 , bytestring
@@ -110,7 +110,7 @@ executable hackage2nix
110110 Paths_cabal2nix
111111 hs-source-dirs: hackage2nix
112112 build-depends: base < 5
113− , Cabal > 2.4
113+ , Cabal
114114 , aeson
115115 , bytestring
116116 , cabal2nix
@@ -135,7 +135,7 @@ test-suite regression-test
135135 main-is: Main.hs
136136 hs-source-dirs: test
137137 build-depends: base
138− , Cabal > 2.4
138+ , Cabal
139139 , cabal2nix
140140 , containers
141141 , directory
hackage2nix/Main.hs+1−1
@@ -10,7 +10,7 @@ import Control.Monad
1010import Control.Monad.Par.Combinator
1111import Control.Monad.Par.IO
1212import Control.Monad.Trans ( liftIO )
13−import Data.List
13+import Data.List ( intercalate )
1414import Data.Map.Strict ( Map )
1515import qualified Data.Map.Strict as Map
1616import Data.Maybe
src/Cabal2nix.hs+1−2
@@ -11,10 +11,9 @@ module Cabal2nix
1111import Control.Exception ( bracket )
1212import Control.Lens
1313import Control.Monad
14−import Data.List
14+import Data.List ( intercalate, isPrefixOf )
1515import Data.List.Split
1616import Data.Maybe ( fromMaybe, isJust, listToMaybe )
17−import Data.Monoid ( (<>) )
1817import qualified Data.Set as Set
1918import Data.String
2019import Data.Time
src/Distribution/Nixpkgs/Haskell/Derivation.hs+1−1
@@ -15,7 +15,7 @@ module Distribution.Nixpkgs.Haskell.Derivation
1515
1616import Control.DeepSeq
1717import Control.Lens
18−import Data.List
18+import Data.List ( isPrefixOf )
1919import Data.Set ( Set )
2020import qualified Data.Set as Set
2121import Data.Set.Lens
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+2−1
@@ -16,6 +16,7 @@ configureCabalFlags' :: PackageIdentifier -> [(FlagName,Bool)]
1616configureCabalFlags' (PackageIdentifier name version)
1717 | name == "accelerate-examples"= [disable "opencl"]
1818 | name == "arithmoi" = [disable "llvm"]
19+ | name == "bustle" = [disable "hgettext"] -- https://gitlab.freedesktop.org/bustle/bustle/issues/13
1920 | name == "cabal-plan" = [enable "exe"]
2021 | name == "cassava" = [disable "bytestring--lt-0_10_4"]
2122 | name == "darcs" = [enable "library", enable "force-char8-encoding"]
@@ -27,7 +28,7 @@ configureCabalFlags' (PackageIdentifier name version)
2728 , enable "dbus"
2829 , disable "debuglocks"
2930 , enable "magicmime"
30− , disable "networkbsd"
31+ , enable "networkbsd"
3132 , enable "pairing"
3233 , enable "production"
3334 , enable "s3"
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+9−2
@@ -13,6 +13,7 @@ import Data.Set ( Set )
1313import qualified Data.Set as Set
1414import Distribution.Nixpkgs.Haskell
1515import Distribution.Nixpkgs.Meta
16+import Distribution.Nixpkgs.License
1617import Distribution.Package
1718import Distribution.System
1819import Distribution.Text
@@ -78,7 +79,7 @@ hooks =
7879 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
7980 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
8081 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
81− , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
82+ , ("bustle", bustleOverrides)
8283 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
8384 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
8485 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
@@ -255,7 +256,7 @@ gfPhaseOverrides = unlines
255256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
256257 -- Parallel compilation fails. Disable it.
257258 , "'';"
258− , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build:$LD_LIBRARY_PATH'';"
259+ , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH'';"
259260 -- The build step itself, after having built the library, needs to be able
260261 -- to find the library it just built in order to compile grammar files.
261262 ]
@@ -400,3 +401,9 @@ pandocOverrides = set phaseOverrides postInstall
400401 , " mv \"man/\"*.1 $out/share/man/man1/"
401402 , "'';"
402403 ]
404+
405+bustleOverrides :: Derivation -> Derivation
406+bustleOverrides = set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True
407+ . set (executableDepends . pkgconfig . contains "gio-unix = null") False
408+ . set (metaSection . license) (Known "stdenv.lib.licenses.lgpl21Plus")
409+ . set (metaSection . hydraPlatforms) allKnownPlatforms