git.iko.soy/typeable/cabal2nix
on master help sign in
41 files changed+448−340
since splitsnapshots
unifiedsplit
.travis.yml+131−84 README.md+7−7 cabal2nix.cabal+29−81 hackage2nix/Main.hs+24−18 hackage2nix/README.md+3 src/Cabal2nix.hs+23−15 src/Distribution/Nixpkgs/Fetch.hs+3−1 src/Distribution/Nixpkgs/Haskell/Constraint.hs+1−1 src/Distribution/Nixpkgs/Haskell/Derivation.hs+7−4 src/Distribution/Nixpkgs/Haskell/FromCabal.hs+13−12 src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+28−32 src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+14−15 src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+6 src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs+16−8 src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+39−13 src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs+28−3 src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs+39−26 test/Main.hs+3−11 test/golden-test-cases/ede.nix.golden+1 test/golden-test-cases/gogol-adexchange-buyer.nix.golden+1 test/golden-test-cases/gogol-admin-emailmigration.nix.golden+1 test/golden-test-cases/gogol-affiliates.nix.golden+1 test/golden-test-cases/gogol-apps-tasks.nix.golden+1 test/golden-test-cases/gogol-appstate.nix.golden+1 test/golden-test-cases/gogol-blogger.nix.golden+1 test/golden-test-cases/gogol-datastore.nix.golden+1 test/golden-test-cases/gogol-dfareporting.nix.golden+1 test/golden-test-cases/gogol-firebase-rules.nix.golden+1 test/golden-test-cases/gogol-gmail.nix.golden+1 test/golden-test-cases/gogol-kgsearch.nix.golden+1 test/golden-test-cases/gogol-maps-engine.nix.golden+1 test/golden-test-cases/gogol-plus.nix.golden+1 test/golden-test-cases/gogol-resourceviews.nix.golden+1 test/golden-test-cases/gogol-translate.nix.golden+1 test/golden-test-cases/gogol-webmaster-tools.nix.golden+1 test/golden-test-cases/gogol-youtube.nix.golden+1 test/golden-test-cases/hxt-expat.nix.golden+1 test/golden-test-cases/hxt-tagsoup.nix.golden+1 test/golden-test-cases/openpgp-asciiarmor.nix.golden+1 test/golden-test-cases/swagger.nix.golden+1 update-stackage.sh+12−9
.travis.yml+131−84
@@ -1,114 +1,161 @@
11# This Travis job script has been generated by a script via
22#
3−# runghc make_travis_yml_2.hs '--doctest' '--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen' '--hlint' '-o' '.travis.yml' 'cabal2nix.cabal'
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'
44#
55# For more information, see https://github.com/haskell-CI/haskell-ci
66#
7+# version: 0.9.20200306
8+#
9+version: ~> 1.0
710language: c
8−sudo: false
9−
11+os: linux
12+dist: xenial
1013git:
11− submodules: false # whether to recursively clone submodules
12−
14+ # whether to recursively clone submodules
15+ submodules: false
1316cache:
1417 directories:
1518 - $HOME/.cabal/packages
1619 - $HOME/.cabal/store
17−
20+ - $HOME/.hlint
1821before_cache:
19− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
22+ - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2023 # remove files that are regenerated by 'cabal update'
21− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
22− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
23− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
24− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
26−
27− - rm -rfv $HOME/.cabal/packages/head.hackage
28−
29−matrix:
24+ - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
25+ - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
26+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
27+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
28+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
29+ - rm -rfv $CABALHOME/packages/head.hackage
30+jobs:
3031 include:
31− - compiler: "ghc-8.6.2"
32− # env: TEST=--disable-tests BENCH=--disable-benchmarks
33− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.2], sources: [hvr-ghc]}}
34− - compiler: "ghc-8.4.4"
35− # env: TEST=--disable-tests BENCH=--disable-benchmarks
36− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
37−
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
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
3844before_install:
39− - HC=${CC}
40− - HCPKG=${HC/ghc/ghc-pkg}
45+ - 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"
4149 - unset CC
42− - ROOTDIR=$(pwd)
43− - mkdir -p $HOME/.local/bin
44− - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
45− - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
50+ - CABAL=/opt/ghc/bin/cabal
51+ - CABALHOME=$HOME/.cabal
52+ - export PATH="$CABALHOME/bin:$PATH"
53+ - TOP=$(pwd)
54+ - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
4655 - echo $HCNUMVER
47−
56+ - CABAL="$CABAL -vnormal+nowrap"
57+ - set -o pipefail
58+ - TEST=--enable-tests
59+ - BENCH=--enable-benchmarks
60+ - HEADHACKAGE=false
61+ - if [ $HCNUMVER -ge 80800 ] ; then HEADHACKAGE=true ; fi
62+ - rm -f $CABALHOME/config
63+ - |
64+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
65+ 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
68+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
69+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
70+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
71+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
72+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
73+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
74+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
75+ echo "install-dirs user" >> $CABALHOME/config
76+ echo " prefix: $CABALHOME" >> $CABALHOME/config
77+ echo "repository hackage.haskell.org" >> $CABALHOME/config
78+ 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
4890install:
49− - cabal --version
91+ - ${CABAL} --version
5092 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
51− - BENCH=${BENCH---enable-benchmarks}
52− - TEST=${TEST---enable-tests}
53− - HADDOCK=${HADDOCK-true}
54− - UNCONSTRAINED=${UNCONSTRAINED-true}
55− - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
56− - GHCHEAD=${GHCHEAD-false}
57− - travis_retry cabal update -v
58− - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
59− - rm -fv cabal.project cabal.project.local
60− - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
61− - (cd /tmp && echo '' | cabal new-repl -w ${HC} --build-dep fail)
62− - if [ $HCNUMVER -ge 80000 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin doctest --constraint='doctest ==0.16.*'; fi
63− - if [ $HCNUMVER -eq 80602 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin hlint --constraint='hlint ==2.1.*'; fi
64− - "printf 'packages: \".\"\\n' > cabal.project"
65− - touch cabal.project.local
66− - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- cabal2nix | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
93+ - |
94+ echo "program-default-options" >> $CABALHOME/config
95+ echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
96+ - cat $CABALHOME/config
97+ - rm -fv cabal.project cabal.project.local cabal.project.freeze
98+ - travis_retry ${CABAL} v2-update -v
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
104+ # Generate cabal.project
105+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
106+ - touch cabal.project
107+ - |
108+ echo "packages: ." >> cabal.project
109+ - |
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"
67111 - cat cabal.project || true
68112 - cat cabal.project.local || true
69− - if [ -f "./configure.ac" ]; then
70− (cd "." && autoreconf -i);
71− fi
72− - rm -f cabal.project.freeze
73− - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
74− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
75− - rm -rf .ghc.environment.* "."/dist
76− - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
77−
78−# Here starts the actual work to be performed for the package under test;
79−# any command which exits with a non-zero exit code causes the build to fail.
113+ - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
114+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
115+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
116+ - rm cabal.project.freeze
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
80119script:
81− # test that source-distributions can be generated
82− - cabal new-sdist all
120+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
121+ # Packaging...
122+ - ${CABAL} v2-sdist all
123+ # Unpacking...
83124 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
84125 - cd ${DISTDIR} || false
85− - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
86− - "printf 'packages: cabal2nix-*/*.cabal\\n' > cabal.project"
87− - touch cabal.project.local
88− - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- cabal2nix | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
126+ - find . -maxdepth 1 -type f -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
130+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
131+ - touch cabal.project
132+ - |
133+ echo "packages: ${PKGDIR_cabal2nix}" >> cabal.project
134+ - |
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"
89136 - cat cabal.project || true
90137 - cat cabal.project.local || true
138+ # Building...
91139 # this builds all libraries and executables (without tests/benchmarks)
92− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
93−
140+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
141+ # Building with tests and benchmarks...
94142 # build & run tests, build benchmarks
95− - cabal new-build -w ${HC} ${TEST} ${BENCH} all
96− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
97−
98− # doctest
99− - if [ $HCNUMVER -ge 80000 ]; then (cd cabal2nix-* && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen -XMonadFailDesugaring src); fi
100−
101− # hlint
102− - if [ $HCNUMVER -eq 80602 ]; then (cd cabal2nix-* && hlint -XMonadFailDesugaring src); fi
103−
104− # cabal check
105− - (cd cabal2nix-* && cabal check)
106−
107− # haddock
108− - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
109−
110− # Build without installed constraints for packages in global-db
111− - if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi
143+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
144+ # Testing...
145+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
146+ # Doctest...
147+ - (cd ${PKGDIR_cabal2nix} && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen src)
148+ # HLint..
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
152+ # cabal check...
153+ - (cd ${PKGDIR_cabal2nix} && ${CABAL} -vnormal check)
154+ # haddock...
155+ - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
156+ # Building without installed constraints for packages in global-db...
157+ - rm -f cabal.project.local
158+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
112159
113−# REGENDATA ["--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","--hlint","-o",".travis.yml","cabal2nix.cabal"]
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"])
114161# EOF
README.md+7−7
@@ -27,16 +27,16 @@ direct `http://host/path/pkg.cabal` URL can be provided, as well as a
2727`file:///local/path/pkg.cabal` URI that doesn't depend on network access.
2828However, if the source hash is not already in `cabal2nix`'s cache or provided
2929using the `--sha256` option, `cabal2nix` still needs to download the source
30−code to compute the hash, which obviously still causes network traffic. Run the
31−utility with `--help` to see the complete list of supported command line flags.
30+code to compute the hash, which still causes network traffic. Run the utility
31+with `--help` to see the complete list of supported command-line flags.
3232
33−Detailed instructions how to use those generated files with Nix can be found at
34−http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure.
33+Detailed instructions on how to use those generated files with Nix can be found at
34+https://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages.
3535
3636`cabal2nix` can also build derivations for projects from other sources than
37−hackage. You only need to provide an URI that points to a cabal project. The
38−most common usecase for this is probably to generate a derivation for a project
39−on the local file system:
37+Hackage. You only need to provide a URI that points to a cabal project. The
38+most common use-case for this is probably to generate a derivation for a
39+project on the local file system:
4040
4141 $ cabal get mtl-2.2.1 && cd mtl-2.2.1
4242 $ cabal2nix .
cabal2nix.cabal+29−81
@@ -1,5 +1,5 @@
11name: cabal2nix
2−version: 2.11.1
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
@@ -8,73 +8,26 @@ description:
88 > nix-env -i cabal2nix
99license: BSD3
1010license-file: LICENSE
11−author: Peter Simons,
12− Andres Loeh,
13− Benno Fünfstück,
14− Mateusz Kowalczyk,
15− Michael Alan Dorman,
16− Tom Smalley,
17− Mathijs Kwik,
18− Shea Levy,
19− Dmitry Malikov,
20− Eric Seidel,
21− Jacob Mitchell,
22− Graham Christensen,
23− Hamish Mackenzie,
24− Nikolay Amiantov,
25− Aycan iRiCAN,
26− Bryan Gardiner,
27− Joe Hermaszewski,
28− John Wiegley,
29− Philipp Hausmann,
30− Spencer Janssen,
31− Tom Hunger,
32− William Casarin,
33− koral,
34− ksaric,
35− Adam Vogt,
36− Alexey Shmalko,
37− Corey O'Connor,
38− Cray Elliott,
39− David Johnson,
40− Dmitry Bushev,
41− Domen Kožar,
42− Felix Kunzmann,
43− Gabriel Ebner,
44− Gergely Risko,
45− Joachim Fasting,
46− John Albietz,
47− John Chee,
48− Jussi Maki,
49− Lisanna Dettwyler,
50− Mark Laws,
51− Mark Wotton,
52− Matthew Pickering,
53− Matthew Stewart,
54− Matvey Aksenov,
55− Nicholas Clarke,
56− Nicolas Rolland,
57− Oliver Charles,
58− Pascal Wittmann,
59− Patrick John Wheeler,
60− Phil de Joux,
61− Piotr Bogdan,
62− Profpatsch,
63− Raymond Gauthier,
64− Renzo Carbonara,
65− Rodney Lorrimar,
66− Sibi,
67− Sukant Hajra,
68− Tanner Doshier,
69− Vaibhav Sagar,
70− Viktar Basharymau,
71− danbst,
72− karsten gebbert,
73− laMudri,
74− Александр Цамутали
11+author: Peter Simons, Andres Loeh, Benno Fünfstück, Mateusz Kowalczyk,
12+ Michael Alan Dorman, Tom Smalley, Mathijs Kwik, Shea Levy, Dmitry
13+ Malikov, Eric Seidel, Jacob Mitchell, Graham Christensen,
14+ Hamish Mackenzie, Nikolay Amiantov, Aycan iRiCAN, Bryan
15+ Gardiner, Joe Hermaszewski, John Wiegley, Philipp Hausmann,
16+ Spencer Janssen, Tom Hunger, William Casarin, koral,
17+ ksaric, Adam Vogt, Alexey Shmalko, Corey O'Connor, Cray
18+ Elliott, David Johnson, Dmitry Bushev, Domen Kožar, Felix
19+ Kunzmann, Gabriel Ebner, Gergely Risko, Joachim Fasting,
20+ John Albietz, John Chee, Jussi Maki, Lisanna Dettwyler,
21+ Mark Laws, Mark Wotton, Matthew Pickering, Matthew Stewart,
22+ Matvey Aksenov, Nicholas Clarke, Nicolas Rolland, Oliver
23+ Charles, Pascal Wittmann, Patrick John Wheeler, Phil de
24+ Joux, Piotr Bogdan, Profpatsch, Raymond Gauthier, Renzo
25+ Carbonara, Rodney Lorrimar, Sibi, Sukant Hajra, Tanner
26+ Doshier, Vaibhav Sagar, Viktar Basharymau, danbst, karsten
27+ gebbert, laMudri, Александр Цамутали
7528maintainer: Peter Simons <simons@cryp.to>
7629stability: stable
77−tested-with: GHC == 8.4.4, GHC == 8.6.2
30+tested-with: GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.1
7831category: Distribution, Nix
7932homepage: https://github.com/nixos/cabal2nix#readme
8033bug-reports: https://github.com/nixos/cabal2nix/issues
@@ -107,15 +60,15 @@ library
10760 Distribution.Nixpkgs.Haskell.PackageSourceSpec
10861 other-modules: Paths_cabal2nix
10962 hs-source-dirs: src
110− build-depends: base < 5
111− , Cabal > 2.2
112− , aeson
63+ build-depends: base > 4.11
64+ , Cabal == 3.0.*
65+ , aeson > 1
11366 , ansi-wl-pprint
11467 , bytestring
115− , containers
68+ , containers >= 0.5.9
11669 , deepseq >= 1.4
11770 , directory
118− , distribution-nixpkgs >= 1.1.1
71+ , distribution-nixpkgs >= 1.3.1
11972 , filepath
12073 , hackage-db >= 2.0.1
12174 , hopenssl >= 2
@@ -131,7 +84,6 @@ library
13184 , transformers
13285 , yaml
13386 default-language: Haskell2010
134− default-extensions: MonadFailDesugaring
13587 other-extensions: MultiParamTypeClasses
13688 ScopedTypeVariables
13789 FlexibleInstances
@@ -149,7 +101,6 @@ executable cabal2nix
149101 hs-source-dirs: cabal2nix
150102 build-depends: base, cabal2nix
151103 default-language: Haskell2010
152− default-extensions: MonadFailDesugaring
153104 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
154105 -Wredundant-constraints
155106
@@ -159,13 +110,13 @@ executable hackage2nix
159110 Paths_cabal2nix
160111 hs-source-dirs: hackage2nix
161112 build-depends: base < 5
162− , Cabal > 2.2
113+ , Cabal
163114 , aeson
164115 , bytestring
165116 , cabal2nix
166117 , containers
167118 , directory
168− , distribution-nixpkgs >= 1.1.1
119+ , distribution-nixpkgs >= 1.2
169120 , filepath
170121 , hopenssl >= 2
171122 , language-nix
@@ -176,16 +127,15 @@ executable hackage2nix
176127 , optparse-applicative
177128 , pretty >= 1.1.2
178129 default-language: Haskell2010
179− default-extensions: MonadFailDesugaring
180130 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
181− -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
131+ -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-maxN16
182132
183133test-suite regression-test
184134 type: exitcode-stdio-1.0
185135 main-is: Main.hs
186136 hs-source-dirs: test
187137 build-depends: base
188− , Cabal > 2.2
138+ , Cabal
189139 , cabal2nix
190140 , containers
191141 , directory
@@ -197,8 +147,6 @@ test-suite regression-test
197147 , tasty
198148 , tasty-golden
199149 default-language: Haskell2010
200− default-extensions: MonadFailDesugaring
201150 build-tools: cabal2nix
202151 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
203− -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
204− -with-rtsopts=-K1K
152+ -Wredundant-constraints -threaded -with-rtsopts=-K64K
hackage2nix/Main.hs+24−18
@@ -1,6 +1,5 @@
11{-# LANGUAGE OverloadedStrings #-}
22{-# LANGUAGE RecordWildCards #-}
3−{-# LANGUAGE CPP #-}
43
54module Main ( main ) where
65
@@ -11,13 +10,10 @@ import Control.Monad
1110import Control.Monad.Par.Combinator
1211import Control.Monad.Par.IO
1312import Control.Monad.Trans ( liftIO )
14−import Data.List
13+import Data.List ( intercalate )
1514import Data.Map.Strict ( Map )
1615import qualified Data.Map.Strict as Map
1716import Data.Maybe
18−#if !MIN_VERSION_base(4,11,0)
19−import Data.Monoid
20−#endif
2117import Data.Set ( Set )
2218import qualified Data.Set as Set
2319import Data.String
@@ -27,10 +23,11 @@ import Distribution.Nixpkgs.Haskell.Constraint
2723import Distribution.Nixpkgs.Haskell.FromCabal
2824import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
2925import Distribution.Nixpkgs.Haskell.FromCabal.Flags
26+import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
3027import Distribution.Nixpkgs.Meta
3128import Distribution.Nixpkgs.PackageMap
3229import Distribution.Package
33−import Distribution.PackageDescription hiding ( options, buildDepends, extraLibs, buildTools, homepage )
30+import Distribution.PackageDescription hiding ( options, extraLibs, buildTools, homepage )
3431import Distribution.System
3532import Distribution.Text
3633import Distribution.Version
@@ -66,7 +63,7 @@ main = do
6663 pinfo :: ParserInfo CLI
6764 pinfo = info
6865 ( helper
69− <*> infoOption ("hackage2nix " ++ display Main.version) (long "version" <> help "Show version number")
66+ <*> infoOption ("hackage2nix " ++ prettyShow Main.version) (long "version" <> help "Show version number")
7067 <*> cliOptions
7168 )
7269 ( fullDesc
@@ -75,13 +72,15 @@ main = do
7572 CLI {..} <- execParser pinfo
7673
7774 config <- readConfiguration (nixpkgsRepository </> configFile)
78− nixpkgs <- readNixpkgPackageMap nixpkgsRepository Nothing
75+ nixpkgs <- readNixpkgPackageMap ["-f", nixpkgsRepository, "--arg", "config", "{ allowAliases = false; }"]
7976 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
8077 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
8178 . Map.delete "som" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
8279 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
8380 . Map.delete "control-invariants" -- TODO: depends on "assert"
84− . over (at ("hermes")) ((fmap (set (contains "1.3.4.3") False))) -- TODO: https://github.com/haskell/hackage-server/issues/436
81+ . Map.delete "with" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
82+ . Map.delete "telega" -- TODO: depends on "with"
83+ . over (at "hermes") (fmap (set (contains "1.3.4.3") False)) -- TODO: https://github.com/haskell/hackage-server/issues/436
8584 hackage <- fixup <$> readHackage hackageRepository
8685 let
8786 hackagePackagesFile :: FilePath
@@ -94,7 +93,7 @@ main = do
9493 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
9594
9695 defaultPackageOverridesSet :: PackageSet
97− defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _) <- defaultPackageOverrides config ]
96+ defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _ _) <- defaultPackageOverrides config ]
9897
9998 generatedDefaultPackageSet :: PackageSet
10099 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
@@ -107,7 +106,7 @@ main = do
107106
108107 extraPackageSet :: PackageMultiSet
109108 extraPackageSet = Map.unionsWith Set.union
110− [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _) <- extraPackages config ]
109+ [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _ _) <- extraPackages config ]
111110
112111 db :: PackageMultiSet
113112 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
@@ -117,7 +116,7 @@ main = do
117116 ]
118117
119118 haskellResolver :: Dependency -> Bool
120− haskellResolver (Dependency name vrange)
119+ haskellResolver (Dependency name vrange _)
121120 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
122121 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
123122 | otherwise = False
@@ -136,8 +135,13 @@ main = do
136135 (descr, cabalSHA256) <- readPackage hackageRepository pkgId
137136 meta <- readPackageMeta hackageRepository pkgId
138137
139− let isInDefaultPackageSet :: Bool
140− isInDefaultPackageSet = maybe False (== v) (Map.lookup name generatedDefaultPackageSet)
138+ let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool
139+ isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)
140+ isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)
141+ isBroken = any (withinRange v) [ vr | Dependency pn vr _ <- brokenPackages config, pn == name ]
142+
143+ droppedPlatforms :: Set Platform
144+ droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)
141145
142146 tarballSHA256 :: SHA256Hash
143147 tarballSHA256 = fromMaybe (error (display pkgId ++ ": meta data has no hash for the tarball"))
@@ -153,13 +157,15 @@ main = do
153157 drv = fromGenericPackageDescription haskellResolver nixpkgsResolver targetPlatform (compilerInfo config) flagAssignment [] descr
154158 & src .~ urlDerivationSource ("mirror://hackage/" ++ display pkgId ++ ".tar.gz") tarballSHA256
155159 & editedCabalFile .~ cabalSHA256
156− & metaSection.hydraPlatforms %~ (`Set.difference` Map.findWithDefault Set.empty name (dontDistributePackages config))
160+ & metaSection.platforms %~ (`Set.difference` Map.findWithDefault Set.empty name (unsupportedPlatforms config))
161+ & metaSection.hydraPlatforms %~ (if Set.null droppedPlatforms then id else (`Set.difference` droppedPlatforms))
162+ & metaSection.hydraPlatforms %~ (if isHydraEnabled then id else const Set.empty)
163+ & metaSection.broken ||~ isBroken
157164 & metaSection.maintainers .~ Map.findWithDefault Set.empty name globalPackageMaintainers
158− & metaSection.hydraPlatforms %~ (if isInDefaultPackageSet then id else const Set.empty)
159165 & metaSection.homepage .~ ""
160166
161167 overrides :: Doc
162− overrides = fcat $ punctuate space [ disp b <> semi | b <- Set.toList ((view (dependencies . each) drv) `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]
168+ overrides = fcat $ punctuate space [ pPrint b <> semi | b <- Set.toList (view (dependencies . each) drv `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]
163169 return $ render $ nest 2 $
164170 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
165171
@@ -199,7 +205,7 @@ resolveConstraint c = fromMaybe (error msg) . resolveConstraint' c
199205 ]
200206
201207resolveConstraint' :: Constraint -> Hackage -> Maybe Version
202−resolveConstraint' (Dependency name vrange) hackage
208+resolveConstraint' (Dependency name vrange _) hackage
203209 | Just vset' <- Map.lookup name hackage
204210 , vset <- Set.filter (`withinRange` vrange) vset'
205211 , not (Set.null vset) = Just (Set.findMax vset)
hackage2nix/README.md+3
@@ -15,6 +15,9 @@ and we want to check that hackage-packages.nix will be updated correctly.
1515On macOS you can use [this](https://gist.github.com/dixson3/8360571) to create one
1616(you can replace 60g with 4g as that should be plenty).
1717
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+
1821#### Setup
1922Replace `git@github.com:NixOS/nixpkgs.git` with a fork you have access to.
2023```
src/Cabal2nix.hs+23−15
@@ -11,14 +11,12 @@ 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
21−import qualified Distribution.Compat.ReadP as P
2220import Distribution.Compiler
2321import Distribution.Nixpkgs.Fetch
2422import Distribution.Nixpkgs.Haskell
@@ -26,13 +24,14 @@ import Distribution.Nixpkgs.Haskell.FromCabal
2624import Distribution.Nixpkgs.Haskell.FromCabal.Flags
2725import qualified Distribution.Nixpkgs.Haskell.FromCabal.PostProcess as PP (pkg)
2826import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
27+import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
2928import Distribution.Nixpkgs.Haskell.PackageSourceSpec
3029import Distribution.Nixpkgs.Meta
31−import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )
3230import Distribution.Package ( packageId )
31+import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )
32+import Distribution.Parsec as P
3333import Distribution.Simple.Utils ( lowercase )
3434import Distribution.System
35−import Distribution.Text
3635import Language.Nix
3736import Options.Applicative
3837import Paths_cabal2nix ( version )
@@ -46,9 +45,10 @@ data Options = Options
4645 , optMaintainer :: [String]
4746--, optPlatform :: [String] -- TODO: fix command line handling of platforms
4847 , optHaddock :: Bool
49− , optHpack :: Bool
48+ , optHpack :: HpackUse
5049 , optDoCheck :: Bool
5150 , optJailbreak :: Bool
51+ , optDoBenchmark :: Bool
5252 , optRevision :: Maybe String
5353 , optHyperlinkSource :: Bool
5454 , optEnableLibraryProfiling :: Bool
@@ -73,9 +73,17 @@ options = Options
7373 <*> many (strOption $ long "maintainer" <> metavar "MAINTAINER" <> help "maintainer of this package (may be specified multiple times)")
7474-- <*> many (strOption $ long "platform" <> metavar "PLATFORM" <> help "supported build platforms (may be specified multiple times)")
7575 <*> flag True False (long "no-haddock" <> help "don't run Haddock when building this package")
76− <*> switch (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
76+ <*>
77+ (
78+ flag' ForceHpack (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
79+ <|>
80+ flag' NoHpack (long "no-hpack" <> help "disable hpack run and use only cabal disregarding package.yaml existence")
81+ <|>
82+ pure PackageYamlHpack
83+ )
7784 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
7885 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
86+ <*> switch (long "benchmark" <> help "enable benchmarks for this package")
7987 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
8088 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
8189 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
@@ -85,8 +93,8 @@ options = Options
8593 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
8694 <*> switch (long "shell" <> help "generate output suitable for nix-shell")
8795 <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")
88− <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)
89− <*> 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)
96+ <*> option parseCabal (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith prettyShow)
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)
9098 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
9199 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
92100 <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
@@ -101,10 +109,8 @@ utcTimeReader = eitherReader $ \arg ->
101109 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
102110 Just utcTime -> Right utcTime
103111
104−readP :: P.ReadP a a -> ReadM a
105−readP p = eitherReader $ \s -> case [ r' | (r',"") <- P.readP_to_S p s ] of
106− (r:_) -> Right r
107− _ -> Left ("invalid value " ++ show s)
112+parseCabal :: Parsec a => ReadM a
113+parseCabal = eitherReader eitherParsec
108114
109115-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
110116-- since the output of that is what Cabal parses.
@@ -129,6 +135,7 @@ ghcConvertOS os = case os of
129135 "watchos" -> "ios"
130136 "tvos" -> "ios"
131137 "linux-android" -> "linux-android"
138+ "linux-androideabi" -> "linux-androideabi"
132139 _ | "linux-" `isPrefixOf` os -> "linux"
133140 _ -> fromMaybe os $ listToMaybe
134141 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
@@ -155,7 +162,7 @@ parsePlatformParts = \case
155162pinfo :: ParserInfo Options
156163pinfo = info
157164 ( helper
158− <*> infoOption ("cabal2nix " ++ display version) (long "version" <> help "Show version number")
165+ <*> infoOption ("cabal2nix " ++ prettyShow version) (long "version" <> help "Show version number")
159166 <*> options
160167 )
161168 ( fullDesc
@@ -184,7 +191,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() ->
184191 cabal2nix =<< getArgs
185192
186193hpackOverrides :: Derivation -> Derivation
187−hpackOverrides = over phaseOverrides (++ "preConfigure = \"hpack\";")
194+hpackOverrides = over phaseOverrides (++ "prePatch = \"hpack\";")
188195 . set (libraryDepends . tool . contains (PP.pkg "hpack")) True
189196
190197cabal2nix' :: Options -> IO (Either Doc Derivation)
@@ -228,6 +235,7 @@ processPackage Options{..} pkg = do
228235 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
229236-- & metaSection.platforms .~ Set.fromList optPlatform
230237 & doCheck &&~ optDoCheck
238+ & doBenchmark ||~ optDoBenchmark
231239 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
232240
233241 shell :: Doc
src/Distribution/Nixpkgs/Fetch.hs+3−1
@@ -161,7 +161,9 @@ fetchWith (supportsRev, kind, addArgs) source = do
161161 ExitFailure _ -> return Nothing
162162 ExitSuccess -> do
163163 buf <- BS.hGetContents stdoutH
164− let (l:ls) = reverse (BS.lines buf)
164+ let (l,ls) = case reverse (BS.lines buf) of
165+ [] -> error "This can't happen, but GHC doesn't know that."
166+ (x:xs) -> (x,xs)
165167 buf' = BS.unlines (reverse ls)
166168 case length ls of
167169 0 -> return Nothing
src/Distribution/Nixpkgs/Haskell/Constraint.hs+1−1
@@ -9,7 +9,7 @@ import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
99type Constraint = Dependency
1010
1111satisfiesConstraint :: 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)
1313
1414satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool
1515satisfiesConstraints p = all (satisfiesConstraint p)
src/Distribution/Nixpkgs/Haskell/Derivation.hs+7−4
@@ -7,7 +7,7 @@
77module Distribution.Nixpkgs.Haskell.Derivation
88 ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
99 , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
10− , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
10+ , cabalFlags, runHaddock, jailbreak, doCheck, doBenchmark, testTarget, hyperlinkSource, enableSplitObjs
1111 , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
1212 , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
1313 )
@@ -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
@@ -55,6 +55,7 @@ data Derivation = MkDerivation
5555 , _runHaddock :: Bool
5656 , _jailbreak :: Bool
5757 , _doCheck :: Bool
58+ , _doBenchmark :: Bool
5859 , _testTarget :: String
5960 , _hyperlinkSource :: Bool
6061 , _enableLibraryProfiling :: Bool
@@ -86,6 +87,7 @@ nullDerivation = MkDerivation
8687 , _runHaddock = error "undefined Derivation.runHaddock"
8788 , _jailbreak = error "undefined Derivation.jailbreak"
8889 , _doCheck = error "undefined Derivation.doCheck"
90+ , _doBenchmark = error "undefined Derivation.doBenchmark"
8991 , _testTarget = error "undefined Derivation.testTarget"
9092 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
9193 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
@@ -110,8 +112,8 @@ instance Pretty Derivation where
110112 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
111113 [ text "mkDerivation" <+> lbrace
112114 , nest 2 $ vcat
113− [ attr "pname" $ doubleQuotes $ disp (packageName _pkgid)
114− , attr "version" $ doubleQuotes $ disp (packageVersion _pkgid)
115+ [ attr "pname" $ doubleQuotes $ pPrint (packageName _pkgid)
116+ , attr "version" $ doubleQuotes $ pPrint (packageVersion _pkgid)
115117 , pPrint _src
116118 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
117119 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
@@ -131,6 +133,7 @@ instance Pretty Derivation where
131133 , boolattr "doHaddock" (not _runHaddock) _runHaddock
132134 , boolattr "jailbreak" _jailbreak _jailbreak
133135 , boolattr "doCheck" (not _doCheck) _doCheck
136+ , boolattr "doBenchmark" _doBenchmark _doBenchmark
134137 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
135138 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
136139 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
src/Distribution/Nixpkgs/Haskell/FromCabal.hs+13−12
@@ -58,14 +58,14 @@ finalizeGenericPackageDescription haskellResolver arch compiler flags constraint
5858 }
5959
6060 jailbroken :: HaskellResolver -> HaskellResolver
61− jailbroken resolver (Dependency pkg _) = resolver (Dependency pkg anyVersion)
61+ jailbroken resolver (Dependency pkg _ _) = resolver (Dependency pkg anyVersion mempty)
6262
6363 withInternalLibs :: HaskellResolver -> HaskellResolver
6464 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
6565
6666 internalNames :: [PackageName]
6767 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
68− ++ [ unqualComponentNameToPackageName n | Just n <- libName <$> subLibraries (packageDescription genDesc) ]
68+ ++ [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries (packageDescription genDesc) ]
6969
7070 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
7171 Left m -> case finalize (const True) of
@@ -91,6 +91,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
9191 & runHaddock .~ doHaddockPhase
9292 & jailbreak .~ False
9393 & doCheck .~ True
94+ & doBenchmark .~ False
9495 & testTarget .~ mempty
9596 & hyperlinkSource .~ True
9697 & enableSplitObjs .~ True
@@ -107,7 +108,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
107108 & Nix.description .~ synopsis
108109 & Nix.license .~ nixLicense
109110 & Nix.platforms .~ Nix.allKnownPlatforms
110− & Nix.hydraPlatforms .~ (if nixLicense == Nix.Known "stdenv.lib.licenses.unfree" then Set.empty else Nix.allKnownPlatforms)
111+ & Nix.hydraPlatforms .~ (if isFreeLicense nixLicense then Nix.allKnownPlatforms else Set.empty)
111112 & Nix.maintainers .~ mempty
112113 & Nix.broken .~ not (null missingDeps)
113114 )
@@ -118,7 +119,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
118119 nixLicense = either fromSPDXLicense fromCabalLicense licenseRaw
119120
120121 resolveInHackage :: Identifier -> Binding
121− 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
122123 | otherwise = binding # (i, path # ["self",i]) -- TODO: "self" shouldn't be hardcoded.
123124
124125 -- TODO: This is all very confusing. Haskell packages refer to the Nixpkgs
@@ -135,19 +136,19 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
135136 resolveInNixpkgs :: Identifier -> Binding
136137 resolveInNixpkgs i
137138 | i `elem` ["clang","lldb","llvm"] = binding # (i, path # ["self","llvmPackages",i]) -- TODO: evil!
138− | i == "gtk2" = binding # (i, path # ["pkgs","gnome2","gtk"])
139− | i == "gtk3" = binding # (i, path # ["pkgs","gnome3","gtk"])
140− | i == "gtksourceview3" = binding # (i, path # ["pkgs","gnome3","gtksourceview"])
141− | i == "vte_291" = binding # (i, path # ["pkgs","gnome3","vte"])
139+ | i == "gtk2" = binding # (i, path # ["pkgs","gtk2"]) -- TODO: these cases should not be necessary
140+ | i == "gtk3" = binding # (i, path # ["pkgs","gtk3"])
141+ | i == "gtksourceview3" = binding # (i, path # ["pkgs","gtksourceview3"])
142+ | i == "vte_291" = binding # (i, path # ["pkgs","vte"])
142143 | Just p <- nixpkgsResolver i, init (view (reference . path) p) `Set.member` goodScopes = p
143144 | otherwise = bindNull i
144145
145146 resolveInHackageThenNixpkgs :: Identifier -> Binding
146− resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion) = resolveInHackage i
147+ resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion mempty) = resolveInHackage i
147148 | otherwise = resolveInNixpkgs i
148149
149150 internalLibNames :: [PackageName]
150− internalLibNames = fmap unqualComponentNameToPackageName . catMaybes $ libName <$> subLibraries
151+ internalLibNames = [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries ]
151152
152153 doHaddockPhase :: Bool
153154 doHaddockPhase | not (null internalLibNames) = False
@@ -157,7 +158,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
157158 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
158159 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
159160 convertBuildInfo Cabal.BuildInfo {..} = mempty
160− & 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 ]
161162 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
162163 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
163164 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
@@ -165,7 +166,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
165166
166167 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
167168 convertSetupBuildInfo bi = mempty
168− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- Cabal.setupDepends bi ]
169+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- Cabal.setupDepends bi ]
169170
170171bindNull :: Identifier -> Binding
171172bindNull i = binding # (i, path # ["null"])
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+28−32
@@ -1,16 +1,21 @@
11{-# LANGUAGE RecordWildCards #-}
2−{-# LANGUAGE CPP #-}
32{-# LANGUAGE FlexibleInstances #-}
43{-# LANGUAGE OverloadedStrings #-}
54{-# LANGUAGE DeriveGeneric #-}
65{-# OPTIONS_GHC -fno-warn-orphans #-}
76
8−module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
7+module Distribution.Nixpkgs.Haskell.FromCabal.Configuration
8+ ( Configuration(..), readConfiguration, assertConsistency
9+ )
10+ where
11+
12+import Prelude hiding ( fail )
913
10−import Control.Exception ( throwIO )
1114import Control.DeepSeq
15+import Control.Exception ( throwIO )
1216import Control.Lens
13−import Control.Monad
17+import Control.Monad hiding ( fail )
18+import Control.Monad.Fail
1419import Data.Aeson
1520import Data.Map as Map
1621import Data.Set as Set
@@ -40,14 +45,22 @@ data Configuration = Configuration
4045 -- role during dependency resolution.
4146 , extraPackages :: [Constraint]
4247
43− -- |We know that these packages won't build, so we give them an empty
44− -- meta.hydraPlatforms attribute to avoid cluttering our Hydra output with
45− -- lots of failure messages.
46− , dontDistributePackages :: Map PackageName (Set Platform)
47−
4848 -- |This information is used by the @hackage2nix@ utility to determine the
4949 -- 'maintainers' for a given Haskell package.
5050 , packageMaintainers :: Map Identifier (Set PackageName)
51+
52+ -- |These packages (by design) don't support certain platforms.
53+ , unsupportedPlatforms :: Map PackageName (Set Platform)
54+
55+ -- |These packages cannot be distributed by Hydra, i.e. because they have an
56+ -- unfree license or depend on other tools that cannot be distributed for
57+ -- some reason.
58+ , dontDistributePackages :: Set PackageName
59+
60+ -- |We know that these packages won't compile, so we mark them as broken and
61+ -- also disable their meta.hydraPlatforms attribute to avoid cluttering our
62+ -- Hydra job with lots of failure messages.
63+ , brokenPackages :: [Constraint]
5164 }
5265 deriving (Show, Generic)
5366
@@ -59,50 +72,33 @@ instance FromJSON Configuration where
5972 <*> o .:? "core-packages" .!= mempty
6073 <*> o .:? "default-package-overrides" .!= mempty
6174 <*> o .:? "extra-packages" .!= mempty
62− <*> o .:? "dont-distribute-packages" .!= mempty
6375 <*> o .:? "package-maintainers" .!= mempty
76+ <*> o .:? "unsupported-platforms" .!= mempty
77+ <*> o .:? "dont-distribute-packages" .!= mempty
78+ <*> o .:? "broken-packages" .!= mempty
6479 parseJSON _ = error "invalid Configuration"
6580
6681instance FromJSON Identifier where
6782 parseJSON (String s) = pure (review ident (T.unpack s))
6883 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Nix identifier")
6984
70−#if MIN_VERSION_aeson(1,0,0)
71−
7285instance FromJSONKey Identifier where
7386 fromJSONKey = FromJSONKeyText parseKey
7487
7588instance FromJSONKey PackageName where
7689 fromJSONKey = FromJSONKeyText parseKey
7790
78−#elif MIN_VERSION_aeson(0,11,0)
79−
80−instance (FromJSON v) => FromJSON (Map Identifier v) where
81− parseJSON = fmap (Map.mapKeys parseKey) . parseJSON
82−
83−instance (FromJSON v) => FromJSON (Map PackageName v) where
84− parseJSON = fmap (Map.mapKeys parseKey) . parseJSON
85−
86−#else
87−
88−instance (Ord k, FromJSON k, FromJSON v) => FromJSON (Map k v) where
89− parseJSON = fmap (Map.mapKeys parseKey) . parseJSON
90−
91−#endif
92−
9391parseKey :: FromJSON k => Text -> k
9492parseKey s = either error id (parseEither parseJSON (String s))
9593
9694readConfiguration :: FilePath -> IO Configuration
97−readConfiguration path =
98− decodeFileEither path >>= either throwIO assertConsistency
95+readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency
9996
100−assertConsistency :: Monad m => Configuration -> m Configuration
97+assertConsistency :: MonadFail m => Configuration -> m Configuration
10198assertConsistency cfg@Configuration {..} = do
10299 let report msg = fail ("*** configuration error: " ++ msg)
103−
104100 maintainedPackages = Set.unions (Map.elems packageMaintainers)
105− disabledPackages = Map.keysSet dontDistributePackages
101+ disabledPackages = dontDistributePackages `Set.union` Set.fromList (depPkgName <$> brokenPackages)
106102 disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages
107103 unless (Set.null disabledMaintainedPackages) $
108104 report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+14−15
@@ -4,6 +4,7 @@ module Distribution.Nixpkgs.Haskell.FromCabal.Flags ( configureCabalFlags ) wher
44
55import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
66
7+import Data.Char
78import Distribution.Package
89import Distribution.PackageDescription
910import Distribution.Version
@@ -15,6 +16,7 @@ configureCabalFlags' :: PackageIdentifier -> [(FlagName,Bool)]
1516configureCabalFlags' (PackageIdentifier name version)
1617 | name == "accelerate-examples"= [disable "opencl"]
1718 | name == "arithmoi" = [disable "llvm"]
19+ | name == "bustle" = [disable "hgettext"] -- https://gitlab.freedesktop.org/bustle/bustle/issues/13
1820 | name == "cabal-plan" = [enable "exe"]
1921 | name == "cassava" = [disable "bytestring--lt-0_10_4"]
2022 | name == "darcs" = [enable "library", enable "force-char8-encoding"]
@@ -22,24 +24,17 @@ configureCabalFlags' (PackageIdentifier name version)
2224 | name == "fltkhs" = [enable "opengl"]
2325 | name == "folds" = [disable "test-hlint"]
2426 | name == "git-annex" = [ enable "assistant"
25− , enable "cryptonite"
27+ , disable "benchmark"
2628 , enable "dbus"
27− , enable "desktopnotify"
28− , enable "dns"
29− , enable "feed"
30− , enable "inotify"
29+ , disable "debuglocks"
30+ , enable "magicmime"
31+ , enable "networkbsd"
3132 , enable "pairing"
3233 , enable "production"
33− , enable "quvi"
34− , disable "s3"
35− , enable "tahoe"
36− , enable "tdfa"
37− , ("testsuite", version `withinRange` "< 6.20170925 || >= 6.20171214")
34+ , enable "s3"
3835 , enable "torrentparser"
39− , disable "webapp"
40− , disable "webapp-secure"
36+ , enable "webapp"
4137 , enable "webdav"
42− , enable "xmpp"
4338 ]
4439 | name == "haskeline" = [enable "terminfo"]
4540 | name == "haste-compiler" = [enable "portable"]
@@ -52,6 +47,7 @@ configureCabalFlags' (PackageIdentifier name version)
5247 | name == "io-streams" = [enable "NoInteractiveTests"]
5348 | name == "liquid-fixpoint" = [enable "build-external"]
5449 | name == "pandoc" = [enable "https", disable "trypandoc"]
50+ | name == "pandoc-placetable" = [enable "inlineMarkdown"]
5551 | name == "persistent-sqlite" = [enable "systemlib"]
5652 | name == "reactive-banana-wx" = [disable "buildExamples"]
5753 | name == "snap-server" = [enable "openssl"]
@@ -63,7 +59,10 @@ configureCabalFlags' (PackageIdentifier name version)
6359 | otherwise = []
6460
6561enable :: String -> (FlagName,Bool)
66−enable name = (mkFlagName name, True)
62+enable name = (mkFlagName' name, True)
6763
6864disable :: String -> (FlagName,Bool)
69−disable name = (mkFlagName name, False)
65+disable name = (mkFlagName' name, False)
66+
67+mkFlagName' :: String -> FlagName
68+mkFlagName' = mkFlagName . map toLower
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+6
@@ -3,6 +3,7 @@
33module Distribution.Nixpkgs.Haskell.FromCabal.License
44 ( fromCabalLicense
55 , fromSPDXLicense
6+ , isFreeLicense
67 ) where
78
89import Data.List (intercalate)
@@ -162,3 +163,8 @@ fromSPDXLicense (SPDX.License expr) =
162163 -- Not handled: compound expressions, not expressible in Nixpkgs.
163164 -- Use the SPDX expression as a free-form license string.
164165 Unknown (Just $ prettyShow expr)
166+
167+isFreeLicense :: Distribution.Nixpkgs.License.License -> Bool
168+isFreeLicense (Known "stdenv.lib.licenses.unfree") = False
169+isFreeLicense (Unknown Nothing) = False
170+isFreeLicense _ = True
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs+16−8
@@ -29,6 +29,7 @@ libNixName "appindicator-0.1" = return "libappindicator-gtk2"
2929libNixName "appindicator3-0.1" = return "libappindicator-gtk3"
3030libNixName "asound" = return "alsaLib"
3131libNixName "b2" = return "libb2"
32+libNixName "boost_context" = return "boost"
3233libNixName "bz2" = return "bzip2"
3334libNixName "c++" = [] -- What is that?
3435libNixName "cairo-gobject" = return "cairo"
@@ -47,7 +48,7 @@ libNixName "gconf" = return "GConf"
4748libNixName "gconf-2.0" = return "GConf"
4849libNixName "gdk-2.0" = return "gtk2"
4950libNixName "gdk-3.0" = return "gtk3"
50−libNixName "gdk-pixbuf-2.0" = return "gdk_pixbuf"
51+libNixName "gdk-pixbuf-2.0" = return "gdk-pixbuf"
5152libNixName "gdk-x11-2.0" = return "gdk_x11"
5253libNixName "gdk-x11-3.0" = return "gtk3"
5354libNixName "gio-2.0" = return "glib"
@@ -55,11 +56,11 @@ libNixName "GL" = return "libGL"
5556libNixName "GLU" = ["libGLU","libGL"]
5657libNixName "glut" = ["freeglut","libGLU","libGL"]
5758libNixName "gnome-keyring" = return "gnome-keyring"
58−libNixName "gnome-keyring-1" = return "libgnome_keyring"
59+libNixName "gnome-keyring-1" = return "libgnome-keyring"
5960libNixName "gnome-vfs-2.0" = return "gnome-vfs"
6061libNixName "gnome-vfs-module-2.0" = return "gnome-vfs_module"
6162libNixName "gobject-2.0" = return "glib"
62−libNixName "gobject-introspection-1.0" = return "gobjectIntrospection"
63+libNixName "gobject-introspection-1.0" = return "gobject-introspection"
6364libNixName "gstreamer-audio-0.10" = return "gst-plugins-base"
6465libNixName "gstreamer-audio-1.0" = return "gst-plugins-base"
6566libNixName "gstreamer-base-0.10" = return "gst-plugins-base"
@@ -84,8 +85,8 @@ libNixName "ImageMagick" = return "imagemagick"
8485libNixName "Imlib2" = return "imlib2"
8586libNixName "iw" = return "wirelesstools"
8687libNixName "jack" = return "libjack2"
87−libNixName "javascriptcoregtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that.
88−libNixName "javascriptcoregtk-4.0" = return "webkitgtk" -- This is the current API, so let it reference an alias for the latest version.
88+libNixName "javascriptcoregtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that.
89+libNixName "javascriptcoregtk-4.0" = return "webkitgtk"
8990libNixName "jpeg" = return "libjpeg"
9091libNixName "jvm" = return "jdk"
9192libNixName "lapack" = return "liblapack"
@@ -94,6 +95,9 @@ libNixName "ldap" = return "openldap"
9495libNixName "libavutil" = return "ffmpeg"
9596libNixName "libgsasl" = return "gsasl"
9697libNixName "libpcre" = return "pcre"
98+libNixName "libpcre2" = return "pcre2"
99+libNixName "libpcre2-8" = libNixName "libpcre2"
100+libNixName "libqrencode" = return "qrencode"
97101libNixName "libR" = return "R"
98102libNixName "libsoup-gnome-2.4" = return "libsoup"
99103libNixName "libsystemd" = return "systemd"
@@ -104,9 +108,13 @@ libNixName "libzmq" = return "zeromq"
104108libNixName "m" = [] -- in stdenv
105109libNixName "magic" = return "file"
106110libNixName "MagickWand" = return "imagemagick"
111+libNixName "mnl" = return "libmnl"
107112libNixName "mpi" = return "openmpi"
108113libNixName "ncursesw" = return "ncurses"
109114libNixName "netsnmp" = return "net_snmp"
115+libNixName "nix-expr" = return "nix"
116+libNixName "nix-main" = return "nix"
117+libNixName "nix-store" = return "nix"
110118libNixName "notify" = return "libnotify"
111119libNixName "odbc" = return "unixODBC"
112120libNixName "openblas" = return "openblasCompat"
@@ -153,8 +161,9 @@ libNixName "wayland-client" = return "wayland"
153161libNixName "wayland-cursor" = return "wayland"
154162libNixName "wayland-egl" = return "libGL"
155163libNixName "wayland-server" = return "wayland"
156−libNixName "webkit2gtk-4.0" = return "webkitgtk" -- This is the current API, so let it reference an alias for the latest version.
157−libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk-web-extension" -- This package doesn't actually exist in nixpkgs at present.
164+libNixName "webkit2gtk" = return "webkitgtk"
165+libNixName "webkit2gtk-4.0" = return "webkitgtk"
166+libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk"
158167libNixName "webkitgtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that
159168libNixName "X11" = return "libX11"
160169libNixName "x11" = return "xlibsWrapper"
@@ -194,7 +203,6 @@ buildToolNixName "nix-env" = return "nix"
194203buildToolNixName "nix-hash" = return "nix"
195204buildToolNixName "nix-instantiate" = return "nix"
196205buildToolNixName "nix-store" = return "nix"
197−buildToolNixName "pkg-config" = return "pkgconfig"
198206buildToolNixName x = return (fromString x)
199207
200208-- | Helper function to extract the package name from a String that may or may
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+39−13
@@ -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
@@ -21,7 +22,7 @@ import Language.Nix
2122
2223postProcess :: Derivation -> Derivation
2324postProcess deriv =
24− foldr (.) id [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
25+ foldr (.) id [ f | (Dependency n vr _, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
2526 . fixGtkBuilds
2627 . fixBuildDependsForTools
2728 $ deriv
@@ -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
@@ -89,7 +90,7 @@ hooks =
8990 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
9091 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
9192 , ("freenect < 1.2.1", over configureFlags (Set.union (Set.fromList ["--extra-include-dirs=${pkgs.freenect}/include/libfreenect", "--extra-lib-dirs=${pkgs.freenect}/lib"])))
92− , ("fltkhs", set (libraryDepends . system . contains (pkg "fltk14")) True . set (libraryDepends . pkgconfig . contains (pkg "libGLU_combined")) True) -- TODO: fltk14 belongs into the *setup* dependencies.
93+ , ("fltkhs", set (libraryDepends . system . contains (pkg "fltk14")) True . over (libraryDepends . pkgconfig) (Set.union (pkgs ["libGLU", "libGL"]))) -- TODO: fltk14 belongs into the *setup* dependencies.
9394 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
9495 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
9596 , ("gi-gdk", set runHaddock True )
@@ -147,9 +148,10 @@ hooks =
147148 , ("network-attoparsec", set doCheck False) -- test suite requires network access
148149 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
149150 , ("opencv", opencvOverrides)
150− , ("pandoc >= 1.16.0.2", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
151− , ("pandoc", set jailbreak False) -- jailbreak-cabal break the build
152− , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/172
151+ , ("pandoc >= 1.16.0.2 && < 2.5", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
152+ , ("pandoc < 2.6", pandocPre26Overrides)
153+ , ("pandoc >= 2.6", pandocOverrides)
154+ , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/369
153155 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
154156 , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
155157 , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
@@ -182,6 +184,7 @@ hooks =
182184 , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
183185 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
184186 , ("zip-archive >= 0.3.1 && < 0.3.2.3", over (testDepends . tool) (Set.union (Set.fromList [pkg "zip", pkg "unzip"]))) -- https://github.com/jgm/zip-archive/issues/35
187+ , ("zip-archive >= 0.4", set (testDepends . tool . contains (pkg "which")) True)
185188 ]
186189
187190pkg :: Identifier -> Binding
@@ -227,13 +230,12 @@ gitAnnexHook = set phaseOverrides gitAnnexOverrides
227230 where
228231 gitAnnexOverrides = unlines
229232 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
230− , "installPhase = \"make PREFIX=$out BUILDER=: install\";"
231− , "checkPhase = ''"
233+ , "postBuild = ''"
232234 , " ln -sf dist/build/git-annex/git-annex git-annex"
233235 , " ln -sf git-annex git-annex-shell"
234− , " export PATH+=\":$PWD\""
235− , " git-annex test"
236236 , "'';"
237+ , "installPhase = \"make PREFIX=$out BUILDER=: install install-completions\";"
238+ , "checkPhase = ''PATH+=\":$PWD\" git-annex test'';"
237239 , "enableSharedExecutables = false;"
238240 ]
239241 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
@@ -254,7 +256,7 @@ gfPhaseOverrides = unlines
254256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
255257 -- Parallel compilation fails. Disable it.
256258 , "'';"
257− , "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'';"
258260 -- The build step itself, after having built the library, needs to be able
259261 -- to find the library it just built in order to compile grammar files.
260262 ]
@@ -290,8 +292,8 @@ darcsInstallPostInstall = unlines
290292xmonadPostInstall :: String
291293xmonadPostInstall = unlines
292294 [ "postInstall = ''"
293− , " install -D man/xmonad.1 $doc/share/man/man1/xmonad.1"
294− , " install -D man/xmonad.hs $doc/share/doc/$name/sample-xmonad.hs"
295+ , " install -D man/xmonad.1 ''${!outputDoc}/share/man/man1/xmonad.1"
296+ , " install -D man/xmonad.hs ''${!outputDoc}/share/doc/$name/sample-xmonad.hs"
295297 , "'';"
296298 ]
297299
@@ -381,3 +383,27 @@ gtkglextHook = over (libraryDepends . system) (Set.union (Set.fromList deps))
381383 , "pkgs.xorg.libXt"
382384 , "pkgs.xorg.libXmu"
383385 ]
386+
387+pandocPre26Overrides :: Derivation -> Derivation
388+pandocPre26Overrides = set phaseOverrides postInstall
389+ where
390+ postInstall = unlines [ "postInstall = ''"
391+ , " mkdir -p $out/share"
392+ , " mv $data/*/*/man $out/share/"
393+ , "'';"
394+ ]
395+
396+pandocOverrides :: Derivation -> Derivation
397+pandocOverrides = set phaseOverrides postInstall
398+ where
399+ postInstall = unlines [ "postInstall = ''"
400+ , " mkdir -p $out/share/man/man1"
401+ , " mv \"man/\"*.1 $out/share/man/man1/"
402+ , "'';"
403+ ]
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+28−3
@@ -9,9 +9,12 @@ import qualified Data.Text as T
99import Data.Yaml
1010import Distribution.Compiler
1111import Distribution.Package
12+import Distribution.Parsec
1213import Distribution.System
13−import Distribution.Text
14+import Distribution.Pretty as Cabal
15+import qualified Data.Version as Base
1416import Distribution.Version
17+import Language.Nix.PrettyPrinting as Nix
1518
1619instance NFData CompilerInfo
1720instance NFData AbiTag
@@ -49,6 +52,10 @@ instance FromJSON PackageIdentifier where
4952 parseJSON (String s) = return (fromString (T.unpack s))
5053 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell package identifier")
5154
55+instance FromJSON VersionRange where
56+ parseJSON (String s) = return (fromString (T.unpack s))
57+ parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Cabal VersionRange")
58+
5259instance FromJSON Dependency where
5360 parseJSON (String s) = return (fromString (T.unpack s))
5461 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")
@@ -57,7 +64,25 @@ instance FromJSON CompilerInfo where
5764 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
5865 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
5966
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+
6085-- parsing tools
6186
62−text2isString :: Text a => String -> String -> a
63−text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParse s)
87+text2isString :: Parsec a => String -> String -> a
88+text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParsec s)
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs+39−26
@@ -1,5 +1,5 @@
11module Distribution.Nixpkgs.Haskell.PackageSourceSpec
2− ( Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
2+ ( HpackUse(..), Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
33 ) where
44
55import qualified Control.Exception as Exception
@@ -11,16 +11,18 @@ import qualified Data.ByteString.Char8 as BS
1111import Data.List ( isSuffixOf, isPrefixOf )
1212import qualified Data.Map as DB
1313import Data.Maybe
14+import qualified Data.Text as T
15+import qualified Data.Text.Encoding as T
1416import Data.Time
1517import Distribution.Nixpkgs.Fetch
1618import Distribution.Nixpkgs.Hashes
1719import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
20+import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
1821import qualified Distribution.Package as Cabal
1922import Distribution.PackageDescription
2023import qualified Distribution.PackageDescription as Cabal
2124import Distribution.PackageDescription.Parsec as Cabal
22−import Distribution.Parsec.Common (showPError)
23−import Distribution.Text ( simpleParse, display )
25+import Distribution.Parsec
2426import Distribution.Version
2527import qualified Hpack.Config as Hpack
2628import qualified Hpack.Render as Hpack
@@ -29,8 +31,12 @@ import System.Directory ( doesDirectoryExist, doesFileExist, createDirectoryIfMi
2931import System.Exit ( exitFailure )
3032import System.FilePath ( (</>), (<.>) )
3133import System.IO
32−import qualified Data.Text as T
33−import qualified Data.Text.Encoding as T
34+import Text.PrettyPrint.HughesPJClass hiding ( first )
35+
36+data HpackUse
37+ = ForceHpack
38+ | PackageYamlHpack
39+ | NoHpack
3440
3541data Package = Package
3642 { pkgSource :: DerivationSource
@@ -39,8 +45,8 @@ data Package = Package
3945 }
4046 deriving (Show)
4147
42−getPackage :: Bool
43− -- ^ Whether hpack should regenerate the cabal file.
48+getPackage :: HpackUse
49+ -- ^ the way hpack should be used.
4450 -> Bool
4551 -- ^ Whether to fetch submodules if fetching from git
4652 -> Maybe FilePath
@@ -52,8 +58,8 @@ getPackage :: Bool
5258getPackage optHpack optSubmodules optHackageDB optHackageSnapshot =
5359 getPackage' optHpack optSubmodules (loadHackageDB optHackageDB optHackageSnapshot)
5460
55−getPackage' :: Bool
56− -- ^ Whether hpack should regenerate the cabal file.
61+getPackage' :: HpackUse
62+ -- ^ the way hpack should be used.
5763 -> Bool
5864 -- ^ Whether to fetch submodules if fetching from git
5965 -> IO DB.HackageDB
@@ -63,8 +69,8 @@ getPackage' optHpack optSubmodules hackageDB source = do
6369 (derivSource, ranHpack, pkgDesc) <- fetchOrFromDB optHpack optSubmodules hackageDB source
6470 (\s -> Package s ranHpack pkgDesc) <$> maybe (sourceFromHackage (sourceHash source) (showPackageIdentifier pkgDesc) $ sourceCabalDir source) return derivSource
6571
66−fetchOrFromDB :: Bool
67− -- ^ Whether hpack should regenerate the cabal file
72+fetchOrFromDB :: HpackUse
73+ -- ^ the way hpack should be used
6874 -> Bool
6975 -- ^ Whether to fetch submodules if fetching from git
7076 -> IO DB.HackageDB
@@ -102,12 +108,12 @@ fromDB hackageDBIO pkg = do
102108 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
103109 where
104110 pkgId :: Cabal.PackageIdentifier
105− pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
111+ pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParsec pkg)
106112 name = Cabal.packageName pkgId
107113
108− unknownPackageError = fail $ "No such package " ++ display pkgId ++ " in the cabal database. Did you run cabal update?"
114+ unknownPackageError = fail $ "No such package " ++ prettyShow pkgId ++ " in the cabal database. Did you run cabal update?"
109115
110− url = "mirror://hackage/" ++ display pkgId ++ ".tar.gz"
116+ url = "mirror://hackage/" ++ prettyShow pkgId ++ ".tar.gz"
111117
112118 version :: Version
113119 version = Cabal.packageVersion pkgId
@@ -170,12 +176,12 @@ sourceFromHackage optHash pkgId cabalDir = do
170176 exitFailure
171177
172178showPackageIdentifier :: Cabal.GenericPackageDescription -> String
173−showPackageIdentifier pkgDesc = name ++ "-" ++ display version where
179+showPackageIdentifier pkgDesc = name ++ "-" ++ prettyShow version where
174180 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
175181 name = Cabal.unPackageName (Cabal.packageName pkgId)
176182 version = Cabal.packageVersion pkgId
177183
178−cabalFromPath :: Bool -- ^ Whether hpack should regenerate the cabal file
184+cabalFromPath :: HpackUse -- ^ the way hpack should be used
179185 -> FilePath -> MaybeT IO (Bool, Bool, Cabal.GenericPackageDescription)
180186cabalFromPath optHpack path = do
181187 d <- liftIO $ doesDirectoryExist path
@@ -185,21 +191,25 @@ cabalFromPath optHpack path = do
185191 return (d, ranHpack, pkg)
186192 else (,,) d False <$> cabalFromFile False path
187193
188−cabalFromDirectory :: Bool -- ^ Whether hpack should regenerate the cabal file
194+cabalFromDirectory :: HpackUse -- ^ the way hpack should be used
189195 -> FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
190−cabalFromDirectory True dir = hpackDirectory dir
191−cabalFromDirectory False dir = do
196+cabalFromDirectory ForceHpack dir = hpackDirectory dir
197+cabalFromDirectory NoHpack dir = onlyCabalFromDirectory dir "*** No .cabal file was found. Exiting."
198+cabalFromDirectory PackageYamlHpack dir = do
192199 useHpack <- liftIO $ doesFileExist (dir </> "package.yaml")
193200 if useHpack
194201 then do
195202 liftIO $ hPutStrLn stderr "*** found package.yaml. Using hpack..."
196203 hpackDirectory dir
197− else do
198− cabals <- liftIO $ getDirectoryContents dir >>= filterM doesFileExist . map (dir </>) . filter (".cabal" `isSuffixOf`)
199− case cabals of
200− [] -> fail "*** Found neither a .cabal file nor package.yaml. Exiting."
201− [cabalFile] -> (,) False <$> cabalFromFile True cabalFile
202− _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
204+ else onlyCabalFromDirectory dir "*** Found neither a .cabal file nor package.yaml. Exiting."
205+
206+onlyCabalFromDirectory :: FilePath -> String -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
207+onlyCabalFromDirectory dir errMsg = do
208+ cabals <- liftIO $ getDirectoryContents dir >>= filterM doesFileExist . map (dir </>) . filter (".cabal" `isSuffixOf`)
209+ case cabals of
210+ [] -> fail errMsg
211+ [cabalFile] -> (,) False <$> cabalFromFile True cabalFile
212+ _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
203213
204214handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
205215handleIO = Exception.handle
@@ -216,7 +226,10 @@ hpackDirectory dir = do
216226 case mPackage of
217227 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
218228 Right r -> do
219− let hpackOutput = encodeUtf8 $ Hpack.renderPackage [] (Hpack.decodeResultPackage r)
229+ let hpackOutput =
230+ let body = Hpack.renderPackage [] (Hpack.decodeResultPackage r)
231+ cabalVersion = Hpack.decodeResultCabalVersion r
232+ in encodeUtf8 $ cabalVersion ++ body
220233 hash = printSHA256 $ digest (digestByName "sha256") hpackOutput
221234 case runParseGenericPackageDescription "<hpack output>" hpackOutput of
222235 Left msg -> liftIO $ do
test/Main.hs+3−11
@@ -99,14 +99,6 @@ testExecutable exe cabalFile = do
9999-- * Helper functions
100100-------------------------------------------------------------------------------
101101
102−-- | Find all *files* in the given directory. This function does not recurse,
103−-- nor does it include the special entries @'.'@ or @'..'@ in the result.
104−
105−listDirectoryFiles :: FilePath -> IO [FilePath]
106−listDirectoryFiles dirPath = do
107− entries <- listDirectory dirPath
108− filterM doesFileExist (map (dirPath </>) entries)
109−
110102-- | Find all *files* in the given directory that end with the given suffix.
111103-- This function does not recurse, nor does it include the special entries
112104-- @'.'@ or @'..'@ in the result.
@@ -119,9 +111,9 @@ listDirectoryFiles dirPath = do
119111-- we prefer our own simpler code.
120112
121113listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
122−listDirectoryFilesBySuffix suff =
123− fmap (filter ((suff ==) . takeExtension)) . listDirectoryFiles
124−
114+listDirectoryFilesBySuffix suff dirPath = do
115+ entries <- listDirectory dirPath
116+ filterM doesFileExist [ dirPath </> e | e <- entries, takeExtension e == suff ]
125117
126118-- | A variant of 'writeFile' that appends a newline to the end of the buffer
127119-- before writing.
test/golden-test-cases/ede.nix.golden+1
@@ -21,4 +21,5 @@ mkDerivation {
2121 homepage = "http://github.com/brendanhay/ede";
2222 description = "Templating language with similar syntax and features to Liquid or Jinja2";
2323 license = "unknown";
24+ hydraPlatforms = stdenv.lib.platforms.none;
2425}
test/golden-test-cases/gogol-adexchange-buyer.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Ad Exchange Buyer SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-admin-emailmigration.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Email Migration API v2 SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-affiliates.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Affiliate Network SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-apps-tasks.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Tasks SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-appstate.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google App State SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-blogger.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Blogger SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-datastore.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Cloud Datastore SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-dfareporting.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google DCM/DFA Reporting And Trafficking SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-firebase-rules.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Firebase Rules SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-gmail.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Gmail SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-kgsearch.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Knowledge Graph Search SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-maps-engine.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Maps Engine SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-plus.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google + SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-resourceviews.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Compute Engine Instance Groups SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-translate.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Translate SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-webmaster-tools.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google Search Console SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/gogol-youtube.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "https://github.com/brendanhay/gogol";
88 description = "Google YouTube Data SDK";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/hxt-expat.nix.golden+1
@@ -7,4 +7,5 @@ mkDerivation {
77 homepage = "http://www.fh-wedel.de/~si/HXmlToolbox/index.html";
88 description = "Expat parser for HXT";
99 license = "unknown";
10+ hydraPlatforms = stdenv.lib.platforms.none;
1011}
test/golden-test-cases/hxt-tagsoup.nix.golden+1
@@ -11,4 +11,5 @@ mkDerivation {
1111 homepage = "https://github.com/UweSchmidt/hxt";
1212 description = "TagSoup parser for HXT";
1313 license = "unknown";
14+ hydraPlatforms = stdenv.lib.platforms.none;
1415}
test/golden-test-cases/openpgp-asciiarmor.nix.golden+1
@@ -15,4 +15,5 @@ mkDerivation {
1515 homepage = "http://floss.scru.org/openpgp-asciiarmor";
1616 description = "OpenPGP (RFC4880) ASCII Armor codec";
1717 license = "unknown";
18+ hydraPlatforms = stdenv.lib.platforms.none;
1819}
test/golden-test-cases/swagger.nix.golden+1
@@ -11,4 +11,5 @@ mkDerivation {
1111 testHaskellDepends = [ aeson base bytestring tasty tasty-hunit ];
1212 description = "Implementation of swagger data model";
1313 license = "unknown";
14+ hydraPlatforms = stdenv.lib.platforms.none;
1415}
update-stackage.sh+12−9
@@ -2,11 +2,14 @@
22
33set -eu -o pipefail
44
5−tmpfile=$(mktemp "stackage-update.XXXXXXX")
6−trap "rm $tmpfile" 0
5+cd "$(dirname "$0")"
76
8−curl -L -s "https://www.stackage.org/lts/cabal.config" >"$tmpfile"
9−version=$(sed -n "s/^--.*http:..www.stackage.org.snapshot.lts-//p" "$tmpfile")
7+tmpfile=$(mktemp "update-stackage.XXXXXXX")
8+# shellcheck disable=SC2064
9+trap "rm ${tmpfile} ${tmpfile}.new" 0
10+
11+curl -L -s "https://stackage.org/lts/cabal.config" >"$tmpfile"
12+version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.lts-//p" "$tmpfile")
1013
1114# Create a simple yaml version of the file.
1215sed -r \
@@ -16,12 +19,13 @@ sed -r \
1619 -e 's|,$||' \
1720 -e '/installed$/d' \
1821 -e '/^$/d' \
19− -i "$tmpfile"
22+ < "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"
2023
2124# Drop restrictions on some tools where we always want the latest version.
2225sed -r \
2326 -e '/ cabal-install /d' \
2427 -e '/ cabal2nix /d' \
28+ -e '/ cabal2spec /d' \
2529 -e '/ distribution-nixpkgs /d' \
2630 -e '/ git-annex /d' \
2731 -e '/ hindent /d' \
@@ -31,17 +35,16 @@ sed -r \
3135 -e '/ hopenssl /d' \
3236 -e '/ jailbreak-cabal /d' \
3337 -e '/ json-autotype/d' \
34− -e '/ lambdabot-core /d' \
35− -e '/ lambdabot-irc-plugins /d' \
3638 -e '/ language-nix /d' \
3739 -e '/ shake /d' \
3840 -e '/ ShellCheck /d' \
3941 -e '/ stack /d' \
4042 -e '/ weeder /d' \
41− -i "$tmpfile"
43+ < "${tmpfile}.new" > "${tmpfile}"
4244
4345# Drop the previous configuration ...
44−sed -e '/# LTS Haskell/,/^$/c \TODO\
46+# shellcheck disable=SC1004
47+sed -e '/ # LTS Haskell/,/^$/c \TODO\
4548' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
4649
4750# ... and replace it with the new one.