git.iko.soy/typeable/cabal2nix
on 68acc25 help sign in
.travis.yml+53−70
since splitsnapshots
unifiedsplit
@@ -1,14 +1,12 @@
1# This Travis job script has been generated by a script via
1# This Travis job script has been generated by a script via
2#
2#
3−# haskell-ci '--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'
3+# haskell-ci '--installed=+all -Cabal' '--hlint' '--doctest' '--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen' '-o' '.travis.yml' 'cabal2nix.cabal'
4#
4#
5# For more information, see https://github.com/haskell-CI/haskell-ci
5# For more information, see https://github.com/haskell-CI/haskell-ci
6#
6#
7−# version: 0.9.20200306
7+# version: 0.3.20190413
8#
8#
9−version: ~> 1.0
10language: c
9language: c
11−os: linux
12dist: xenial
10dist: xenial
13git:
11git:
14 # whether to recursively clone submodules
12 # whether to recursively clone submodules
@@ -17,7 +15,6 @@ cache:
17 directories:
15 directories:
18 - $HOME/.cabal/packages
16 - $HOME/.cabal/packages
19 - $HOME/.cabal/store
17 - $HOME/.cabal/store
20− - $HOME/.hlint
21before_cache:
18before_cache:
22 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
19 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
23 # remove files that are regenerated by 'cabal update'
20 # remove files that are regenerated by 'cabal update'
@@ -27,135 +24,121 @@ before_cache:
27 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
24 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
28 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
25 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
29 - rm -rfv $CABALHOME/packages/head.hackage
26 - rm -rfv $CABALHOME/packages/head.hackage
30−jobs:
27+matrix:
31 include:
28 include:
32− - compiler: ghc-8.10.1
29+ - compiler: ghc-8.6.4
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"]}}
30+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.4","cabal-install-2.4"]}}
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
38− - compiler: ghc-8.6.5
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
41− allow_failures:
42− - compiler: ghc-8.8.3
43− - compiler: ghc-8.10.1
44before_install:
31before_install:
45 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
32 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
46− - WITHCOMPILER="-w $HC"
47− - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
48 - HCPKG="$HC-pkg"
33 - HCPKG="$HC-pkg"
49 - unset CC
34 - unset CC
50 - CABAL=/opt/ghc/bin/cabal
35 - CABAL=/opt/ghc/bin/cabal
51 - CABALHOME=$HOME/.cabal
36 - CABALHOME=$HOME/.cabal
52 - export PATH="$CABALHOME/bin:$PATH"
37 - export PATH="$CABALHOME/bin:$PATH"
53 - TOP=$(pwd)
38 - TOP=$(pwd)
54− - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
39+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
55 - echo $HCNUMVER
40 - echo $HCNUMVER
56− - CABAL="$CABAL -vnormal+nowrap"
41+ - CABAL="$CABAL -vnormal+nowrap+markoutput"
57 - set -o pipefail
42 - set -o pipefail
43+ - |
44+ echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
45+ echo 'BEGIN { state = "output"; }' >> .colorful.awk
46+ echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
47+ echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
48+ echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
49+ echo ' if (state == "cabal") {' >> .colorful.awk
50+ echo ' print blue($0)' >> .colorful.awk
51+ echo ' } else {' >> .colorful.awk
52+ echo ' print $0' >> .colorful.awk
53+ echo ' }' >> .colorful.awk
54+ echo '}' >> .colorful.awk
55+ - cat .colorful.awk
56+ - |
57+ color_cabal_output () {
58+ awk -f $TOP/.colorful.awk
59+ }
60+ - echo text | color_cabal_output
61+install:
62+ - ${CABAL} --version
63+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
58 - TEST=--enable-tests
64 - TEST=--enable-tests
59 - BENCH=--enable-benchmarks
65 - BENCH=--enable-benchmarks
60− - HEADHACKAGE=false
66+ - GHCHEAD=${GHCHEAD-false}
61− - if [ $HCNUMVER -ge 80800 ] ; then HEADHACKAGE=true ; fi
62 - rm -f $CABALHOME/config
67 - rm -f $CABALHOME/config
63 - |
68 - |
64 echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
69 echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
65 echo "remote-build-reporting: anonymous" >> $CABALHOME/config
70 echo "remote-build-reporting: anonymous" >> $CABALHOME/config
66− echo "write-ghc-environment-files: always" >> $CABALHOME/config
67 echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
71 echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
68 echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
72 echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
69 echo "world-file: $CABALHOME/world" >> $CABALHOME/config
73 echo "world-file: $CABALHOME/world" >> $CABALHOME/config
70 echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
74 echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
71 echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
75 echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
72− echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
73 echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
76 echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
74 echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
77 echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
75 echo "install-dirs user" >> $CABALHOME/config
78 echo "install-dirs user" >> $CABALHOME/config
76 echo " prefix: $CABALHOME" >> $CABALHOME/config
79 echo " prefix: $CABALHOME" >> $CABALHOME/config
77 echo "repository hackage.haskell.org" >> $CABALHOME/config
80 echo "repository hackage.haskell.org" >> $CABALHOME/config
78 echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
81 echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
79− - |
80− if $HEADHACKAGE; then
81− echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config
82− echo "repository head.hackage.ghc.haskell.org" >> $CABALHOME/config
83− echo " url: https://ghc.gitlab.haskell.org/head.hackage/" >> $CABALHOME/config
84− echo " secure: True" >> $CABALHOME/config
85− echo " root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config
86− echo " 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config
87− echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config
88− echo " key-threshold: 3" >> $CABALHOME/config
89− fi
90−install:
91− - ${CABAL} --version
92− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
93− - |
94− echo "program-default-options" >> $CABALHOME/config
95− echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
96 - cat $CABALHOME/config
82 - cat $CABALHOME/config
97 - rm -fv cabal.project cabal.project.local cabal.project.freeze
83 - rm -fv cabal.project cabal.project.local cabal.project.freeze
98 - travis_retry ${CABAL} v2-update -v
84 - travis_retry ${CABAL} v2-update -v
99− - (cd /tmp && ${CABAL} v2-install $WITHCOMPILER -j2 doctest --constraint='doctest ==0.16.2.*')
85+ - ${CABAL} v2-install -w ${HC} -j2 doctest --constraint='doctest ==0.16.*' | color_cabal_output
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
86+ - ${CABAL} v2-install -w ${HC} -j2 hlint --constraint='hlint ==2.1.*' | color_cabal_output
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
104 # Generate cabal.project
87 # Generate cabal.project
105 - rm -rf cabal.project cabal.project.local cabal.project.freeze
88 - rm -rf cabal.project cabal.project.local cabal.project.freeze
106 - touch cabal.project
89 - touch cabal.project
107 - |
90 - |
108− echo "packages: ." >> cabal.project
91+ echo 'packages: "."' >> cabal.project
109 - |
92 - |
93+ echo "write-ghc-environment-files: always" >> cabal.project
110− - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(Cabal|cabal2nix)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
94+ - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(Cabal|cabal2nix)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
111 - cat cabal.project || true
95 - cat cabal.project || true
112 - cat cabal.project.local || true
96 - cat cabal.project.local || true
113 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
97 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
114− - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
98+ - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
115 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
99 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
116 - rm cabal.project.freeze
100 - rm cabal.project.freeze
117− - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
101+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
118− - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
102+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
119script:
103script:
120 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
104 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
121 # Packaging...
105 # Packaging...
122− - ${CABAL} v2-sdist all
106+ - ${CABAL} v2-sdist all | color_cabal_output
123 # Unpacking...
107 # Unpacking...
124 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
108 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
125 - cd ${DISTDIR} || false
109 - cd ${DISTDIR} || false
126− - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
110+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
127− - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
128− - PKGDIR_cabal2nix="$(find . -maxdepth 1 -type d -regex '.*/cabal2nix-[0-9.]*')"
129 # Generate cabal.project
111 # Generate cabal.project
130 - rm -rf cabal.project cabal.project.local cabal.project.freeze
112 - rm -rf cabal.project cabal.project.local cabal.project.freeze
131 - touch cabal.project
113 - touch cabal.project
132 - |
114 - |
133− echo "packages: ${PKGDIR_cabal2nix}" >> cabal.project
115+ echo 'packages: "cabal2nix-*/*.cabal"' >> cabal.project
134 - |
116 - |
117+ echo "write-ghc-environment-files: always" >> cabal.project
135− - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(Cabal|cabal2nix)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
118+ - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(Cabal|cabal2nix)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
136 - cat cabal.project || true
119 - cat cabal.project || true
137 - cat cabal.project.local || true
120 - cat cabal.project.local || true
138 # Building...
121 # Building...
139 # this builds all libraries and executables (without tests/benchmarks)
122 # this builds all libraries and executables (without tests/benchmarks)
140− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
123+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
141 # Building with tests and benchmarks...
124 # Building with tests and benchmarks...
142 # build & run tests, build benchmarks
125 # build & run tests, build benchmarks
143− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
126+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
144 # Testing...
127 # Testing...
145− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
128+ - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
146 # Doctest...
129 # Doctest...
147− - (cd ${PKGDIR_cabal2nix} && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen src)
130+ - (cd cabal2nix-* && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen -XMonadFailDesugaring src)
148 # HLint..
131 # HLint..
149− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint src) ; fi
132+ - (cd cabal2nix-* && hlint -XMonadFailDesugaring src)
150− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint hackage2nix) ; fi
133+ - (cd cabal2nix-* && hlint -XMonadFailDesugaring hackage2nix)
151− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint cabal2nix) ; fi
134+ - (cd cabal2nix-* && hlint -XMonadFailDesugaring cabal2nix)
152 # cabal check...
135 # cabal check...
153− - (cd ${PKGDIR_cabal2nix} && ${CABAL} -vnormal check)
136+ - (cd cabal2nix-* && ${CABAL} -vnormal check)
154 # haddock...
137 # haddock...
155− - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
138+ - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
156 # Building without installed constraints for packages in global-db...
139 # Building without installed constraints for packages in global-db...
157 - rm -f cabal.project.local
140 - rm -f cabal.project.local
158− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
141+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
159
142
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"])
143+# REGENDATA ["--installed=+all -Cabal","--hlint","--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","-o",".travis.yml","cabal2nix.cabal"]
161# EOF
144# EOF
README.md+6−6
@@ -27,16 +27,16 @@ direct `http://host/path/pkg.cabal` URL can be provided, as well as a
27`file:///local/path/pkg.cabal` URI that doesn't depend on network access.
27`file:///local/path/pkg.cabal` URI that doesn't depend on network access.
28However, if the source hash is not already in `cabal2nix`'s cache or provided
28However, if the source hash is not already in `cabal2nix`'s cache or provided
29using the `--sha256` option, `cabal2nix` still needs to download the source
29using the `--sha256` option, `cabal2nix` still needs to download the source
30−code to compute the hash, which still causes network traffic. Run the utility
30+code to compute the hash, which obviously still causes network traffic. Run the
31−with `--help` to see the complete list of supported command-line flags.
31+utility with `--help` to see the complete list of supported command line flags.
32
32
33−Detailed instructions on how to use those generated files with Nix can be found at
33+Detailed instructions how to use those generated files with Nix can be found at
34https://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages.
34https://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages.
35
35
36`cabal2nix` can also build derivations for projects from other sources than
36`cabal2nix` can also build derivations for projects from other sources than
37−Hackage. You only need to provide a URI that points to a cabal project. The
37+hackage. You only need to provide an URI that points to a cabal project. The
38−most common use-case for this is probably to generate a derivation for a
38+most common usecase for this is probably to generate a derivation for a project
39−project on the local file system:
39+on the local file system:
40
40
41 $ cabal get mtl-2.2.1 && cd mtl-2.2.1
41 $ cabal get mtl-2.2.1 && cd mtl-2.2.1
42 $ cabal2nix .
42 $ cabal2nix .
cabal2nix.cabal+75−24
@@ -1,5 +1,5 @@
1name: cabal2nix
1name: cabal2nix
2−version: 2.15.1
2+version: 2.14.4
3synopsis: Convert Cabal files into Nix build instructions.
3synopsis: Convert Cabal files into Nix build instructions.
4description:
4description:
5 Convert Cabal files into Nix build instructions. Users of Nix can install the latest
5 Convert Cabal files into Nix build instructions. Users of Nix can install the latest
@@ -8,26 +8,73 @@ description:
8 > nix-env -i cabal2nix
8 > nix-env -i cabal2nix
9license: BSD3
9license: BSD3
10license-file: LICENSE
10license-file: LICENSE
11−author: Peter Simons, Andres Loeh, Benno Fünfstück, Mateusz Kowalczyk,
11+author: Peter Simons,
12+ Andres Loeh,
13+ Benno Fünfstück,
14+ Mateusz Kowalczyk,
12− Michael Alan Dorman, Tom Smalley, Mathijs Kwik, Shea Levy, Dmitry
15+ Michael Alan Dorman,
16+ Tom Smalley,
17+ Mathijs Kwik,
18+ Shea Levy,
19+ Dmitry Malikov,
20+ Eric Seidel,
21+ Jacob Mitchell,
13− Malikov, Eric Seidel, Jacob Mitchell, Graham Christensen,
22+ Graham Christensen,
14− Hamish Mackenzie, Nikolay Amiantov, Aycan iRiCAN, Bryan
23+ Hamish Mackenzie,
24+ Nikolay Amiantov,
25+ Aycan iRiCAN,
26+ Bryan Gardiner,
15− Gardiner, Joe Hermaszewski, John Wiegley, Philipp Hausmann,
27+ Joe Hermaszewski,
28+ John Wiegley,
29+ Philipp Hausmann,
16− Spencer Janssen, Tom Hunger, William Casarin, koral,
30+ Spencer Janssen,
31+ Tom Hunger,
32+ William Casarin,
33+ koral,
34+ ksaric,
35+ Adam Vogt,
17− ksaric, Adam Vogt, Alexey Shmalko, Corey O'Connor, Cray
36+ Alexey Shmalko,
37+ Corey O'Connor,
38+ Cray Elliott,
18− Elliott, David Johnson, Dmitry Bushev, Domen Kožar, Felix
39+ David Johnson,
40+ Dmitry Bushev,
41+ Domen Kožar,
42+ Felix Kunzmann,
43+ Gabriel Ebner,
44+ Gergely Risko,
19− Kunzmann, Gabriel Ebner, Gergely Risko, Joachim Fasting,
45+ Joachim Fasting,
46+ John Albietz,
47+ John Chee,
48+ Jussi Maki,
20− John Albietz, John Chee, Jussi Maki, Lisanna Dettwyler,
49+ Lisanna Dettwyler,
50+ Mark Laws,
51+ Mark Wotton,
21− Mark Laws, Mark Wotton, Matthew Pickering, Matthew Stewart,
52+ Matthew Pickering,
53+ Matthew Stewart,
54+ Matvey Aksenov,
22− Matvey Aksenov, Nicholas Clarke, Nicolas Rolland, Oliver
55+ Nicholas Clarke,
56+ Nicolas Rolland,
57+ Oliver Charles,
58+ Pascal Wittmann,
23− Charles, Pascal Wittmann, Patrick John Wheeler, Phil de
59+ Patrick John Wheeler,
60+ Phil de Joux,
61+ Piotr Bogdan,
62+ Profpatsch,
24− Joux, Piotr Bogdan, Profpatsch, Raymond Gauthier, Renzo
63+ Raymond Gauthier,
64+ Renzo Carbonara,
25− Carbonara, Rodney Lorrimar, Sibi, Sukant Hajra, Tanner
65+ Rodney Lorrimar,
66+ Sibi,
67+ Sukant Hajra,
68+ Tanner Doshier,
69+ Vaibhav Sagar,
26− Doshier, Vaibhav Sagar, Viktar Basharymau, danbst, karsten
70+ Viktar Basharymau,
71+ danbst,
72+ karsten gebbert,
73+ laMudri,
27− gebbert, laMudri, Александр Цамутали
74+ Александр Цамутали
28maintainer: Peter Simons <simons@cryp.to>
75maintainer: Peter Simons <simons@cryp.to>
29stability: stable
76stability: stable
30−tested-with: GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.1
77+tested-with: GHC == 8.6.4
31category: Distribution, Nix
78category: Distribution, Nix
32homepage: https://github.com/nixos/cabal2nix#readme
79homepage: https://github.com/nixos/cabal2nix#readme
33bug-reports: https://github.com/nixos/cabal2nix/issues
80bug-reports: https://github.com/nixos/cabal2nix/issues
@@ -61,14 +108,14 @@ library
61 other-modules: Paths_cabal2nix
108 other-modules: Paths_cabal2nix
62 hs-source-dirs: src
109 hs-source-dirs: src
63 build-depends: base > 4.11
110 build-depends: base > 4.11
64− , Cabal == 3.0.*
111+ , Cabal > 2.4
65 , aeson > 1
112 , aeson > 1
66 , ansi-wl-pprint
113 , ansi-wl-pprint
67 , bytestring
114 , bytestring
68 , containers >= 0.5.9
115 , containers >= 0.5.9
69 , deepseq >= 1.4
116 , deepseq >= 1.4
70 , directory
117 , directory
71− , distribution-nixpkgs >= 1.3.1
118+ , distribution-nixpkgs >= 1.2
72 , filepath
119 , filepath
73 , hackage-db >= 2.0.1
120 , hackage-db >= 2.0.1
74 , hopenssl >= 2
121 , hopenssl >= 2
@@ -84,6 +131,7 @@ library
84 , transformers
131 , transformers
85 , yaml
132 , yaml
86 default-language: Haskell2010
133 default-language: Haskell2010
134+ default-extensions: MonadFailDesugaring
87 other-extensions: MultiParamTypeClasses
135 other-extensions: MultiParamTypeClasses
88 ScopedTypeVariables
136 ScopedTypeVariables
89 FlexibleInstances
137 FlexibleInstances
@@ -101,6 +149,7 @@ executable cabal2nix
101 hs-source-dirs: cabal2nix
149 hs-source-dirs: cabal2nix
102 build-depends: base, cabal2nix
150 build-depends: base, cabal2nix
103 default-language: Haskell2010
151 default-language: Haskell2010
152+ default-extensions: MonadFailDesugaring
104 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
153 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
105 -Wredundant-constraints
154 -Wredundant-constraints
106
155
@@ -110,7 +159,7 @@ executable hackage2nix
110 Paths_cabal2nix
159 Paths_cabal2nix
111 hs-source-dirs: hackage2nix
160 hs-source-dirs: hackage2nix
112 build-depends: base < 5
161 build-depends: base < 5
113− , Cabal
162+ , Cabal > 2.4
114 , aeson
163 , aeson
115 , bytestring
164 , bytestring
116 , cabal2nix
165 , cabal2nix
@@ -127,15 +176,16 @@ executable hackage2nix
127 , optparse-applicative
176 , optparse-applicative
128 , pretty >= 1.1.2
177 , pretty >= 1.1.2
129 default-language: Haskell2010
178 default-language: Haskell2010
179+ default-extensions: MonadFailDesugaring
130 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
180 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
131− -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-maxN16
181+ -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
132
182
133test-suite regression-test
183test-suite regression-test
134 type: exitcode-stdio-1.0
184 type: exitcode-stdio-1.0
135 main-is: Main.hs
185 main-is: Main.hs
136 hs-source-dirs: test
186 hs-source-dirs: test
137 build-depends: base
187 build-depends: base
138− , Cabal
188+ , Cabal > 2.4
139 , cabal2nix
189 , cabal2nix
140 , containers
190 , containers
141 , directory
191 , directory
@@ -147,6 +197,7 @@ test-suite regression-test
147 , tasty
197 , tasty
148 , tasty-golden
198 , tasty-golden
149 default-language: Haskell2010
199 default-language: Haskell2010
200+ default-extensions: MonadFailDesugaring
150 build-tools: cabal2nix
201 build-tools: cabal2nix
151 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
202 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
152 -Wredundant-constraints -threaded -with-rtsopts=-K64K
203 -Wredundant-constraints -threaded -with-rtsopts=-K64K
hackage2nix/Main.hs+8−9
@@ -10,7 +10,7 @@ import Control.Monad
10import Control.Monad.Par.Combinator
10import Control.Monad.Par.Combinator
11import Control.Monad.Par.IO
11import Control.Monad.Par.IO
12import Control.Monad.Trans ( liftIO )
12import Control.Monad.Trans ( liftIO )
13−import Data.List ( intercalate )
13+import Data.List
14import Data.Map.Strict ( Map )
14import Data.Map.Strict ( Map )
15import qualified Data.Map.Strict as Map
15import qualified Data.Map.Strict as Map
16import Data.Maybe
16import Data.Maybe
@@ -23,7 +23,6 @@ import Distribution.Nixpkgs.Haskell.Constraint
23import Distribution.Nixpkgs.Haskell.FromCabal
23import Distribution.Nixpkgs.Haskell.FromCabal
24import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
24import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
25import Distribution.Nixpkgs.Haskell.FromCabal.Flags
25import Distribution.Nixpkgs.Haskell.FromCabal.Flags
26−import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
27import Distribution.Nixpkgs.Meta
26import Distribution.Nixpkgs.Meta
28import Distribution.Nixpkgs.PackageMap
27import Distribution.Nixpkgs.PackageMap
29import Distribution.Package
28import Distribution.Package
@@ -63,7 +62,7 @@ main = do
63 pinfo :: ParserInfo CLI
62 pinfo :: ParserInfo CLI
64 pinfo = info
63 pinfo = info
65 ( helper
64 ( helper
66− <*> infoOption ("hackage2nix " ++ prettyShow Main.version) (long "version" <> help "Show version number")
65+ <*> infoOption ("hackage2nix " ++ display Main.version) (long "version" <> help "Show version number")
67 <*> cliOptions
66 <*> cliOptions
68 )
67 )
69 ( fullDesc
68 ( fullDesc
@@ -93,7 +92,7 @@ main = do
93 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
92 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
94
93
95 defaultPackageOverridesSet :: PackageSet
94 defaultPackageOverridesSet :: PackageSet
96− defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _ _) <- defaultPackageOverrides config ]
95+ defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _) <- defaultPackageOverrides config ]
97
96
98 generatedDefaultPackageSet :: PackageSet
97 generatedDefaultPackageSet :: PackageSet
99 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
98 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
@@ -106,7 +105,7 @@ main = do
106
105
107 extraPackageSet :: PackageMultiSet
106 extraPackageSet :: PackageMultiSet
108 extraPackageSet = Map.unionsWith Set.union
107 extraPackageSet = Map.unionsWith Set.union
109− [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _ _) <- extraPackages config ]
108+ [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _) <- extraPackages config ]
110
109
111 db :: PackageMultiSet
110 db :: PackageMultiSet
112 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
111 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
@@ -116,7 +115,7 @@ main = do
116 ]
115 ]
117
116
118 haskellResolver :: Dependency -> Bool
117 haskellResolver :: Dependency -> Bool
119− haskellResolver (Dependency name vrange _)
118+ haskellResolver (Dependency name vrange)
120 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
119 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
121 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
120 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
122 | otherwise = False
121 | otherwise = False
@@ -138,7 +137,7 @@ main = do
138 let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool
137 let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool
139 isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)
138 isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)
140 isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)
139 isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)
141− isBroken = any (withinRange v) [ vr | Dependency pn vr _ <- brokenPackages config, pn == name ]
140+ isBroken = any (withinRange v) [ vr | Dependency pn vr <- brokenPackages config, pn == name ]
142
141
143 droppedPlatforms :: Set Platform
142 droppedPlatforms :: Set Platform
144 droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)
143 droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)
@@ -165,7 +164,7 @@ main = do
165 & metaSection.homepage .~ ""
164 & metaSection.homepage .~ ""
166
165
167 overrides :: Doc
166 overrides :: Doc
168− overrides = fcat $ punctuate space [ pPrint b <> semi | b <- Set.toList (view (dependencies . each) drv `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]
167+ overrides = fcat $ punctuate space [ disp b <> semi | b <- Set.toList (view (dependencies . each) drv `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]
169 return $ render $ nest 2 $
168 return $ render $ nest 2 $
170 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
169 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
171
170
@@ -205,7 +204,7 @@ resolveConstraint c = fromMaybe (error msg) . resolveConstraint' c
205 ]
204 ]
206
205
207resolveConstraint' :: Constraint -> Hackage -> Maybe Version
206resolveConstraint' :: Constraint -> Hackage -> Maybe Version
208−resolveConstraint' (Dependency name vrange _) hackage
207+resolveConstraint' (Dependency name vrange) hackage
209 | Just vset' <- Map.lookup name hackage
208 | Just vset' <- Map.lookup name hackage
210 , vset <- Set.filter (`withinRange` vrange) vset'
209 , vset <- Set.filter (`withinRange` vrange) vset'
211 , not (Set.null vset) = Just (Set.findMax vset)
210 , not (Set.null vset) = Just (Set.findMax vset)
hackage2nix/README.md−3
@@ -15,9 +15,6 @@ and we want to check that hackage-packages.nix will be updated correctly.
15On macOS you can use [this](https://gist.github.com/dixson3/8360571) to create one
15On macOS you can use [this](https://gist.github.com/dixson3/8360571) to create one
16(you can replace 60g with 4g as that should be plenty).
16(you can replace 60g with 4g as that should be plenty).
17
17
18−There is a [video on YouTube](https://www.youtube.com/watch?v=qX0mgtSm360)
19−that gives a thorough walk-through of these steps.
20−
21#### Setup
18#### Setup
22Replace `git@github.com:NixOS/nixpkgs.git` with a fork you have access to.
19Replace `git@github.com:NixOS/nixpkgs.git` with a fork you have access to.
23```
20```
src/Cabal2nix.hs+12−10
@@ -11,12 +11,14 @@ module Cabal2nix
11import Control.Exception ( bracket )
11import Control.Exception ( bracket )
12import Control.Lens
12import Control.Lens
13import Control.Monad
13import Control.Monad
14−import Data.List ( intercalate, isPrefixOf )
14+import Data.List
15import Data.List.Split
15import Data.List.Split
16import Data.Maybe ( fromMaybe, isJust, listToMaybe )
16import Data.Maybe ( fromMaybe, isJust, listToMaybe )
17+import Data.Monoid ( (<>) )
17import qualified Data.Set as Set
18import qualified Data.Set as Set
18import Data.String
19import Data.String
19import Data.Time
20import Data.Time
21+import qualified Distribution.Compat.ReadP as P
20import Distribution.Compiler
22import Distribution.Compiler
21import Distribution.Nixpkgs.Fetch
23import Distribution.Nixpkgs.Fetch
22import Distribution.Nixpkgs.Haskell
24import Distribution.Nixpkgs.Haskell
@@ -24,14 +26,13 @@ import Distribution.Nixpkgs.Haskell.FromCabal
24import Distribution.Nixpkgs.Haskell.FromCabal.Flags
26import Distribution.Nixpkgs.Haskell.FromCabal.Flags
25import qualified Distribution.Nixpkgs.Haskell.FromCabal.PostProcess as PP (pkg)
27import qualified Distribution.Nixpkgs.Haskell.FromCabal.PostProcess as PP (pkg)
26import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
28import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
27−import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
28import Distribution.Nixpkgs.Haskell.PackageSourceSpec
29import Distribution.Nixpkgs.Haskell.PackageSourceSpec
29import Distribution.Nixpkgs.Meta
30import Distribution.Nixpkgs.Meta
30−import Distribution.Package ( packageId )
31import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )
31import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )
32−import Distribution.Parsec as P
32+import Distribution.Package ( packageId )
33import Distribution.Simple.Utils ( lowercase )
33import Distribution.Simple.Utils ( lowercase )
34import Distribution.System
34import Distribution.System
35+import Distribution.Text
35import Language.Nix
36import Language.Nix
36import Options.Applicative
37import Options.Applicative
37import Paths_cabal2nix ( version )
38import Paths_cabal2nix ( version )
@@ -93,8 +94,8 @@ options = Options
93 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
94 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
94 <*> switch (long "shell" <> help "generate output suitable for nix-shell")
95 <*> switch (long "shell" <> help "generate output suitable for nix-shell")
95 <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")
96 <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")
96− <*> option parseCabal (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith prettyShow)
97+ <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)
97− <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith prettyShow)
98+ <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
98 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
99 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
99 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
100 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
100 <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
101 <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
@@ -109,8 +110,10 @@ utcTimeReader = eitherReader $ \arg ->
109 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
110 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
110 Just utcTime -> Right utcTime
111 Just utcTime -> Right utcTime
111
112
112−parseCabal :: Parsec a => ReadM a
113+readP :: P.ReadP a a -> ReadM a
113−parseCabal = eitherReader eitherParsec
114+readP p = eitherReader $ \s -> case [ r' | (r',"") <- P.readP_to_S p s ] of
115+ (r:_) -> Right r
116+ _ -> Left ("invalid value " ++ show s)
114
117
115-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
118-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
116-- since the output of that is what Cabal parses.
119-- since the output of that is what Cabal parses.
@@ -135,7 +138,6 @@ ghcConvertOS os = case os of
135 "watchos" -> "ios"
138 "watchos" -> "ios"
136 "tvos" -> "ios"
139 "tvos" -> "ios"
137 "linux-android" -> "linux-android"
140 "linux-android" -> "linux-android"
138− "linux-androideabi" -> "linux-androideabi"
139 _ | "linux-" `isPrefixOf` os -> "linux"
141 _ | "linux-" `isPrefixOf` os -> "linux"
140 _ -> fromMaybe os $ listToMaybe
142 _ -> fromMaybe os $ listToMaybe
141 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
143 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
@@ -162,7 +164,7 @@ parsePlatformParts = \case
162pinfo :: ParserInfo Options
164pinfo :: ParserInfo Options
163pinfo = info
165pinfo = info
164 ( helper
166 ( helper
165− <*> infoOption ("cabal2nix " ++ prettyShow version) (long "version" <> help "Show version number")
167+ <*> infoOption ("cabal2nix " ++ display version) (long "version" <> help "Show version number")
166 <*> options
168 <*> options
167 )
169 )
168 ( fullDesc
170 ( fullDesc
src/Distribution/Nixpkgs/Fetch.hs+1−3
@@ -161,9 +161,7 @@ fetchWith (supportsRev, kind, addArgs) source = do
161 ExitFailure _ -> return Nothing
161 ExitFailure _ -> return Nothing
162 ExitSuccess -> do
162 ExitSuccess -> do
163 buf <- BS.hGetContents stdoutH
163 buf <- BS.hGetContents stdoutH
164− let (l,ls) = case reverse (BS.lines buf) of
164+ let (l:ls) = reverse (BS.lines buf)
165− [] -> error "This can't happen, but GHC doesn't know that."
166− (x:xs) -> (x,xs)
167 buf' = BS.unlines (reverse ls)
165 buf' = BS.unlines (reverse ls)
168 case length ls of
166 case length ls of
169 0 -> return Nothing
167 0 -> return Nothing
src/Distribution/Nixpkgs/Haskell/Constraint.hs+1−1
@@ -9,7 +9,7 @@ import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
9type Constraint = Dependency
9type Constraint = Dependency
10
10
11satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool
11satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool
12−satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr _) = (pn /= cn) || (v `withinRange` vr)
12+satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr) = (pn /= cn) || (v `withinRange` vr)
13
13
14satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool
14satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool
15satisfiesConstraints p = all (satisfiesConstraint p)
15satisfiesConstraints p = all (satisfiesConstraint p)
src/Distribution/Nixpkgs/Haskell/Derivation.hs+3−3
@@ -15,7 +15,7 @@ module Distribution.Nixpkgs.Haskell.Derivation
15
15
16import Control.DeepSeq
16import Control.DeepSeq
17import Control.Lens
17import Control.Lens
18−import Data.List ( isPrefixOf )
18+import Data.List
19import Data.Set ( Set )
19import Data.Set ( Set )
20import qualified Data.Set as Set
20import qualified Data.Set as Set
21import Data.Set.Lens
21import Data.Set.Lens
@@ -112,8 +112,8 @@ instance Pretty Derivation where
112 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
112 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
113 [ text "mkDerivation" <+> lbrace
113 [ text "mkDerivation" <+> lbrace
114 , nest 2 $ vcat
114 , nest 2 $ vcat
115− [ attr "pname" $ doubleQuotes $ pPrint (packageName _pkgid)
115+ [ attr "pname" $ doubleQuotes $ disp (packageName _pkgid)
116− , attr "version" $ doubleQuotes $ pPrint (packageVersion _pkgid)
116+ , attr "version" $ doubleQuotes $ disp (packageVersion _pkgid)
117 , pPrint _src
117 , pPrint _src
118 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
118 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
119 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
119 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
src/Distribution/Nixpkgs/Haskell/FromCabal.hs+7−7
@@ -58,14 +58,14 @@ finalizeGenericPackageDescription haskellResolver arch compiler flags constraint
58 }
58 }
59
59
60 jailbroken :: HaskellResolver -> HaskellResolver
60 jailbroken :: HaskellResolver -> HaskellResolver
61− jailbroken resolver (Dependency pkg _ _) = resolver (Dependency pkg anyVersion mempty)
61+ jailbroken resolver (Dependency pkg _) = resolver (Dependency pkg anyVersion)
62
62
63 withInternalLibs :: HaskellResolver -> HaskellResolver
63 withInternalLibs :: HaskellResolver -> HaskellResolver
64 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
64 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
65
65
66 internalNames :: [PackageName]
66 internalNames :: [PackageName]
67 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
67 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
68− ++ [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries (packageDescription genDesc) ]
68+ ++ [ unqualComponentNameToPackageName n | Just n <- libName <$> subLibraries (packageDescription genDesc) ]
69
69
70 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
70 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
71 Left m -> case finalize (const True) of
71 Left m -> case finalize (const True) of
@@ -119,7 +119,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
119 nixLicense = either fromSPDXLicense fromCabalLicense licenseRaw
119 nixLicense = either fromSPDXLicense fromCabalLicense licenseRaw
120
120
121 resolveInHackage :: Identifier -> Binding
121 resolveInHackage :: Identifier -> Binding
122− resolveInHackage i | (i^.ident) `elem` [ unPackageName n | (Dependency n _ _) <- missingDeps ] = bindNull i
122+ resolveInHackage i | (i^.ident) `elem` [ unPackageName n | (Dependency n _) <- missingDeps ] = bindNull i
123 | otherwise = binding # (i, path # ["self",i]) -- TODO: "self" shouldn't be hardcoded.
123 | otherwise = binding # (i, path # ["self",i]) -- TODO: "self" shouldn't be hardcoded.
124
124
125 -- TODO: This is all very confusing. Haskell packages refer to the Nixpkgs
125 -- TODO: This is all very confusing. Haskell packages refer to the Nixpkgs
@@ -144,11 +144,11 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
144 | otherwise = bindNull i
144 | otherwise = bindNull i
145
145
146 resolveInHackageThenNixpkgs :: Identifier -> Binding
146 resolveInHackageThenNixpkgs :: Identifier -> Binding
147− resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion mempty) = resolveInHackage i
147+ resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion) = resolveInHackage i
148 | otherwise = resolveInNixpkgs i
148 | otherwise = resolveInNixpkgs i
149
149
150 internalLibNames :: [PackageName]
150 internalLibNames :: [PackageName]
151− internalLibNames = [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries ]
151+ internalLibNames = fmap unqualComponentNameToPackageName . catMaybes $ libName <$> subLibraries
152
152
153 doHaddockPhase :: Bool
153 doHaddockPhase :: Bool
154 doHaddockPhase | not (null internalLibNames) = False
154 doHaddockPhase | not (null internalLibNames) = False
@@ -158,7 +158,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
158 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
158 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
159 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
159 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
160 convertBuildInfo Cabal.BuildInfo {..} = mempty
160 convertBuildInfo Cabal.BuildInfo {..} = mempty
161− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- targetBuildDepends, x `notElem` internalLibNames ]
161+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- targetBuildDepends, x `notElem` internalLibNames ]
162 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
162 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
163 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
163 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
164 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
164 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
@@ -166,7 +166,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
166
166
167 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
167 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
168 convertSetupBuildInfo bi = mempty
168 convertSetupBuildInfo bi = mempty
169− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- Cabal.setupDepends bi ]
169+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- Cabal.setupDepends bi ]
170
170
171bindNull :: Identifier -> Binding
171bindNull :: Identifier -> Binding
172bindNull i = binding # (i, path # ["null"])
172bindNull i = binding # (i, path # ["null"])
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+2−5
@@ -9,13 +9,10 @@ module Distribution.Nixpkgs.Haskell.FromCabal.Configuration
9 )
9 )
10 where
10 where
11
11
12−import Prelude hiding ( fail )
13−
14import Control.DeepSeq
12import Control.DeepSeq
15import Control.Exception ( throwIO )
13import Control.Exception ( throwIO )
16import Control.Lens
14import Control.Lens
17−import Control.Monad hiding ( fail )
15+import Control.Monad
18−import Control.Monad.Fail
19import Data.Aeson
16import Data.Aeson
20import Data.Map as Map
17import Data.Map as Map
21import Data.Set as Set
18import Data.Set as Set
@@ -94,7 +91,7 @@ parseKey s = either error id (parseEither parseJSON (String s))
94readConfiguration :: FilePath -> IO Configuration
91readConfiguration :: FilePath -> IO Configuration
95readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency
92readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency
96
93
97−assertConsistency :: MonadFail m => Configuration -> m Configuration
94+assertConsistency :: Monad m => Configuration -> m Configuration
98assertConsistency cfg@Configuration {..} = do
95assertConsistency cfg@Configuration {..} = do
99 let report msg = fail ("*** configuration error: " ++ msg)
96 let report msg = fail ("*** configuration error: " ++ msg)
100 maintainedPackages = Set.unions (Map.elems packageMaintainers)
97 maintainedPackages = Set.unions (Map.elems packageMaintainers)
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+3−9
@@ -4,7 +4,6 @@ module Distribution.Nixpkgs.Haskell.FromCabal.Flags ( configureCabalFlags ) wher
4
4
5import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
5import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
6
6
7−import Data.Char
8import Distribution.Package
7import Distribution.Package
9import Distribution.PackageDescription
8import Distribution.PackageDescription
10import Distribution.Version
9import Distribution.Version
@@ -16,7 +15,6 @@ configureCabalFlags' :: PackageIdentifier -> [(FlagName,Bool)]
16configureCabalFlags' (PackageIdentifier name version)
15configureCabalFlags' (PackageIdentifier name version)
17 | name == "accelerate-examples"= [disable "opencl"]
16 | name == "accelerate-examples"= [disable "opencl"]
18 | name == "arithmoi" = [disable "llvm"]
17 | name == "arithmoi" = [disable "llvm"]
19− | name == "bustle" = [disable "hgettext"] -- https://gitlab.freedesktop.org/bustle/bustle/issues/13
20 | name == "cabal-plan" = [enable "exe"]
18 | name == "cabal-plan" = [enable "exe"]
21 | name == "cassava" = [disable "bytestring--lt-0_10_4"]
19 | name == "cassava" = [disable "bytestring--lt-0_10_4"]
22 | name == "darcs" = [enable "library", enable "force-char8-encoding"]
20 | name == "darcs" = [enable "library", enable "force-char8-encoding"]
@@ -28,7 +26,7 @@ configureCabalFlags' (PackageIdentifier name version)
28 , enable "dbus"
26 , enable "dbus"
29 , disable "debuglocks"
27 , disable "debuglocks"
30 , enable "magicmime"
28 , enable "magicmime"
31− , enable "networkbsd"
29+ , disable "networkbsd"
32 , enable "pairing"
30 , enable "pairing"
33 , enable "production"
31 , enable "production"
34 , enable "s3"
32 , enable "s3"
@@ -47,7 +45,6 @@ configureCabalFlags' (PackageIdentifier name version)
47 | name == "io-streams" = [enable "NoInteractiveTests"]
45 | name == "io-streams" = [enable "NoInteractiveTests"]
48 | name == "liquid-fixpoint" = [enable "build-external"]
46 | name == "liquid-fixpoint" = [enable "build-external"]
49 | name == "pandoc" = [enable "https", disable "trypandoc"]
47 | name == "pandoc" = [enable "https", disable "trypandoc"]
50− | name == "pandoc-placetable" = [enable "inlineMarkdown"]
51 | name == "persistent-sqlite" = [enable "systemlib"]
48 | name == "persistent-sqlite" = [enable "systemlib"]
52 | name == "reactive-banana-wx" = [disable "buildExamples"]
49 | name == "reactive-banana-wx" = [disable "buildExamples"]
53 | name == "snap-server" = [enable "openssl"]
50 | name == "snap-server" = [enable "openssl"]
@@ -59,10 +56,7 @@ configureCabalFlags' (PackageIdentifier name version)
59 | otherwise = []
56 | otherwise = []
60
57
61enable :: String -> (FlagName,Bool)
58enable :: String -> (FlagName,Bool)
62−enable name = (mkFlagName' name, True)
59+enable name = (mkFlagName name, True)
63
60
64disable :: String -> (FlagName,Bool)
61disable :: String -> (FlagName,Bool)
65−disable name = (mkFlagName' name, False)
62+disable name = (mkFlagName name, False)
66−
67−mkFlagName' :: String -> FlagName
68−mkFlagName' = mkFlagName . map toLower
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs+4−6
@@ -29,7 +29,6 @@ libNixName "appindicator-0.1" = return "libappindicator-gtk2"
29libNixName "appindicator3-0.1" = return "libappindicator-gtk3"
29libNixName "appindicator3-0.1" = return "libappindicator-gtk3"
30libNixName "asound" = return "alsaLib"
30libNixName "asound" = return "alsaLib"
31libNixName "b2" = return "libb2"
31libNixName "b2" = return "libb2"
32−libNixName "boost_context" = return "boost"
33libNixName "bz2" = return "bzip2"
32libNixName "bz2" = return "bzip2"
34libNixName "c++" = [] -- What is that?
33libNixName "c++" = [] -- What is that?
35libNixName "cairo-gobject" = return "cairo"
34libNixName "cairo-gobject" = return "cairo"
@@ -95,8 +94,6 @@ libNixName "ldap" = return "openldap"
95libNixName "libavutil" = return "ffmpeg"
94libNixName "libavutil" = return "ffmpeg"
96libNixName "libgsasl" = return "gsasl"
95libNixName "libgsasl" = return "gsasl"
97libNixName "libpcre" = return "pcre"
96libNixName "libpcre" = return "pcre"
98−libNixName "libpcre2" = return "pcre2"
99−libNixName "libpcre2-8" = libNixName "libpcre2"
100libNixName "libqrencode" = return "qrencode"
97libNixName "libqrencode" = return "qrencode"
101libNixName "libR" = return "R"
98libNixName "libR" = return "R"
102libNixName "libsoup-gnome-2.4" = return "libsoup"
99libNixName "libsoup-gnome-2.4" = return "libsoup"
@@ -112,9 +109,9 @@ libNixName "mnl" = return "libmnl"
112libNixName "mpi" = return "openmpi"
109libNixName "mpi" = return "openmpi"
113libNixName "ncursesw" = return "ncurses"
110libNixName "ncursesw" = return "ncurses"
114libNixName "netsnmp" = return "net_snmp"
111libNixName "netsnmp" = return "net_snmp"
115−libNixName "nix-expr" = return "nix"
112+libNixNAme "nix-expr" = return "nix"
116−libNixName "nix-main" = return "nix"
113+libNixNAme "nix-main" = return "nix"
117−libNixName "nix-store" = return "nix"
114+libNixNAme "nix-store" = return "nix"
118libNixName "notify" = return "libnotify"
115libNixName "notify" = return "libnotify"
119libNixName "odbc" = return "unixODBC"
116libNixName "odbc" = return "unixODBC"
120libNixName "openblas" = return "openblasCompat"
117libNixName "openblas" = return "openblasCompat"
@@ -203,6 +200,7 @@ buildToolNixName "nix-env" = return "nix"
203buildToolNixName "nix-hash" = return "nix"
200buildToolNixName "nix-hash" = return "nix"
204buildToolNixName "nix-instantiate" = return "nix"
201buildToolNixName "nix-instantiate" = return "nix"
205buildToolNixName "nix-store" = return "nix"
202buildToolNixName "nix-store" = return "nix"
203+buildToolNixName "pkg-config" = return "pkgconfig"
206buildToolNixName x = return (fromString x)
204buildToolNixName x = return (fromString x)
207
205
208-- | Helper function to extract the package name from a String that may or may
206-- | Helper function to extract the package name from a String that may or may
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+4−11
@@ -13,7 +13,6 @@ import Data.Set ( Set )
13import qualified Data.Set as Set
13import qualified Data.Set as Set
14import Distribution.Nixpkgs.Haskell
14import Distribution.Nixpkgs.Haskell
15import Distribution.Nixpkgs.Meta
15import Distribution.Nixpkgs.Meta
16−import Distribution.Nixpkgs.License
17import Distribution.Package
16import Distribution.Package
18import Distribution.System
17import Distribution.System
19import Distribution.Text
18import Distribution.Text
@@ -22,7 +21,7 @@ import Language.Nix
22
21
23postProcess :: Derivation -> Derivation
22postProcess :: Derivation -> Derivation
24postProcess deriv =
23postProcess deriv =
25− foldr (.) id [ f | (Dependency n vr _, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
24+ foldr (.) id [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
26 . fixGtkBuilds
25 . fixGtkBuilds
27 . fixBuildDependsForTools
26 . fixBuildDependsForTools
28 $ deriv
27 $ deriv
@@ -79,7 +78,7 @@ hooks =
79 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
78 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
80 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
79 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
81 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
80 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
82− , ("bustle", bustleOverrides)
81+ , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
83 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
82 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
84 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
83 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
85 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
84 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
@@ -90,7 +89,7 @@ hooks =
90 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
89 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
91 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
90 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
92 , ("freenect < 1.2.1", over configureFlags (Set.union (Set.fromList ["--extra-include-dirs=${pkgs.freenect}/include/libfreenect", "--extra-lib-dirs=${pkgs.freenect}/lib"])))
91 , ("freenect < 1.2.1", over configureFlags (Set.union (Set.fromList ["--extra-include-dirs=${pkgs.freenect}/include/libfreenect", "--extra-lib-dirs=${pkgs.freenect}/lib"])))
93− , ("fltkhs", set (libraryDepends . system . contains (pkg "fltk14")) True . over (libraryDepends . pkgconfig) (Set.union (pkgs ["libGLU", "libGL"]))) -- TODO: fltk14 belongs into the *setup* dependencies.
92+ , ("fltkhs", set (libraryDepends . system . contains (pkg "fltk14")) True . set (libraryDepends . pkgconfig . contains (pkg "libGLU_combined")) True) -- TODO: fltk14 belongs into the *setup* dependencies.
94 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
93 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
95 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
94 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
96 , ("gi-gdk", set runHaddock True )
95 , ("gi-gdk", set runHaddock True )
@@ -256,7 +255,7 @@ gfPhaseOverrides = unlines
256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
255 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
257 -- Parallel compilation fails. Disable it.
256 -- Parallel compilation fails. Disable it.
258 , "'';"
257 , "'';"
259− , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH'';"
258+ , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build:$LD_LIBRARY_PATH'';"
260 -- The build step itself, after having built the library, needs to be able
259 -- The build step itself, after having built the library, needs to be able
261 -- to find the library it just built in order to compile grammar files.
260 -- to find the library it just built in order to compile grammar files.
262 ]
261 ]
@@ -401,9 +400,3 @@ pandocOverrides = set phaseOverrides postInstall
401 , " mv \"man/\"*.1 $out/share/man/man1/"
400 , " mv \"man/\"*.1 $out/share/man/man1/"
402 , "'';"
401 , "'';"
403 ]
402 ]
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
src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs+3−24
@@ -9,12 +9,9 @@ import qualified Data.Text as T
9import Data.Yaml
9import Data.Yaml
10import Distribution.Compiler
10import Distribution.Compiler
11import Distribution.Package
11import Distribution.Package
12−import Distribution.Parsec
13import Distribution.System
12import Distribution.System
14−import Distribution.Pretty as Cabal
13+import Distribution.Text
15−import qualified Data.Version as Base
16import Distribution.Version
14import Distribution.Version
17−import Language.Nix.PrettyPrinting as Nix
18
15
19instance NFData CompilerInfo
16instance NFData CompilerInfo
20instance NFData AbiTag
17instance NFData AbiTag
@@ -64,25 +61,7 @@ instance FromJSON CompilerInfo where
64 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
61 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
65 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
62 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
66
63
67−instance Nix.Pretty Version where
68− pPrint = pretty
69−
70−instance Nix.Pretty PackageName where
71− pPrint = pretty
72−
73−instance Nix.Pretty PackageIdentifier where
74− pPrint = pretty
75−
76−instance Nix.Pretty CompilerId where
77− pPrint = pretty
78−
79−instance Nix.Pretty Platform where
80− pPrint = pretty
81−
82−instance Nix.Pretty Base.Version where
83− pPrint = text . Base.showVersion
84−
85-- parsing tools
64-- parsing tools
86
65
87−text2isString :: Parsec a => String -> String -> a
66+text2isString :: Text a => String -> String -> a
88−text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParsec s)
67+text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParse s)
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs+8−9
@@ -11,18 +11,16 @@ import qualified Data.ByteString.Char8 as BS
11import Data.List ( isSuffixOf, isPrefixOf )
11import Data.List ( isSuffixOf, isPrefixOf )
12import qualified Data.Map as DB
12import qualified Data.Map as DB
13import Data.Maybe
13import Data.Maybe
14−import qualified Data.Text as T
15−import qualified Data.Text.Encoding as T
16import Data.Time
14import Data.Time
17import Distribution.Nixpkgs.Fetch
15import Distribution.Nixpkgs.Fetch
18import Distribution.Nixpkgs.Hashes
16import Distribution.Nixpkgs.Hashes
19import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
17import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
20−import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
21import qualified Distribution.Package as Cabal
18import qualified Distribution.Package as Cabal
22import Distribution.PackageDescription
19import Distribution.PackageDescription
23import qualified Distribution.PackageDescription as Cabal
20import qualified Distribution.PackageDescription as Cabal
24import Distribution.PackageDescription.Parsec as Cabal
21import Distribution.PackageDescription.Parsec as Cabal
25−import Distribution.Parsec
22+import Distribution.Parsec.Common (showPError)
23+import Distribution.Text ( simpleParse, display )
26import Distribution.Version
24import Distribution.Version
27import qualified Hpack.Config as Hpack
25import qualified Hpack.Config as Hpack
28import qualified Hpack.Render as Hpack
26import qualified Hpack.Render as Hpack
@@ -31,7 +29,8 @@ import System.Directory ( doesDirectoryExist, doesFileExist, createDirectoryIfMi
31import System.Exit ( exitFailure )
29import System.Exit ( exitFailure )
32import System.FilePath ( (</>), (<.>) )
30import System.FilePath ( (</>), (<.>) )
33import System.IO
31import System.IO
34−import Text.PrettyPrint.HughesPJClass hiding ( first )
32+import qualified Data.Text as T
33+import qualified Data.Text.Encoding as T
35
34
36data HpackUse
35data HpackUse
37 = ForceHpack
36 = ForceHpack
@@ -108,12 +107,12 @@ fromDB hackageDBIO pkg = do
108 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
107 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
109 where
108 where
110 pkgId :: Cabal.PackageIdentifier
109 pkgId :: Cabal.PackageIdentifier
111− pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParsec pkg)
110+ pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
112 name = Cabal.packageName pkgId
111 name = Cabal.packageName pkgId
113
112
114− unknownPackageError = fail $ "No such package " ++ prettyShow pkgId ++ " in the cabal database. Did you run cabal update?"
113+ unknownPackageError = fail $ "No such package " ++ display pkgId ++ " in the cabal database. Did you run cabal update?"
115
114
116− url = "mirror://hackage/" ++ prettyShow pkgId ++ ".tar.gz"
115+ url = "mirror://hackage/" ++ display pkgId ++ ".tar.gz"
117
116
118 version :: Version
117 version :: Version
119 version = Cabal.packageVersion pkgId
118 version = Cabal.packageVersion pkgId
@@ -176,7 +175,7 @@ sourceFromHackage optHash pkgId cabalDir = do
176 exitFailure
175 exitFailure
177
176
178showPackageIdentifier :: Cabal.GenericPackageDescription -> String
177showPackageIdentifier :: Cabal.GenericPackageDescription -> String
179−showPackageIdentifier pkgDesc = name ++ "-" ++ prettyShow version where
178+showPackageIdentifier pkgDesc = name ++ "-" ++ display version where
180 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
179 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
181 name = Cabal.unPackageName (Cabal.packageName pkgId)
180 name = Cabal.unPackageName (Cabal.packageName pkgId)
182 version = Cabal.packageVersion pkgId
181 version = Cabal.packageVersion pkgId
update-stackage.sh+3−2
@@ -25,7 +25,6 @@ sed -r \
25sed -r \
25sed -r \
26 -e '/ cabal-install /d' \
26 -e '/ cabal-install /d' \
27 -e '/ cabal2nix /d' \
27 -e '/ cabal2nix /d' \
28− -e '/ cabal2spec /d' \
29 -e '/ distribution-nixpkgs /d' \
28 -e '/ distribution-nixpkgs /d' \
30 -e '/ git-annex /d' \
29 -e '/ git-annex /d' \
31 -e '/ hindent /d' \
30 -e '/ hindent /d' \
@@ -35,6 +34,8 @@ sed -r \
35 -e '/ hopenssl /d' \
34 -e '/ hopenssl /d' \
36 -e '/ jailbreak-cabal /d' \
35 -e '/ jailbreak-cabal /d' \
37 -e '/ json-autotype/d' \
36 -e '/ json-autotype/d' \
37+ -e '/ lambdabot-core /d' \
38+ -e '/ lambdabot-irc-plugins /d' \
38 -e '/ language-nix /d' \
39 -e '/ language-nix /d' \
39 -e '/ shake /d' \
40 -e '/ shake /d' \
40 -e '/ ShellCheck /d' \
41 -e '/ ShellCheck /d' \
@@ -44,7 +45,7 @@ sed -r \
44
45
45# Drop the previous configuration ...
46# Drop the previous configuration ...
46# shellcheck disable=SC1004
47# shellcheck disable=SC1004
47−sed -e '/ # LTS Haskell/,/^$/c \TODO\
48+sed -e '/# LTS Haskell/,/^$/c \TODO\
48' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
49' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
49
50
50# ... and replace it with the new one.
51# ... and replace it with the new one.