git.iko.soy/typeable/cabal2nix
on c7420eb help sign in
.travis.yml+83−133
since splitsnapshots
unifiedsplit
@@ -1,161 +1,111 @@
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+# runghc make_travis_yml_2.hs '--doctest' '--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen' '--hlint' '-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/hvr/multi-ghc-travis
6#
6#
7−# version: 0.9.20200306
8−#
9−version: ~> 1.0
10language: c
7language: c
11−os: linux
8+sudo: false
12−dist: xenial
9+
13git:
10git:
14− # whether to recursively clone submodules
11+ submodules: false # whether to recursively clone submodules
15− submodules: false
12+
16cache:
13cache:
17 directories:
14 directories:
18 - $HOME/.cabal/packages
15 - $HOME/.cabal/packages
19 - $HOME/.cabal/store
16 - $HOME/.cabal/store
20− - $HOME/.hlint
17+
21before_cache:
18before_cache:
22− - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
19+ - rm -fv $HOME/.cabal/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'
24− - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
21+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
25− - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
22+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
26− - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
23+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
27− - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
24+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
28− - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
25+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
26+
29− - rm -rfv $CABALHOME/packages/head.hackage
27+ - rm -rfv $HOME/.cabal/packages/head.hackage
30−jobs:
28+
29+matrix:
31 include:
30 include:
32− - compiler: ghc-8.10.1
31+ - compiler: "ghc-8.4.3"
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"]}}
32+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
34− os: linux
33+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
35− - compiler: ghc-8.8.3
34+
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:
35before_install:
45− - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
36+ - HC=${CC}
46− - WITHCOMPILER="-w $HC"
47− - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
48− - HCPKG="$HC-pkg"
37+ - HCPKG=${HC/ghc/ghc-pkg}
49 - unset CC
38 - unset CC
50− - CABAL=/opt/ghc/bin/cabal
39+ - ROOTDIR=$(pwd)
51− - CABALHOME=$HOME/.cabal
40+ - mkdir -p $HOME/.local/bin
52− - export PATH="$CABALHOME/bin:$PATH"
41+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/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))')"
42+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
55 - echo $HCNUMVER
43 - echo $HCNUMVER
56− - CABAL="$CABAL -vnormal+nowrap"
44+
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
90install:
45install:
91− - ${CABAL} --version
46+ - cabal --version
92 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
47 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
93− - |
48+ - BENCH=${BENCH---enable-benchmarks}
94− echo "program-default-options" >> $CABALHOME/config
49+ - TEST=${TEST---enable-tests}
95− echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
50+ - HADDOCK=${HADDOCK-true}
96− - cat $CABALHOME/config
51+ - UNCONSTRAINED=${UNCONSTRAINED-true}
97− - rm -fv cabal.project cabal.project.local cabal.project.freeze
52+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
53+ - GHCHEAD=${GHCHEAD-false}
98− - travis_retry ${CABAL} v2-update -v
54+ - travis_retry cabal update -v
55+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
56+ - rm -fv cabal.project cabal.project.local
57+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
99− - (cd /tmp && ${CABAL} v2-install $WITHCOMPILER -j2 doctest --constraint='doctest ==0.16.2.*')
58+ - if [ $HCNUMVER -ge 80000 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin doctest --constraint='doctest ==0.16.*'; fi
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
59+ - if [ $HCNUMVER -eq 80403 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin hlint --constraint='hlint ==2.1.*'; 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
60+ - "printf 'packages: \".\"\\n' > cabal.project"
105− - rm -rf cabal.project cabal.project.local cabal.project.freeze
106− - touch cabal.project
61+ - touch cabal.project.local
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"
62+ - "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"
111 - cat cabal.project || true
63 - cat cabal.project || true
112 - cat cabal.project.local || true
64 - cat cabal.project.local || true
113− - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
65+ - if [ -f "./configure.ac" ]; then
114− - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
66+ (cd "." && autoreconf -i);
67+ fi
115− - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
68+ - rm -f cabal.project.freeze
116− - rm cabal.project.freeze
69+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
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
70+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
119−script:
71+ - rm -rf .ghc.environment.* "."/dist
120 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
72 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
121− # Packaging...
73+
122− - ${CABAL} v2-sdist all
74+# Here starts the actual work to be performed for the package under test;
123− # Unpacking...
75+# any command which exits with a non-zero exit code causes the build to fail.
76+script:
77+ # test that source-distributions can be generated
78+ - (cd "." && cabal sdist)
124− - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
79+ - mv "."/dist/cabal2nix-*.tar.gz ${DISTDIR}/
125 - cd ${DISTDIR} || false
80 - cd ${DISTDIR} || false
126− - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
81+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
127− - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
82+ - "printf 'packages: cabal2nix-*/*.cabal\\n' > cabal.project"
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
83+ - touch cabal.project.local
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"
84+ - "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"
136 - cat cabal.project || true
85 - cat cabal.project || true
137 - cat cabal.project.local || true
86 - cat cabal.project.local || true
138− # Building...
139 # this builds all libraries and executables (without tests/benchmarks)
87 # this builds all libraries and executables (without tests/benchmarks)
140− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
88+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
141− # Building with tests and benchmarks...
89+
142 # build & run tests, build benchmarks
90 # build & run tests, build benchmarks
143− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
91+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
144− # Testing...
92+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
145− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
93+
146− # Doctest...
94+ # doctest
147− - (cd ${PKGDIR_cabal2nix} && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen src)
95+ - if [ $HCNUMVER -ge 80000 ]; then (cd cabal2nix-* && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen -XMonadFailDesugaring src); fi
148− # HLint..
96+
149− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint src) ; fi
97+ # hlint
150− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint hackage2nix) ; fi
98+ - if [ $HCNUMVER -eq 80403 ]; then (cd cabal2nix-* && hlint -XMonadFailDesugaring src); fi
151− - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint cabal2nix) ; fi
99+
152− # cabal check...
100+ # cabal check
153− - (cd ${PKGDIR_cabal2nix} && ${CABAL} -vnormal check)
101+ - (cd cabal2nix-* && cabal check)
102+
154− # haddock...
103+ # haddock
155− - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
104+ - rm -rf ./dist-newstyle
105+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
106+
156− # Building without installed constraints for packages in global-db...
107+ # Build without installed constraints for packages in global-db
157− - rm -f cabal.project.local
108+ - 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
158− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
159
109
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"])
110+# REGENDATA ["--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","--hlint","-o",".travis.yml","cabal2nix.cabal"]
161# EOF
111# EOF
README.md+7−7
@@ -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
34−https://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages.
34+http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure.
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+82−30
@@ -1,5 +1,5 @@
1name: cabal2nix
1name: cabal2nix
2−version: 2.15.1
2+version: 2.10.0
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.4.3
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
@@ -60,19 +107,19 @@ library
60 Distribution.Nixpkgs.Haskell.PackageSourceSpec
107 Distribution.Nixpkgs.Haskell.PackageSourceSpec
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 < 5
64− , Cabal == 3.0.*
111+ , Cabal > 2.2
65− , aeson > 1
112+ , aeson
66 , ansi-wl-pprint
113 , ansi-wl-pprint
67 , bytestring
114 , bytestring
68− , containers >= 0.5.9
115+ , containers
69 , deepseq >= 1.4
116 , deepseq >= 1.4
70 , directory
117 , directory
71− , distribution-nixpkgs >= 1.3.1
118+ , distribution-nixpkgs >= 1.1.1
72 , filepath
119 , filepath
73 , hackage-db >= 2.0.1
120 , hackage-db >= 2.0.1
74 , hopenssl >= 2
121 , hopenssl >= 2
75− , hpack >= 0.29.6
122+ , hpack >= 0.26
76 , language-nix
123 , language-nix
77 , lens
124 , lens
78 , optparse-applicative
125 , optparse-applicative
@@ -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,13 +159,13 @@ 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.2
114 , aeson
163 , aeson
115 , bytestring
164 , bytestring
116 , cabal2nix
165 , cabal2nix
117 , containers
166 , containers
118 , directory
167 , directory
119− , distribution-nixpkgs >= 1.2
168+ , distribution-nixpkgs >= 1.1.1
120 , filepath
169 , filepath
121 , hopenssl >= 2
170 , hopenssl >= 2
122 , language-nix
171 , language-nix
@@ -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.2
139 , cabal2nix
189 , cabal2nix
140 , containers
190 , containers
141 , directory
191 , directory
@@ -147,6 +197,8 @@ 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 -rtsopts -with-rtsopts=-N
204+ -with-rtsopts=-K1K
hackage2nix/Main.hs+20−29
@@ -1,5 +1,6 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3+{-# LANGUAGE CPP #-}
3
4
4module Main ( main ) where
5module Main ( main ) where
5
6
@@ -10,10 +11,13 @@ import Control.Monad
10import Control.Monad.Par.Combinator
11import Control.Monad.Par.Combinator
11import Control.Monad.Par.IO
12import Control.Monad.Par.IO
12import Control.Monad.Trans ( liftIO )
13import Control.Monad.Trans ( liftIO )
13−import Data.List ( intercalate )
14+import Data.List
14import Data.Map.Strict ( Map )
15import Data.Map.Strict ( Map )
15import qualified Data.Map.Strict as Map
16import qualified Data.Map.Strict as Map
16import Data.Maybe
17import Data.Maybe
18+#if !MIN_VERSION_base(4,11,0)
19+import Data.Monoid
20+#endif
17import Data.Set ( Set )
21import Data.Set ( Set )
18import qualified Data.Set as Set
22import qualified Data.Set as Set
19import Data.String
23import Data.String
@@ -23,11 +27,10 @@ import Distribution.Nixpkgs.Haskell.Constraint
23import Distribution.Nixpkgs.Haskell.FromCabal
27import Distribution.Nixpkgs.Haskell.FromCabal
24import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
28import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
25import Distribution.Nixpkgs.Haskell.FromCabal.Flags
29import Distribution.Nixpkgs.Haskell.FromCabal.Flags
26−import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
27import Distribution.Nixpkgs.Meta
30import Distribution.Nixpkgs.Meta
28import Distribution.Nixpkgs.PackageMap
31import Distribution.Nixpkgs.PackageMap
29import Distribution.Package
32import Distribution.Package
30−import Distribution.PackageDescription hiding ( options, extraLibs, buildTools, homepage )
33+import Distribution.PackageDescription hiding ( options, buildDepends, extraLibs, buildTools, homepage )
31import Distribution.System
34import Distribution.System
32import Distribution.Text
35import Distribution.Text
33import Distribution.Version
36import Distribution.Version
@@ -63,7 +66,7 @@ main = do
63 pinfo :: ParserInfo CLI
66 pinfo :: ParserInfo CLI
64 pinfo = info
67 pinfo = info
65 ( helper
68 ( helper
66− <*> infoOption ("hackage2nix " ++ prettyShow Main.version) (long "version" <> help "Show version number")
69+ <*> infoOption ("hackage2nix " ++ display Main.version) (long "version" <> help "Show version number")
67 <*> cliOptions
70 <*> cliOptions
68 )
71 )
69 ( fullDesc
72 ( fullDesc
@@ -72,15 +75,13 @@ main = do
72 CLI {..} <- execParser pinfo
75 CLI {..} <- execParser pinfo
73
76
74 config <- readConfiguration (nixpkgsRepository </> configFile)
77 config <- readConfiguration (nixpkgsRepository </> configFile)
75− nixpkgs <- readNixpkgPackageMap ["-f", nixpkgsRepository, "--arg", "config", "{ allowAliases = false; }"]
78+ nixpkgs <- readNixpkgPackageMap nixpkgsRepository Nothing
76 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
79 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
77 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
80 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
78 . Map.delete "som" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
81 . Map.delete "som" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
79 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
82 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
80 . Map.delete "control-invariants" -- TODO: depends on "assert"
83 . Map.delete "control-invariants" -- TODO: depends on "assert"
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
84+ . over (at ("hermes")) ((fmap (set (contains "1.3.4.3") False))) -- TODO: https://github.com/haskell/hackage-server/issues/436
84 hackage <- fixup <$> readHackage hackageRepository
85 hackage <- fixup <$> readHackage hackageRepository
85 let
86 let
86 hackagePackagesFile :: FilePath
87 hackagePackagesFile :: FilePath
@@ -93,7 +94,7 @@ main = do
93 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
94 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
94
95
95 defaultPackageOverridesSet :: PackageSet
96 defaultPackageOverridesSet :: PackageSet
96− defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _ _) <- defaultPackageOverrides config ]
97+ defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _) <- defaultPackageOverrides config ]
97
98
98 generatedDefaultPackageSet :: PackageSet
99 generatedDefaultPackageSet :: PackageSet
99 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
100 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
@@ -106,7 +107,7 @@ main = do
106
107
107 extraPackageSet :: PackageMultiSet
108 extraPackageSet :: PackageMultiSet
108 extraPackageSet = Map.unionsWith Set.union
109 extraPackageSet = Map.unionsWith Set.union
109− [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _ _) <- extraPackages config ]
110+ [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _) <- extraPackages config ]
110
111
111 db :: PackageMultiSet
112 db :: PackageMultiSet
112 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
113 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
@@ -116,7 +117,7 @@ main = do
116 ]
117 ]
117
118
118 haskellResolver :: Dependency -> Bool
119 haskellResolver :: Dependency -> Bool
119− haskellResolver (Dependency name vrange _)
120+ haskellResolver (Dependency name vrange)
120 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
121 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
121 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
122 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
122 | otherwise = False
123 | otherwise = False
@@ -135,13 +136,8 @@ main = do
135 (descr, cabalSHA256) <- readPackage hackageRepository pkgId
136 (descr, cabalSHA256) <- readPackage hackageRepository pkgId
136 meta <- readPackageMeta hackageRepository pkgId
137 meta <- readPackageMeta hackageRepository pkgId
137
138
138− let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool
139+ let isInDefaultPackageSet :: Bool
139− isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)
140+ isInDefaultPackageSet = maybe False (== 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)
145
141
146 tarballSHA256 :: SHA256Hash
142 tarballSHA256 :: SHA256Hash
147 tarballSHA256 = fromMaybe (error (display pkgId ++ ": meta data has no hash for the tarball"))
143 tarballSHA256 = fromMaybe (error (display pkgId ++ ": meta data has no hash for the tarball"))
@@ -155,17 +151,15 @@ main = do
155
151
156 drv :: Derivation
152 drv :: Derivation
157 drv = fromGenericPackageDescription haskellResolver nixpkgsResolver targetPlatform (compilerInfo config) flagAssignment [] descr
153 drv = fromGenericPackageDescription haskellResolver nixpkgsResolver targetPlatform (compilerInfo config) flagAssignment [] descr
158− & src .~ urlDerivationSource ("mirror://hackage/" ++ display pkgId ++ ".tar.gz") tarballSHA256
154+ & src .~ DerivationSource "url" ("mirror://hackage/" ++ display pkgId ++ ".tar.gz") "" tarballSHA256
159 & editedCabalFile .~ cabalSHA256
155 & editedCabalFile .~ cabalSHA256
160− & metaSection.platforms %~ (`Set.difference` Map.findWithDefault Set.empty name (unsupportedPlatforms config))
156+ & metaSection.hydraPlatforms %~ (`Set.difference` Map.findWithDefault Set.empty name (dontDistributePackages 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
164 & metaSection.maintainers .~ Map.findWithDefault Set.empty name globalPackageMaintainers
157 & metaSection.maintainers .~ Map.findWithDefault Set.empty name globalPackageMaintainers
158+ & metaSection.hydraPlatforms %~ (if isInDefaultPackageSet then id else const Set.empty)
165 & metaSection.homepage .~ ""
159 & metaSection.homepage .~ ""
166
160
167 overrides :: Doc
161 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) ]
162+ 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 $
163 return $ render $ nest 2 $
170 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
164 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
171
165
@@ -199,13 +193,10 @@ enforcePreferredVersions cs pkg = Set.filter (\v -> PackageIdentifier pkg v `sat
199
193
200resolveConstraint :: Constraint -> Hackage -> Version
194resolveConstraint :: Constraint -> Hackage -> Version
201resolveConstraint c = fromMaybe (error msg) . resolveConstraint' c
195resolveConstraint c = fromMaybe (error msg) . resolveConstraint' c
202− where msg = unlines [ "constraint " ++ display c ++ " cannot be resolved in Hackage"
196+ where msg = "constraint " ++ display c ++ " cannot be resolved in Hackage"
203− , "This could be due the package being missing in the hackage directory"
204− , "or the file system not being case sensitive."
205− ]
206
197
207resolveConstraint' :: Constraint -> Hackage -> Maybe Version
198resolveConstraint' :: Constraint -> Hackage -> Maybe Version
208−resolveConstraint' (Dependency name vrange _) hackage
199+resolveConstraint' (Dependency name vrange) hackage
209 | Just vset' <- Map.lookup name hackage
200 | Just vset' <- Map.lookup name hackage
210 , vset <- Set.filter (`withinRange` vrange) vset'
201 , vset <- Set.filter (`withinRange` vrange) vset'
211 , not (Set.null vset) = Just (Set.findMax vset)
202 , 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+18−30
@@ -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 )
@@ -45,10 +46,9 @@ data Options = Options
45 , optMaintainer :: [String]
46 , optMaintainer :: [String]
46--, optPlatform :: [String] -- TODO: fix command line handling of platforms
47--, optPlatform :: [String] -- TODO: fix command line handling of platforms
47 , optHaddock :: Bool
48 , optHaddock :: Bool
48− , optHpack :: HpackUse
49+ , optHpack :: Bool
49 , optDoCheck :: Bool
50 , optDoCheck :: Bool
50 , optJailbreak :: Bool
51 , optJailbreak :: Bool
51− , optDoBenchmark :: Bool
52 , optRevision :: Maybe String
52 , optRevision :: Maybe String
53 , optHyperlinkSource :: Bool
53 , optHyperlinkSource :: Bool
54 , optEnableLibraryProfiling :: Bool
54 , optEnableLibraryProfiling :: Bool
@@ -64,7 +64,6 @@ data Options = Options
64 , optHackageSnapshot :: Maybe UTCTime
64 , optHackageSnapshot :: Maybe UTCTime
65 , optNixpkgsIdentifier :: NixpkgsResolver
65 , optNixpkgsIdentifier :: NixpkgsResolver
66 , optUrl :: String
66 , optUrl :: String
67− , optFetchSubmodules :: Bool
68 }
67 }
69
68
70options :: Parser Options
69options :: Parser Options
@@ -73,17 +72,9 @@ options = Options
73 <*> many (strOption $ long "maintainer" <> metavar "MAINTAINER" <> help "maintainer of this package (may be specified multiple times)")
72 <*> many (strOption $ long "maintainer" <> metavar "MAINTAINER" <> help "maintainer of this package (may be specified multiple times)")
74-- <*> many (strOption $ long "platform" <> metavar "PLATFORM" <> help "supported build platforms (may be specified multiple times)")
73-- <*> many (strOption $ long "platform" <> metavar "PLATFORM" <> help "supported build platforms (may be specified multiple times)")
75 <*> flag True False (long "no-haddock" <> help "don't run Haddock when building this package")
74 <*> flag True False (long "no-haddock" <> help "don't run Haddock when building this package")
76− <*>
77− (
78− flag' ForceHpack (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
75+ <*> switch (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− )
84 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
76 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
85 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
77 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
86− <*> switch (long "benchmark" <> help "enable benchmarks for this package")
87 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
78 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
88 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
79 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
89 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
80 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
@@ -93,13 +84,12 @@ options = Options
93 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
84 <*> 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")
85 <*> 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)")
86 <*> 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)
87+ <*> 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)
88+ <*> 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)")
89 <*> 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"))
90 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
100− <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
91+ <*> pure (\i -> Just (binding # (i, path # [i])))
101 <*> strArgument (metavar "URI")
92 <*> strArgument (metavar "URI")
102− <*> flag True False (long "dont-fetch-submodules" <> help "do not fetch git submodules from git sources")
103
93
104-- | A parser for the date. Hackage updates happen maybe once or twice a month.
94-- | A parser for the date. Hackage updates happen maybe once or twice a month.
105-- Example: parseTime defaultTimeLocale "%FT%T%QZ" "2017-11-20T12:18:35Z" :: Maybe UTCTime
95-- Example: parseTime defaultTimeLocale "%FT%T%QZ" "2017-11-20T12:18:35Z" :: Maybe UTCTime
@@ -109,8 +99,10 @@ utcTimeReader = eitherReader $ \arg ->
109 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
99 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
110 Just utcTime -> Right utcTime
100 Just utcTime -> Right utcTime
111
101
112−parseCabal :: Parsec a => ReadM a
102+readP :: P.ReadP a a -> ReadM a
113−parseCabal = eitherReader eitherParsec
103+readP p = eitherReader $ \s -> case [ r' | (r',"") <- P.readP_to_S p s ] of
104+ (r:_) -> Right r
105+ _ -> Left ("invalid value " ++ show s)
114
106
115-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
107-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
116-- since the output of that is what Cabal parses.
108-- since the output of that is what Cabal parses.
@@ -135,7 +127,6 @@ ghcConvertOS os = case os of
135 "watchos" -> "ios"
127 "watchos" -> "ios"
136 "tvos" -> "ios"
128 "tvos" -> "ios"
137 "linux-android" -> "linux-android"
129 "linux-android" -> "linux-android"
138− "linux-androideabi" -> "linux-androideabi"
139 _ | "linux-" `isPrefixOf` os -> "linux"
130 _ | "linux-" `isPrefixOf` os -> "linux"
140 _ -> fromMaybe os $ listToMaybe
131 _ -> fromMaybe os $ listToMaybe
141 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
132 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
@@ -162,7 +153,7 @@ parsePlatformParts = \case
162pinfo :: ParserInfo Options
153pinfo :: ParserInfo Options
163pinfo = info
154pinfo = info
164 ( helper
155 ( helper
165− <*> infoOption ("cabal2nix " ++ prettyShow version) (long "version" <> help "Show version number")
156+ <*> infoOption ("cabal2nix " ++ display version) (long "version" <> help "Show version number")
166 <*> options
157 <*> options
167 )
158 )
168 ( fullDesc
159 ( fullDesc
@@ -191,21 +182,19 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() ->
191 cabal2nix =<< getArgs
182 cabal2nix =<< getArgs
192
183
193hpackOverrides :: Derivation -> Derivation
184hpackOverrides :: Derivation -> Derivation
194−hpackOverrides = over phaseOverrides (++ "prePatch = \"hpack\";")
185+hpackOverrides = over phaseOverrides (++ "preConfigure = \"hpack\";")
195 . set (libraryDepends . tool . contains (PP.pkg "hpack")) True
186 . set (libraryDepends . tool . contains (PP.pkg "hpack")) True
196
187
197cabal2nix' :: Options -> IO (Either Doc Derivation)
188cabal2nix' :: Options -> IO (Either Doc Derivation)
198cabal2nix' opts@Options{..} = do
189cabal2nix' opts@Options{..} = do
199− pkg <- getPackage optHpack optFetchSubmodules optHackageDb optHackageSnapshot $
200− Source optUrl (fromMaybe "" optRevision) (maybe UnknownHash Guess optSha256) (fromMaybe "" optSubpath)
190+ pkg <- getPackage optHpack optHackageDb optHackageSnapshot $ Source optUrl (fromMaybe "" optRevision) (maybe UnknownHash Guess optSha256) (fromMaybe "" optSubpath)
201 processPackage opts pkg
191 processPackage opts pkg
202
192
203cabal2nixWithDB :: DB.HackageDB -> Options -> IO (Either Doc Derivation)
193cabal2nixWithDB :: DB.HackageDB -> Options -> IO (Either Doc Derivation)
204cabal2nixWithDB db opts@Options{..} = do
194cabal2nixWithDB db opts@Options{..} = do
205 when (isJust optHackageDb) $ hPutStrLn stderr "WARN: HackageDB provided directly; ignoring --hackage-db"
195 when (isJust optHackageDb) $ hPutStrLn stderr "WARN: HackageDB provided directly; ignoring --hackage-db"
206 when (isJust optHackageSnapshot) $ hPutStrLn stderr "WARN: HackageDB provided directly; ignoring --hackage-snapshot"
196 when (isJust optHackageSnapshot) $ hPutStrLn stderr "WARN: HackageDB provided directly; ignoring --hackage-snapshot"
207− pkg <- getPackage' optHpack optFetchSubmodules (return db) $
208− Source optUrl (fromMaybe "" optRevision) (maybe UnknownHash Guess optSha256) (fromMaybe "" optSubpath)
197+ pkg <- getPackage' optHpack (return db) $ Source optUrl (fromMaybe "" optRevision) (maybe UnknownHash Guess optSha256) (fromMaybe "" optSubpath)
209 processPackage opts pkg
198 processPackage opts pkg
210
199
211processPackage :: Options -> Package -> IO (Either Doc Derivation)
200processPackage :: Options -> Package -> IO (Either Doc Derivation)
@@ -235,7 +224,6 @@ processPackage Options{..} pkg = do
235 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
224 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
236-- & metaSection.platforms .~ Set.fromList optPlatform
225-- & metaSection.platforms .~ Set.fromList optPlatform
237 & doCheck &&~ optDoCheck
226 & doCheck &&~ optDoCheck
238− & doBenchmark ||~ optDoBenchmark
239 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
227 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
240
228
241 shell :: Doc
229 shell :: Doc
src/Distribution/Nixpkgs/Fetch.hs+8−46
@@ -6,7 +6,7 @@
6module Distribution.Nixpkgs.Fetch
6module Distribution.Nixpkgs.Fetch
7 ( Source(..)
7 ( Source(..)
8 , Hash(..)
8 , Hash(..)
9− , DerivationSource(..), fromDerivationSource, urlDerivationSource
9+ , DerivationSource(..), fromDerivationSource
10 , fetch
10 , fetch
11 , fetchWith
11 , fetchWith
12 ) where
12 ) where
@@ -18,10 +18,7 @@ import Control.Monad.IO.Class
18import Control.Monad.Trans.Maybe
18import Control.Monad.Trans.Maybe
19import Data.Aeson
19import Data.Aeson
20import qualified Data.ByteString.Lazy.Char8 as BS
20import qualified Data.ByteString.Lazy.Char8 as BS
21−import qualified Data.List as L
22−import Data.Maybe
23import GHC.Generics ( Generic )
21import GHC.Generics ( Generic )
24−import Language.Nix.PrettyPrinting as PP
25import System.Directory
22import System.Directory
26import System.Environment
23import System.Environment
27import System.Exit
24import System.Exit
@@ -59,7 +56,6 @@ data DerivationSource = DerivationSource
59 , derivUrl :: String -- ^ URL to fetch from.
56 , derivUrl :: String -- ^ URL to fetch from.
60 , derivRevision :: String -- ^ Revision to use. Leave empty if the fetcher doesn't support revisions.
57 , derivRevision :: String -- ^ Revision to use. Leave empty if the fetcher doesn't support revisions.
61 , derivHash :: String -- ^ The hash of the source.
58 , derivHash :: String -- ^ The hash of the source.
62− , derivSubmodule :: Maybe Bool -- ^ The fetchSubmodule setting (if any)
63 }
59 }
64 deriving (Show, Eq, Ord, Generic)
60 deriving (Show, Eq, Ord, Generic)
65
61
@@ -70,46 +66,22 @@ instance FromJSON DerivationSource where
70 <$> o .: "url"
66 <$> o .: "url"
71 <*> o .: "rev"
67 <*> o .: "rev"
72 <*> o .: "sha256"
68 <*> o .: "sha256"
73− <*> o .: "fetchSubmodules"
74 parseJSON _ = error "invalid DerivationSource"
69 parseJSON _ = error "invalid DerivationSource"
75
70
76−instance PP.Pretty DerivationSource where
77− pPrint DerivationSource {..} =
78− let isHackagePackage = "mirror://hackage/" `L.isPrefixOf` derivUrl
79− fetched = derivKind /= ""
80− in if isHackagePackage then attr "sha256" $ string derivHash
81− else if not fetched then attr "src" $ text derivUrl
82− else vcat
83− [ text "src" <+> equals <+> text ("fetch" ++ derivKind) <+> lbrace
84− , nest 2 $ vcat
85− [ attr "url" $ string derivUrl
86− , attr "sha256" $ string derivHash
87− , if derivRevision /= "" then attr "rev" (string derivRevision) else PP.empty
88− , boolattr "fetchSubmodules" (isJust derivSubmodule) (fromJust derivSubmodule)
89− ]
90− , rbrace PP.<> semi
91− ]
92−
93−
94−urlDerivationSource :: String -> String -> DerivationSource
95−urlDerivationSource url hash = DerivationSource "url" url "" hash Nothing
96−
97fromDerivationSource :: DerivationSource -> Source
71fromDerivationSource :: DerivationSource -> Source
98fromDerivationSource DerivationSource{..} = Source derivUrl derivRevision (Certain derivHash) "."
72fromDerivationSource DerivationSource{..} = Source derivUrl derivRevision (Certain derivHash) "."
99
73
100-- | Fetch a source, trying any of the various nix-prefetch-* scripts.
74-- | Fetch a source, trying any of the various nix-prefetch-* scripts.
101−fetch :: forall a.
102− Bool -- ^ If True, fetch submodules when the source is a git repository
103− -> (String -> MaybeT IO a) -- ^ This function is passed the output path name as an argument.
75+fetch :: forall a. (String -> MaybeT IO a) -- ^ This function is passed the output path name as an argument.
104 -- It should return 'Nothing' if the file doesn't match the expected format.
76 -- It should return 'Nothing' if the file doesn't match the expected format.
105 -- This is required, because we cannot always check if a download succeeded otherwise.
77 -- This is required, because we cannot always check if a download succeeded otherwise.
106 -> Source -- ^ The source to fetch from.
78 -> Source -- ^ The source to fetch from.
107 -> IO (Maybe (DerivationSource, a)) -- ^ The derivation source and the result of the processing function. Returns Nothing if the download failed.
79 -> IO (Maybe (DerivationSource, a)) -- ^ The derivation source and the result of the processing function. Returns Nothing if the download failed.
108−fetch optSubModules f = runMaybeT . fetchers where
80+fetch f = runMaybeT . fetchers where
109 fetchers :: Source -> MaybeT IO (DerivationSource, a)
81 fetchers :: Source -> MaybeT IO (DerivationSource, a)
110 fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process)
82 fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process)
111 [ (False, "url", [])
83 [ (False, "url", [])
112− , (True, "git", ["--fetch-submodules" | optSubModules ])
84+ , (True, "git", ["--fetch-submodules"])
113 , (True, "hg", [])
85 , (True, "hg", [])
114 , (True, "svn", [])
86 , (True, "svn", [])
115 , (True, "bzr", [])
87 , (True, "bzr", [])
@@ -128,19 +100,17 @@ fetch optSubModules f = runMaybeT . fetchers where
128 guard $ existsDir || existsFile
100 guard $ existsDir || existsFile
129 let path' | '/' `elem` path = path
101 let path' | '/' `elem` path = path
130 | otherwise = "./" ++ path
102 | otherwise = "./" ++ path
131− process (localDerivationSource path', path') <|> localArchive path'
103+ process (DerivationSource "" path' "" "", path') <|> localArchive path'
132
104
133 localArchive :: FilePath -> MaybeT IO (DerivationSource, a)
105 localArchive :: FilePath -> MaybeT IO (DerivationSource, a)
134 localArchive path = do
106 localArchive path = do
135 absolutePath <- liftIO $ canonicalizePath path
107 absolutePath <- liftIO $ canonicalizePath path
136 unpacked <- snd <$> fetchWith (False, "url", ["--unpack"]) (Source ("file://" ++ absolutePath) "" UnknownHash ".")
108 unpacked <- snd <$> fetchWith (False, "url", ["--unpack"]) (Source ("file://" ++ absolutePath) "" UnknownHash ".")
137− process (localDerivationSource absolutePath, unpacked)
109+ process (DerivationSource "" absolutePath "" "", unpacked)
138
110
139 process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a)
111 process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a)
140 process (derivSource, file) = (,) derivSource <$> f file
112 process (derivSource, file) = (,) derivSource <$> f file
141
113
142− localDerivationSource p = DerivationSource "" p "" "" Nothing
143−
144-- | Like 'fetch', but allows to specify which script to use.
114-- | Like 'fetch', but allows to specify which script to use.
145fetchWith :: (Bool, String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)
115fetchWith :: (Bool, String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)
146fetchWith (supportsRev, kind, addArgs) source = do
116fetchWith (supportsRev, kind, addArgs) source = do
@@ -161,19 +131,11 @@ fetchWith (supportsRev, kind, addArgs) source = do
161 ExitFailure _ -> return Nothing
131 ExitFailure _ -> return Nothing
162 ExitSuccess -> do
132 ExitSuccess -> do
163 buf <- BS.hGetContents stdoutH
133 buf <- BS.hGetContents stdoutH
164− let (l,ls) = case reverse (BS.lines buf) of
134+ 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)
135 buf' = BS.unlines (reverse ls)
168 case length ls of
136 case length ls of
169 0 -> return Nothing
137 0 -> return Nothing
170− 1 -> return (Just (DerivationSource { derivKind = kind
138+ 1 -> return (Just (DerivationSource kind (sourceUrl source) "" (BS.unpack (head ls)) , sourceUrl source))
171− , derivUrl = sourceUrl source
172− , derivRevision = ""
173− , derivHash = BS.unpack (head ls)
174− , derivSubmodule = Nothing
175− }
176− , sourceUrl source))
177 _ -> case eitherDecode buf' of
139 _ -> case eitherDecode buf' of
178 Left err -> error ("invalid JSON: " ++ err ++ " in " ++ show buf')
140 Left err -> error ("invalid JSON: " ++ err ++ " in " ++ show buf')
179 Right ds -> return (Just (ds { derivKind = kind }, BS.unpack l))
141 Right ds -> return (Just (ds { derivKind = kind }, BS.unpack l))
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+17−8
@@ -7,7 +7,7 @@
7module Distribution.Nixpkgs.Haskell.Derivation
7module Distribution.Nixpkgs.Haskell.Derivation
8 ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
8 ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
9 , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
9 , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
10− , cabalFlags, runHaddock, jailbreak, doCheck, doBenchmark, testTarget, hyperlinkSource, enableSplitObjs
10+ , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
11 , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
11 , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
12 , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
12 , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
13 )
13 )
@@ -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
@@ -55,7 +55,6 @@ data Derivation = MkDerivation
55 , _runHaddock :: Bool
55 , _runHaddock :: Bool
56 , _jailbreak :: Bool
56 , _jailbreak :: Bool
57 , _doCheck :: Bool
57 , _doCheck :: Bool
58− , _doBenchmark :: Bool
59 , _testTarget :: String
58 , _testTarget :: String
60 , _hyperlinkSource :: Bool
59 , _hyperlinkSource :: Bool
61 , _enableLibraryProfiling :: Bool
60 , _enableLibraryProfiling :: Bool
@@ -87,7 +86,6 @@ nullDerivation = MkDerivation
87 , _runHaddock = error "undefined Derivation.runHaddock"
86 , _runHaddock = error "undefined Derivation.runHaddock"
88 , _jailbreak = error "undefined Derivation.jailbreak"
87 , _jailbreak = error "undefined Derivation.jailbreak"
89 , _doCheck = error "undefined Derivation.doCheck"
88 , _doCheck = error "undefined Derivation.doCheck"
90− , _doBenchmark = error "undefined Derivation.doBenchmark"
91 , _testTarget = error "undefined Derivation.testTarget"
89 , _testTarget = error "undefined Derivation.testTarget"
92 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
90 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
93 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
91 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
@@ -112,9 +110,9 @@ instance Pretty Derivation where
112 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
110 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
113 [ text "mkDerivation" <+> lbrace
111 [ text "mkDerivation" <+> lbrace
114 , nest 2 $ vcat
112 , nest 2 $ vcat
115− [ attr "pname" $ doubleQuotes $ pPrint (packageName _pkgid)
113+ [ attr "pname" $ doubleQuotes $ disp (packageName _pkgid)
116− , attr "version" $ doubleQuotes $ pPrint (packageVersion _pkgid)
114+ , attr "version" $ doubleQuotes $ disp (packageVersion _pkgid)
117− , pPrint _src
115+ , sourceAttr _src
118 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
116 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
119 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
117 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
120 , onlyIf (not (null _editedCabalFile) && _revision > 0) $ attr "editedCabalFile" $ string _editedCabalFile
118 , onlyIf (not (null _editedCabalFile) && _revision > 0) $ attr "editedCabalFile" $ string _editedCabalFile
@@ -133,7 +131,6 @@ instance Pretty Derivation where
133 , boolattr "doHaddock" (not _runHaddock) _runHaddock
131 , boolattr "doHaddock" (not _runHaddock) _runHaddock
134 , boolattr "jailbreak" _jailbreak _jailbreak
132 , boolattr "jailbreak" _jailbreak _jailbreak
135 , boolattr "doCheck" (not _doCheck) _doCheck
133 , boolattr "doCheck" (not _doCheck) _doCheck
136− , boolattr "doBenchmark" _doBenchmark _doBenchmark
137 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
134 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
138 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
135 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
139 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
136 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
@@ -151,5 +148,17 @@ instance Pretty Derivation where
151 renderedFlags = [ text "-f" <> (if enable then empty else char '-') <> text (unFlagName f) | (f, enable) <- unFlagAssignment _cabalFlags ]
148 renderedFlags = [ text "-f" <> (if enable then empty else char '-') <> text (unFlagName f) | (f, enable) <- unFlagAssignment _cabalFlags ]
152 ++ map text (toAscList _configureFlags)
149 ++ map text (toAscList _configureFlags)
153 isHackagePackage = "mirror://hackage/" `isPrefixOf` derivUrl _src
150 isHackagePackage = "mirror://hackage/" `isPrefixOf` derivUrl _src
151+ sourceAttr DerivationSource {..}
152+ | isHackagePackage = attr "sha256" $ string derivHash
153+ | derivKind /= "" = vcat
154+ [ text "src" <+> equals <+> text ("fetch" ++ derivKind) <+> lbrace
155+ , nest 2 $ vcat
156+ [ attr "url" $ string derivUrl
157+ , attr "sha256" $ string derivHash
158+ , if derivRevision /= "" then attr "rev" (string derivRevision) else empty
159+ ]
160+ , rbrace <> semi
161+ ]
162+ | otherwise = attr "src" $ text derivUrl
154
163
155 postUnpack = string $ "sourceRoot+=/" ++ _subpath ++ "; echo source root reset to $sourceRoot"
164 postUnpack = string $ "sourceRoot+=/" ++ _subpath ++ "; echo source root reset to $sourceRoot"
src/Distribution/Nixpkgs/Haskell/FromCabal.hs+13−22
@@ -11,6 +11,7 @@ import Data.Maybe
11import Data.Set ( Set )
11import Data.Set ( Set )
12import qualified Data.Set as Set
12import qualified Data.Set as Set
13import Distribution.Compiler
13import Distribution.Compiler
14+import Distribution.License
14import Distribution.Nixpkgs.Haskell
15import Distribution.Nixpkgs.Haskell
15import qualified Distribution.Nixpkgs.Haskell as Nix
16import qualified Distribution.Nixpkgs.Haskell as Nix
16import Distribution.Nixpkgs.Haskell.Constraint
17import Distribution.Nixpkgs.Haskell.Constraint
@@ -58,14 +59,14 @@ finalizeGenericPackageDescription haskellResolver arch compiler flags constraint
58 }
59 }
59
60
60 jailbroken :: HaskellResolver -> HaskellResolver
61 jailbroken :: HaskellResolver -> HaskellResolver
61− jailbroken resolver (Dependency pkg _ _) = resolver (Dependency pkg anyVersion mempty)
62+ jailbroken resolver (Dependency pkg _) = resolver (Dependency pkg anyVersion)
62
63
63 withInternalLibs :: HaskellResolver -> HaskellResolver
64 withInternalLibs :: HaskellResolver -> HaskellResolver
64 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
65 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
65
66
66 internalNames :: [PackageName]
67 internalNames :: [PackageName]
67 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
68 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
68− ++ [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries (packageDescription genDesc) ]
69+ ++ [ unqualComponentNameToPackageName n | Just n <- libName <$> subLibraries (packageDescription genDesc) ]
69
70
70 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
71 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
71 Left m -> case finalize (const True) of
72 Left m -> case finalize (const True) of
@@ -91,7 +92,6 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
91 & runHaddock .~ doHaddockPhase
92 & runHaddock .~ doHaddockPhase
92 & jailbreak .~ False
93 & jailbreak .~ False
93 & doCheck .~ True
94 & doCheck .~ True
94− & doBenchmark .~ False
95 & testTarget .~ mempty
95 & testTarget .~ mempty
96 & hyperlinkSource .~ True
96 & hyperlinkSource .~ True
97 & enableSplitObjs .~ True
97 & enableSplitObjs .~ True
@@ -108,7 +108,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
108 & Nix.description .~ synopsis
108 & Nix.description .~ synopsis
109 & Nix.license .~ nixLicense
109 & Nix.license .~ nixLicense
110 & Nix.platforms .~ Nix.allKnownPlatforms
110 & Nix.platforms .~ Nix.allKnownPlatforms
111− & Nix.hydraPlatforms .~ (if isFreeLicense nixLicense then Nix.allKnownPlatforms else Set.empty)
111+ & Nix.hydraPlatforms .~ (if nixLicense == Nix.Known "stdenv.lib.licenses.unfree" then Set.empty else Nix.allKnownPlatforms)
112 & Nix.maintainers .~ mempty
112 & Nix.maintainers .~ mempty
113 & Nix.broken .~ not (null missingDeps)
113 & Nix.broken .~ not (null missingDeps)
114 )
114 )
@@ -116,39 +116,30 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
116 xrev = maybe 0 read (lookup "x-revision" customFieldsPD)
116 xrev = maybe 0 read (lookup "x-revision" customFieldsPD)
117
117
118 nixLicense :: Nix.License
118 nixLicense :: Nix.License
119− nixLicense = either fromSPDXLicense fromCabalLicense licenseRaw
119+ nixLicense = fromCabalLicense (either licenseFromSPDX id 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
126− -- derivation 'foo' as 'pkgs.foo', because they live in the 'haskellPackages'
127− -- name space -- not on the top level. Therefore, we built our Nixpkgs lookup
128− -- function so that top level names are returned as 'pkgs.foo'. As a result, we
129− -- end up pre-pending that path to all kinds of names all over the place. I
130− -- suppose the correct approach would be to assume that the lookup function
131− -- returns names that live in the top-level and to adapt the code in
132− -- PostProcess.hs et all to that fact.
133 goodScopes :: Set [Identifier]
125 goodScopes :: Set [Identifier]
134 goodScopes = Set.fromList (map ("pkgs":) [[], ["xorg"], ["xlibs"], ["gnome2"], ["gnome"], ["gnome3"], ["kde4"]])
126 goodScopes = Set.fromList (map ("pkgs":) [[], ["xorg"], ["xlibs"], ["gnome2"], ["gnome"], ["gnome3"], ["kde4"]])
135
127
136 resolveInNixpkgs :: Identifier -> Binding
128 resolveInNixpkgs :: Identifier -> Binding
137 resolveInNixpkgs i
129 resolveInNixpkgs i
138 | i `elem` ["clang","lldb","llvm"] = binding # (i, path # ["self","llvmPackages",i]) -- TODO: evil!
130 | i `elem` ["clang","lldb","llvm"] = binding # (i, path # ["self","llvmPackages",i]) -- TODO: evil!
139− | i == "gtk2" = binding # (i, path # ["pkgs","gtk2"]) -- TODO: these cases should not be necessary
131+ | i == "gtk2" = binding # (i, path # ["pkgs","gnome2","gtk"])
140− | i == "gtk3" = binding # (i, path # ["pkgs","gtk3"])
132+ | i == "gtk3" = binding # (i, path # ["pkgs","gnome3","gtk"])
141− | i == "gtksourceview3" = binding # (i, path # ["pkgs","gtksourceview3"])
133+ | i == "gtksourceview3" = binding # (i, path # ["pkgs","gnome3","gtksourceview"])
142− | i == "vte_291" = binding # (i, path # ["pkgs","vte"])
143 | Just p <- nixpkgsResolver i, init (view (reference . path) p) `Set.member` goodScopes = p
134 | Just p <- nixpkgsResolver i, init (view (reference . path) p) `Set.member` goodScopes = p
144 | otherwise = bindNull i
135 | otherwise = bindNull i
145
136
146 resolveInHackageThenNixpkgs :: Identifier -> Binding
137 resolveInHackageThenNixpkgs :: Identifier -> Binding
147− resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion mempty) = resolveInHackage i
138+ resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion) = resolveInHackage i
148 | otherwise = resolveInNixpkgs i
139 | otherwise = resolveInNixpkgs i
149
140
150 internalLibNames :: [PackageName]
141 internalLibNames :: [PackageName]
151− internalLibNames = [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries ]
142+ internalLibNames = fmap unqualComponentNameToPackageName . catMaybes $ libName <$> subLibraries
152
143
153 doHaddockPhase :: Bool
144 doHaddockPhase :: Bool
154 doHaddockPhase | not (null internalLibNames) = False
145 doHaddockPhase | not (null internalLibNames) = False
@@ -158,7 +149,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
158 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
149 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
159 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
150 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
160 convertBuildInfo Cabal.BuildInfo {..} = mempty
151 convertBuildInfo Cabal.BuildInfo {..} = mempty
161− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- targetBuildDepends, x `notElem` internalLibNames ]
152+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- targetBuildDepends, x `notElem` internalLibNames ]
162 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
153 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
163 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
154 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
164 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
155 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
@@ -166,7 +157,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
166
157
167 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
158 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
168 convertSetupBuildInfo bi = mempty
159 convertSetupBuildInfo bi = mempty
169− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- Cabal.setupDepends bi ]
160+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- Cabal.setupDepends bi ]
170
161
171bindNull :: Identifier -> Binding
162bindNull :: Identifier -> Binding
172bindNull i = binding # (i, path # ["null"])
163bindNull i = binding # (i, path # ["null"])
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+32−28
@@ -1,21 +1,16 @@
1{-# LANGUAGE RecordWildCards #-}
1{-# LANGUAGE RecordWildCards #-}
2+{-# LANGUAGE CPP #-}
2{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE DeriveGeneric #-}
5{-# LANGUAGE DeriveGeneric #-}
5{-# OPTIONS_GHC -fno-warn-orphans #-}
6{-# OPTIONS_GHC -fno-warn-orphans #-}
6
7
7−module Distribution.Nixpkgs.Haskell.FromCabal.Configuration
8+module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
8− ( Configuration(..), readConfiguration, assertConsistency
9− )
10− where
11
9
12−import Prelude hiding ( fail )
13−
14−import Control.DeepSeq
15import Control.Exception ( throwIO )
10import Control.Exception ( throwIO )
11+import Control.DeepSeq
16import Control.Lens
12import Control.Lens
17−import Control.Monad hiding ( fail )
13+import Control.Monad
18−import Control.Monad.Fail
19import Data.Aeson
14import Data.Aeson
20import Data.Map as Map
15import Data.Map as Map
21import Data.Set as Set
16import Data.Set as Set
@@ -45,22 +40,14 @@ data Configuration = Configuration
45 -- role during dependency resolution.
40 -- role during dependency resolution.
46 , extraPackages :: [Constraint]
41 , extraPackages :: [Constraint]
47
42
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+
48 -- |This information is used by the @hackage2nix@ utility to determine the
48 -- |This information is used by the @hackage2nix@ utility to determine the
49 -- 'maintainers' for a given Haskell package.
49 -- 'maintainers' for a given Haskell package.
50 , packageMaintainers :: Map Identifier (Set PackageName)
50 , 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]
64 }
51 }
65 deriving (Show, Generic)
52 deriving (Show, Generic)
66
53
@@ -72,33 +59,50 @@ instance FromJSON Configuration where
72 <*> o .:? "core-packages" .!= mempty
59 <*> o .:? "core-packages" .!= mempty
73 <*> o .:? "default-package-overrides" .!= mempty
60 <*> o .:? "default-package-overrides" .!= mempty
74 <*> o .:? "extra-packages" .!= mempty
61 <*> o .:? "extra-packages" .!= mempty
75− <*> o .:? "package-maintainers" .!= mempty
76− <*> o .:? "unsupported-platforms" .!= mempty
77 <*> o .:? "dont-distribute-packages" .!= mempty
62 <*> o .:? "dont-distribute-packages" .!= mempty
78− <*> o .:? "broken-packages" .!= mempty
63+ <*> o .:? "package-maintainers" .!= mempty
79 parseJSON _ = error "invalid Configuration"
64 parseJSON _ = error "invalid Configuration"
80
65
81instance FromJSON Identifier where
66instance FromJSON Identifier where
82 parseJSON (String s) = pure (review ident (T.unpack s))
67 parseJSON (String s) = pure (review ident (T.unpack s))
83 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Nix identifier")
68 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Nix identifier")
84
69
70+#if MIN_VERSION_aeson(1,0,0)
71+
85instance FromJSONKey Identifier where
72instance FromJSONKey Identifier where
86 fromJSONKey = FromJSONKeyText parseKey
73 fromJSONKey = FromJSONKeyText parseKey
87
74
88instance FromJSONKey PackageName where
75instance FromJSONKey PackageName where
89 fromJSONKey = FromJSONKeyText parseKey
76 fromJSONKey = FromJSONKeyText parseKey
90
77
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+
91parseKey :: FromJSON k => Text -> k
93parseKey :: FromJSON k => Text -> k
92parseKey s = either error id (parseEither parseJSON (String s))
94parseKey s = either error id (parseEither parseJSON (String s))
93
95
94readConfiguration :: FilePath -> IO Configuration
96readConfiguration :: FilePath -> IO Configuration
97+readConfiguration path =
95−readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency
98+ decodeFileEither path >>= either throwIO assertConsistency
96
99
97−assertConsistency :: MonadFail m => Configuration -> m Configuration
100+assertConsistency :: Monad m => Configuration -> m Configuration
98assertConsistency cfg@Configuration {..} = do
101assertConsistency cfg@Configuration {..} = do
99 let report msg = fail ("*** configuration error: " ++ msg)
102 let report msg = fail ("*** configuration error: " ++ msg)
103+
100 maintainedPackages = Set.unions (Map.elems packageMaintainers)
104 maintainedPackages = Set.unions (Map.elems packageMaintainers)
101− disabledPackages = dontDistributePackages `Set.union` Set.fromList (depPkgName <$> brokenPackages)
105+ disabledPackages = Map.keysSet dontDistributePackages
102 disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages
106 disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages
103 unless (Set.null disabledMaintainedPackages) $
107 unless (Set.null disabledMaintainedPackages) $
104 report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
108 report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+17−18
@@ -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,25 +15,30 @@ 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"]
23 | name == "diagrams-builder" = [enable "cairo", enable "svg", enable "ps", enable "rasterific"]
21 | name == "diagrams-builder" = [enable "cairo", enable "svg", enable "ps", enable "rasterific"]
24− | name == "fltkhs" = [enable "opengl"]
25 | name == "folds" = [disable "test-hlint"]
22 | name == "folds" = [disable "test-hlint"]
26 | name == "git-annex" = [ enable "assistant"
23 | name == "git-annex" = [ enable "assistant"
27− , disable "benchmark"
24+ , enable "cryptonite"
28 , enable "dbus"
25 , enable "dbus"
29− , disable "debuglocks"
26+ , enable "desktopnotify"
30− , enable "magicmime"
27+ , enable "dns"
31− , enable "networkbsd"
28+ , enable "feed"
29+ , enable "inotify"
32 , enable "pairing"
30 , enable "pairing"
33 , enable "production"
31 , enable "production"
34− , enable "s3"
32+ , enable "quvi"
33+ , disable "s3"
34+ , enable "tahoe"
35+ , enable "tdfa"
36+ , ("testsuite", version `withinRange` "< 6.20170925 || >= 6.20171214")
35 , enable "torrentparser"
37 , enable "torrentparser"
36− , enable "webapp"
38+ , disable "webapp"
39+ , disable "webapp-secure"
37 , enable "webdav"
40 , enable "webdav"
41+ , enable "xmpp"
38 ]
42 ]
39 | name == "haskeline" = [enable "terminfo"]
43 | name == "haskeline" = [enable "terminfo"]
40 | name == "haste-compiler" = [enable "portable"]
44 | name == "haste-compiler" = [enable "portable"]
@@ -42,27 +46,22 @@ configureCabalFlags' (PackageIdentifier name version)
42 | name == "hlibsass" && version >= mkVersion [0,1,5]
46 | name == "hlibsass" && version >= mkVersion [0,1,5]
43 = [enable "externalLibsass"]
47 = [enable "externalLibsass"]
44 | name == "hmatrix" = [enable "openblas", enable "disable-default-paths"]
48 | name == "hmatrix" = [enable "openblas", enable "disable-default-paths"]
45− | name == "hslua" = [enable "system-lua", disable "use-pkgconfig"]
49+ | name == "hslua" = [enable "system-lua"]
46 | name == "idris" = [enable "gmp", enable "ffi", enable "curses", ("execonly", version `withinRange` orLaterVersion (mkVersion [1,1,1])) ]
50 | name == "idris" = [enable "gmp", enable "ffi", enable "curses", ("execonly", version `withinRange` orLaterVersion (mkVersion [1,1,1])) ]
47 | name == "io-streams" = [enable "NoInteractiveTests"]
51 | name == "io-streams" = [enable "NoInteractiveTests"]
48 | name == "liquid-fixpoint" = [enable "build-external"]
52 | name == "liquid-fixpoint" = [enable "build-external"]
49 | name == "pandoc" = [enable "https", disable "trypandoc"]
53 | name == "pandoc" = [enable "https", disable "trypandoc"]
50− | name == "pandoc-placetable" = [enable "inlineMarkdown"]
51 | name == "persistent-sqlite" = [enable "systemlib"]
54 | name == "persistent-sqlite" = [enable "systemlib"]
52 | name == "reactive-banana-wx" = [disable "buildExamples"]
55 | name == "reactive-banana-wx" = [disable "buildExamples"]
53 | name == "snap-server" = [enable "openssl"]
56 | name == "snap-server" = [enable "openssl"]
54− | name == "stack" = [enable "disable-git-info", enable "hide-dependency-versions", enable "supported-build"]
55 | name == "xmobar" = [enable "with_alsa", enable "with_conduit", enable "with_datezone", enable "with_dbus", enable "with_inotify", enable "with_iwlib", enable "with_mpd", enable "with_mpris", enable "with_rtsopts", enable "with_threaded", enable "with_utf8", enable "with_uvmeter", enable "with_weather", enable "with_xft", enable "with_xpm"]
57 | name == "xmobar" = [enable "with_alsa", enable "with_conduit", enable "with_datezone", enable "with_dbus", enable "with_inotify", enable "with_iwlib", enable "with_mpd", enable "with_mpris", enable "with_rtsopts", enable "with_threaded", enable "with_utf8", enable "with_uvmeter", enable "with_weather", enable "with_xft", enable "with_xpm"]
56 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
58 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
57− | name == "yaml" = [("system-libyaml", version >= "0.10.1.1")]
59+ | name == "yaml" = [enable "system-libyaml"]
58 | name == "yi" = [enable "pango", enable "vty"]
60 | name == "yi" = [enable "pango", enable "vty"]
59 | otherwise = []
61 | otherwise = []
60
62
61enable :: String -> (FlagName,Bool)
63enable :: String -> (FlagName,Bool)
62−enable name = (mkFlagName' name, True)
64+enable name = (mkFlagName name, True)
63
65
64disable :: String -> (FlagName,Bool)
66disable :: String -> (FlagName,Bool)
65−disable name = (mkFlagName' name, False)
67+disable name = (mkFlagName name, False)
66−
67−mkFlagName' :: String -> FlagName
68−mkFlagName' = mkFlagName . map toLower
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+3−133
@@ -1,17 +1,11 @@
1{-# LANGUAGE ViewPatterns #-}
1{-# LANGUAGE ViewPatterns #-}
2
2
3−module Distribution.Nixpkgs.Haskell.FromCabal.License
3+module Distribution.Nixpkgs.Haskell.FromCabal.License ( fromCabalLicense ) where
4− ( fromCabalLicense
5− , fromSPDXLicense
6− , isFreeLicense
7− ) where
8
4
9−import Data.List (intercalate)
10−import Distribution.License ( License(..), knownLicenses )
11import Distribution.Nixpkgs.License
5import Distribution.Nixpkgs.License
12−import Distribution.Pretty (prettyShow)
6+import Distribution.License ( License(..), knownLicenses )
13−import qualified Distribution.SPDX as SPDX
14import Distribution.Text (display)
7import Distribution.Text (display)
8+import Data.List (intercalate)
15import Distribution.Version
9import Distribution.Version
16
10
17-- TODO: Programmatically strip trailing zeros from license version numbers.
11-- TODO: Programmatically strip trailing zeros from license version numbers.
@@ -42,129 +36,5 @@ fromCabalLicense (Apache (Just (versionNumbers -> [2,0]))) = Known "stdenv.lib.l
42fromCabalLicense ISC = Known "stdenv.lib.licenses.isc"
36fromCabalLicense ISC = Known "stdenv.lib.licenses.isc"
43fromCabalLicense OtherLicense = Unknown Nothing
37fromCabalLicense OtherLicense = Unknown Nothing
44fromCabalLicense (UnknownLicense "CC0-1.0") = Known "stdenv.lib.licenses.cc0"
38fromCabalLicense (UnknownLicense "CC0-1.0") = Known "stdenv.lib.licenses.cc0"
45−fromCabalLicense (UnknownLicense "BSD3ClauseORApache20") = Known "stdenv.lib.licenses.bsd3"
46fromCabalLicense l = error $ "Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown license"
39fromCabalLicense l = error $ "Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown license"
47 ++ show l ++"\nChoose one of: " ++ intercalate ", " (map display knownLicenses)
40 ++ show l ++"\nChoose one of: " ++ intercalate ", " (map display knownLicenses)
48−
49−fromSPDXLicense :: SPDX.License -> Distribution.Nixpkgs.License.License
50−fromSPDXLicense SPDX.NONE = Unknown Nothing
51−fromSPDXLicense (SPDX.License expr) =
52− case expr of
53− SPDX.ELicense simpl Nothing ->
54− -- Not handled: license exceptions
55− case simpl of
56− SPDX.ELicenseId lid ->
57− case lid of
58− SPDX.AFL_2_1 -> Known "stdenv.lib.licenses.afl21"
59− SPDX.AFL_3_0 -> Known "stdenv.lib.licenses.afl3"
60− SPDX.AGPL_3_0_only -> Known "stdenv.lib.licenses.agpl3"
61− SPDX.AGPL_3_0_or_later -> Known "stdenv.lib.licenses.agpl3Plus"
62− SPDX.APSL_2_0 -> Known "stdenv.lib.licenses.apsl20"
63− SPDX.Artistic_1_0 -> Known "stdenv.lib.licenses.artistic1"
64− SPDX.Artistic_2_0 -> Known "stdenv.lib.licenses.artistic2"
65− SPDX.Apache_2_0 -> Known "stdenv.lib.licenses.asl20"
66− SPDX.BSL_1_0 -> Known "stdenv.lib.licenses.boost"
67− SPDX.Beerware -> Known "stdenv.lib.licenses.beerware"
68− SPDX.NullBSD -> Known "stdenv.lib.licenses.bsd0"
69− SPDX.BSD_2_Clause -> Known "stdenv.lib.licenses.bsd2"
70− SPDX.BSD_3_Clause -> Known "stdenv.lib.licenses.bsd3"
71− SPDX.BSD_4_Clause -> Known "stdenv.lib.licenses.bsdOriginal"
72− SPDX.ClArtistic -> Known "stdenv.lib.licenses.clArtistic"
73− SPDX.CC0_1_0 -> Known "stdenv.lib.licenses.cc0"
74− SPDX.CC_BY_NC_SA_2_0 -> Known "stdenv.lib.licenses.cc-by-nc-sa-20"
75− SPDX.CC_BY_NC_SA_2_5 -> Known "stdenv.lib.licenses.cc-by-nc-sa-25"
76− SPDX.CC_BY_NC_SA_3_0 -> Known "stdenv.lib.licenses.cc-by-nc-sa-30"
77− SPDX.CC_BY_NC_SA_4_0 -> Known "stdenv.lib.licenses.cc-by-nc-sa-40"
78− SPDX.CC_BY_NC_4_0 -> Known "stdenv.lib.licenses.cc-by-nc-40"
79− SPDX.CC_BY_ND_3_0 -> Known "stdenv.lib.licenses.cc-by-nd-30"
80− SPDX.CC_BY_SA_2_5 -> Known "stdenv.lib.licenses.cc-by-sa-25"
81− SPDX.CC_BY_3_0 -> Known "stdenv.lib.licenses.cc-by-30"
82− SPDX.CC_BY_SA_3_0 -> Known "stdenv.lib.licenses.cc-by-sa-30"
83− SPDX.CC_BY_4_0 -> Known "stdenv.lib.licenses.cc-by-40"
84− SPDX.CC_BY_SA_4_0 -> Known "stdenv.lib.licenses.cc-by-sa-40"
85− SPDX.CDDL_1_0 -> Known "stdenv.lib.licenses.cddl"
86− SPDX.CECILL_2_0 -> Known "stdenv.lib.licenses.cecill20"
87− SPDX.CECILL_B -> Known "stdenv.lib.licenses.cecill-b"
88− SPDX.CECILL_C -> Known "stdenv.lib.licenses.cecill-c"
89− SPDX.CPAL_1_0 -> Known "stdenv.lib.licenses.cpal10"
90− SPDX.CPL_1_0 -> Known "stdenv.lib.licenses.cpl10"
91− SPDX.Curl -> Known "stdenv.lib.licenses.curl"
92− SPDX.DOC -> Known "stdenv.lib.licenses.doc"
93− SPDX.EFL_1_0 -> Known "stdenv.lib.licenses.efl10"
94− SPDX.EFL_2_0 -> Known "stdenv.lib.licenses.efl20"
95− SPDX.EPL_1_0 -> Known "stdenv.lib.licenses.epl10"
96− SPDX.EPL_2_0 -> Known "stdenv.lib.licenses.epl20"
97− SPDX.EUPL_1_1 -> Known "stdenv.lib.licenses.eupl11"
98− SPDX.GFDL_1_2_only -> Known "stdenv.lib.licenses.fdl12"
99− SPDX.GFDL_1_3_only -> Known "stdenv.lib.licenses.fdl13"
100− SPDX.GPL_1_0_only -> Known "stdenv.lib.licenses.gpl1"
101− SPDX.GPL_1_0_or_later -> Known "stdenv.lib.licenses.gpl1Plus"
102− SPDX.GPL_2_0_only -> Known "stdenv.lib.licenses.gpl2"
103− SPDX.GPL_2_0_or_later -> Known "stdenv.lib.licenses.gpl2Plus"
104− SPDX.GPL_3_0_only -> Known "stdenv.lib.licenses.gpl3"
105− SPDX.GPL_3_0_or_later -> Known "stdenv.lib.licenses.gpl3Plus"
106− SPDX.HPND -> Known "stdenv.lib.licenses.hpnd"
107− SPDX.IJG -> Known "stdenv.lib.licenses.ijg"
108− SPDX.ImageMagick -> Known "stdenv.lib.licenses.imagemagick"
109− SPDX.IPA -> Known "stdenv.lib.licenses.ipa"
110− SPDX.IPL_1_0 -> Known "stdenv.lib.licenses.ipl10"
111− SPDX.ISC -> Known "stdenv.lib.licenses.isc"
112− SPDX.JasPer_2_0 -> Known "stdenv.lib.licenses.jasper"
113− SPDX.LGPL_2_0_only -> Known "stdenv.lib.licenses.lgpl2"
114− SPDX.LGPL_2_0_or_later -> Known "stdenv.lib.licenses.lgpl2Plus"
115− SPDX.LGPL_2_1_only -> Known "stdenv.lib.licenses.lgpl21"
116− SPDX.LGPL_2_1_or_later -> Known "stdenv.lib.licenses.lgpl21Plus"
117− SPDX.LGPL_3_0_only -> Known "stdenv.lib.licenses.lgpl3"
118− SPDX.LGPL_3_0_or_later -> Known "stdenv.lib.licenses.lgpl3Plus"
119− SPDX.Libpng -> Known "stdenv.lib.licenses.libpng"
120− SPDX.Libtiff -> Known "stdenv.lib.licenses.libtiff"
121− SPDX.LPPL_1_2 -> Known "stdenv.lib.licenses.lppl12"
122− SPDX.LPPL_1_3c -> Known "stdenv.lib.licenses.lppl13c"
123− SPDX.LPL_1_02 -> Known "stdenv.lib.licenses.lpl-102"
124− SPDX.MIT -> Known "stdenv.lib.licenses.mit"
125− SPDX.MPL_1_0 -> Known "stdenv.lib.licenses.mpl10"
126− SPDX.MPL_1_1 -> Known "stdenv.lib.licenses.mpl11"
127− SPDX.MPL_2_0 -> Known "stdenv.lib.licenses.mpl20"
128− SPDX.MS_PL -> Known "stdenv.lib.licenses.mspl"
129− SPDX.NCSA -> Known "stdenv.lib.licenses.ncsa"
130− SPDX.NPOSL_3_0 -> Known "stdenv.lib.licenses.nposl3"
131− SPDX.OFL_1_1 -> Known "stdenv.lib.licenses.ofl"
132− SPDX.OLDAP_2_8 -> Known "stdenv.lib.licenses.openldap"
133− SPDX.OpenSSL -> Known "stdenv.lib.licenses.openssl"
134− SPDX.OSL_2_1 -> Known "stdenv.lib.licenses.osl21"
135− SPDX.OSL_3_0 -> Known "stdenv.lib.licenses.osl3"
136− SPDX.PHP_3_01 -> Known "stdenv.lib.licenses.php201"
137− SPDX.PostgreSQL -> Known "stdenv.lib.licenses.postgresql"
138− SPDX.Python_2_0 -> Known "stdenv.lib.licenses.psfl"
139− SPDX.QPL_1_0 -> Known "stdenv.lib.licenses.qpl"
140− SPDX.Ruby -> Known "stdenv.lib.licenses.ruby"
141− SPDX.Sendmail -> Known "stdenv.lib.licenses.sendmail"
142− SPDX.SGI_B_2_0 -> Known "stdenv.lib.licenses.sgi-b-0"
143− SPDX.Sleepycat -> Known "stdenv.lib.licenses.sleepycat"
144− SPDX.TCL -> Known "stdenv.lib.licenses.tcltx"
145− SPDX.Unlicense -> Known "stdenv.lib.licenses.unlicense"
146− SPDX.Vim -> Known "stdenv.lib.licenses.vim"
147− SPDX.VSL_1_0 -> Known "stdenv.lib.licenses.vsl10"
148− SPDX.Watcom_1_0 -> Known "stdenv.lib.licenses.watcom"
149− SPDX.W3C -> Known "stdenv.lib.licenses.w3c"
150− SPDX.WTFPL -> Known "stdenv.lib.licenses.wtfpl"
151− SPDX.Zlib -> Known "stdenv.lib.licenses.zlib"
152− SPDX.ZPL_2_0 -> Known "stdenv.lib.licenses.zpl20"
153− SPDX.ZPL_2_1 -> Known "stdenv.lib.licenses.zpl21"
154− _ ->
155− -- Licence is not in Nixpkgs.
156− -- Use the SPDX expression as a free-form license string.
157− Unknown (Just $ prettyShow expr)
158− _ ->
159− -- Not handed: the '+' suffix and user-defined licences references.
160− -- Use the SPDX expression as a free-form license string.
161− Unknown (Just $ prettyShow expr)
162− _ ->
163− -- Not handled: compound expressions, not expressible in Nixpkgs.
164− -- Use the SPDX expression as a free-form license string.
165− 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+9−23
@@ -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"
@@ -39,7 +38,7 @@ libNixName "cairo-svg" = return "cairo"
39libNixName "crypt" = [] -- provided by glibc
38libNixName "crypt" = [] -- provided by glibc
40libNixName "crypto" = return "openssl"
39libNixName "crypto" = return "openssl"
41libNixName "curses" = return "ncurses"
40libNixName "curses" = return "ncurses"
42−libNixName "dbusmenu-glib-0.4" = return "libdbusmenu"
41+libNixName "dbusmenu-glib-0.4" = return "libdbusmenu-glib"
43libNixName "dbusmenu-gtk3-0.4" = ["libdbusmenu-gtk3", "gtk3"]
42libNixName "dbusmenu-gtk3-0.4" = ["libdbusmenu-gtk3", "gtk3"]
44libNixName "dl" = [] -- provided by glibc
43libNixName "dl" = [] -- provided by glibc
45libNixName "fftw3" = return "fftw"
44libNixName "fftw3" = return "fftw"
@@ -48,7 +47,7 @@ libNixName "gconf" = return "GConf"
48libNixName "gconf-2.0" = return "GConf"
47libNixName "gconf-2.0" = return "GConf"
49libNixName "gdk-2.0" = return "gtk2"
48libNixName "gdk-2.0" = return "gtk2"
50libNixName "gdk-3.0" = return "gtk3"
49libNixName "gdk-3.0" = return "gtk3"
51−libNixName "gdk-pixbuf-2.0" = return "gdk-pixbuf"
50+libNixName "gdk-pixbuf-2.0" = return "gdk_pixbuf"
52libNixName "gdk-x11-2.0" = return "gdk_x11"
51libNixName "gdk-x11-2.0" = return "gdk_x11"
53libNixName "gdk-x11-3.0" = return "gtk3"
52libNixName "gdk-x11-3.0" = return "gtk3"
54libNixName "gio-2.0" = return "glib"
53libNixName "gio-2.0" = return "glib"
@@ -56,11 +55,11 @@ libNixName "GL" = return "libGL"
56libNixName "GLU" = ["libGLU","libGL"]
55libNixName "GLU" = ["libGLU","libGL"]
57libNixName "glut" = ["freeglut","libGLU","libGL"]
56libNixName "glut" = ["freeglut","libGLU","libGL"]
58libNixName "gnome-keyring" = return "gnome-keyring"
57libNixName "gnome-keyring" = return "gnome-keyring"
59−libNixName "gnome-keyring-1" = return "libgnome-keyring"
58+libNixName "gnome-keyring-1" = return "gnome-keyring"
60libNixName "gnome-vfs-2.0" = return "gnome-vfs"
59libNixName "gnome-vfs-2.0" = return "gnome-vfs"
61libNixName "gnome-vfs-module-2.0" = return "gnome-vfs_module"
60libNixName "gnome-vfs-module-2.0" = return "gnome-vfs_module"
62libNixName "gobject-2.0" = return "glib"
61libNixName "gobject-2.0" = return "glib"
63−libNixName "gobject-introspection-1.0" = return "gobject-introspection"
62+libNixName "gobject-introspection-1.0" = return "gobjectIntrospection"
64libNixName "gstreamer-audio-0.10" = return "gst-plugins-base"
63libNixName "gstreamer-audio-0.10" = return "gst-plugins-base"
65libNixName "gstreamer-audio-1.0" = return "gst-plugins-base"
64libNixName "gstreamer-audio-1.0" = return "gst-plugins-base"
66libNixName "gstreamer-base-0.10" = return "gst-plugins-base"
65libNixName "gstreamer-base-0.10" = return "gst-plugins-base"
@@ -85,8 +84,8 @@ libNixName "ImageMagick" = return "imagemagick"
85libNixName "Imlib2" = return "imlib2"
84libNixName "Imlib2" = return "imlib2"
86libNixName "iw" = return "wirelesstools"
85libNixName "iw" = return "wirelesstools"
87libNixName "jack" = return "libjack2"
86libNixName "jack" = return "libjack2"
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.
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.
89−libNixName "javascriptcoregtk-4.0" = return "webkitgtk"
88+libNixName "javascriptcoregtk-4.0" = return "webkitgtk" -- This is the current API, so let it reference an alias for the latest version.
90libNixName "jpeg" = return "libjpeg"
89libNixName "jpeg" = return "libjpeg"
91libNixName "jvm" = return "jdk"
90libNixName "jvm" = return "jdk"
92libNixName "lapack" = return "liblapack"
91libNixName "lapack" = return "liblapack"
@@ -95,26 +94,18 @@ 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"
100−libNixName "libqrencode" = return "qrencode"
101libNixName "libR" = return "R"
97libNixName "libR" = return "R"
102libNixName "libsoup-gnome-2.4" = return "libsoup"
98libNixName "libsoup-gnome-2.4" = return "libsoup"
103libNixName "libsystemd" = return "systemd"
99libNixName "libsystemd" = return "systemd"
104−libNixName "libudev" = return "systemd"
105libNixName "libxml-2.0" = return "libxml2"
100libNixName "libxml-2.0" = return "libxml2"
106libNixName "libzip" = return "libzip"
101libNixName "libzip" = return "libzip"
107libNixName "libzmq" = return "zeromq"
102libNixName "libzmq" = return "zeromq"
108libNixName "m" = [] -- in stdenv
103libNixName "m" = [] -- in stdenv
109libNixName "magic" = return "file"
104libNixName "magic" = return "file"
110libNixName "MagickWand" = return "imagemagick"
105libNixName "MagickWand" = return "imagemagick"
111−libNixName "mnl" = return "libmnl"
112libNixName "mpi" = return "openmpi"
106libNixName "mpi" = return "openmpi"
113libNixName "ncursesw" = return "ncurses"
107libNixName "ncursesw" = return "ncurses"
114libNixName "netsnmp" = return "net_snmp"
108libNixName "netsnmp" = return "net_snmp"
115−libNixName "nix-expr" = return "nix"
116−libNixName "nix-main" = return "nix"
117−libNixName "nix-store" = return "nix"
118libNixName "notify" = return "libnotify"
109libNixName "notify" = return "libnotify"
119libNixName "odbc" = return "unixODBC"
110libNixName "odbc" = return "unixODBC"
120libNixName "openblas" = return "openblasCompat"
111libNixName "openblas" = return "openblasCompat"
@@ -135,10 +126,10 @@ libNixName "Qt5Gui" = return "qt5"
135libNixName "Qt5Qml" = return "qt5"
126libNixName "Qt5Qml" = return "qt5"
136libNixName "Qt5Quick" = return "qt5"
127libNixName "Qt5Quick" = return "qt5"
137libNixName "Qt5Widgets" = return "qt5"
128libNixName "Qt5Widgets" = return "qt5"
138−libNixName "quadprog" = return "QuadProgpp"
139libNixName "rt" = [] -- in glibc
129libNixName "rt" = [] -- in glibc
140libNixName "rtlsdr" = return "rtl-sdr"
130libNixName "rtlsdr" = return "rtl-sdr"
141libNixName "ruby1.8" = return "ruby"
131libNixName "ruby1.8" = return "ruby"
132+libNixName "sane-backends" = return "saneBackends"
142libNixName "sass" = return "libsass"
133libNixName "sass" = return "libsass"
143libNixName "sctp" = return "lksctp-tools" -- This is linux-specific, we should create a common attribute if we ever add sctp support for other systems.
134libNixName "sctp" = return "lksctp-tools" -- This is linux-specific, we should create a common attribute if we ever add sctp support for other systems.
144libNixName "sdl2" = return "SDL2"
135libNixName "sdl2" = return "SDL2"
@@ -153,20 +144,16 @@ libNixName "stdc++.dll" = [] -- What is that?
153libNixName "systemd-journal" = return "systemd"
144libNixName "systemd-journal" = return "systemd"
154libNixName "tag_c" = return "taglib"
145libNixName "tag_c" = return "taglib"
155libNixName "taglib_c" = return "taglib"
146libNixName "taglib_c" = return "taglib"
156−libNixName "tensorflow" = return "libtensorflow"
157libNixName "udev" = return "systemd";
147libNixName "udev" = return "systemd";
158libNixName "uuid" = return "libossp_uuid";
148libNixName "uuid" = return "libossp_uuid";
159−libNixName "vte-2.91" = return "vte_291"
160libNixName "wayland-client" = return "wayland"
149libNixName "wayland-client" = return "wayland"
161libNixName "wayland-cursor" = return "wayland"
150libNixName "wayland-cursor" = return "wayland"
162libNixName "wayland-egl" = return "libGL"
151libNixName "wayland-egl" = return "libGL"
163libNixName "wayland-server" = return "wayland"
152libNixName "wayland-server" = return "wayland"
164−libNixName "webkit2gtk" = return "webkitgtk"
153+libNixName "webkit2gtk-4.0" = return "webkitgtk" -- This is the current API, so let it reference an alias for the latest version.
165−libNixName "webkit2gtk-4.0" = return "webkitgtk"
166−libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk"
154+libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk-web-extension" -- This package doesn't actually exist in nixpkgs at present.
167libNixName "webkitgtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that
155libNixName "webkitgtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that
168libNixName "X11" = return "libX11"
156libNixName "X11" = return "libX11"
169−libNixName "x11" = return "xlibsWrapper"
170libNixName "xau" = return "libXau"
157libNixName "xau" = return "libXau"
171libNixName "Xcursor" = return "libXcursor"
158libNixName "Xcursor" = return "libXcursor"
172libNixName "xerces-c" = return "xercesc"
159libNixName "xerces-c" = return "xercesc"
@@ -182,7 +169,6 @@ libNixName "Xrender" = return "libXrender"
182libNixName "Xss" = return "libXScrnSaver"
169libNixName "Xss" = return "libXScrnSaver"
183libNixName "Xtst" = return "libXtst"
170libNixName "Xtst" = return "libXtst"
184libNixName "Xxf86vm" = return "libXxf86vm"
171libNixName "Xxf86vm" = return "libXxf86vm"
185−libNixName "yaml" = return "libyaml"
186libNixName "yaml-0.1" = return "libyaml"
172libNixName "yaml-0.1" = return "libyaml"
187libNixName "z" = return "zlib"
173libNixName "z" = return "zlib"
188libNixName "zmq" = return "zeromq"
174libNixName "zmq" = return "zeromq"
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+25−87
@@ -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
@@ -56,7 +55,7 @@ fixGtkBuilds drv = drv & dependencies . pkgconfig %~ Set.filter (not . collidesW
56-- for a while packages scraped from Hackage will continue to improperly use
55-- for a while packages scraped from Hackage will continue to improperly use
57-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
56-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
58-- also work for Stack). Until that changes, we provide do this to work around
57-- also work for Stack). Until that changes, we provide do this to work around
59−-- those package's brokenness.
58+-- those package's brokeness.
60fixBuildDependsForTools :: Derivation -> Derivation
59fixBuildDependsForTools :: Derivation -> Derivation
61fixBuildDependsForTools = foldr (.) id
60fixBuildDependsForTools = foldr (.) id
62 [ fmap snd $ runState $ do
61 [ fmap snd $ runState $ do
@@ -76,36 +75,28 @@ hooks =
76 , ("Agda >= 2.5", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agda25PostInstall)
75 , ("Agda >= 2.5", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agda25PostInstall)
77 , ("alex < 3.1.5", set (testDepends . tool . contains (pkg "perl")) True)
76 , ("alex < 3.1.5", set (testDepends . tool . contains (pkg "perl")) True)
78 , ("alex", set (executableDepends . tool . contains (self "happy")) True)
77 , ("alex", set (executableDepends . tool . contains (self "happy")) True)
79− , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
78+ , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux))) , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
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))) , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
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
86 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
85 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
87− , ("cabal2nix > 2", cabal2nixOverrides)
88 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
86 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
89 , ("dbus", set doCheck False) -- don't execute tests that try to access the network
87 , ("dbus", set doCheck False) -- don't execute tests that try to access the network
90 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
88 , ("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)))
89 , ("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"])))
90 , ("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.
94 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
91 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
95 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
92 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
96− , ("gi-gdk", set runHaddock True )
97− , ("gi-gio", set runHaddock True )
98− , ("gi-glib", set runHaddock True )
99 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
93 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
100 , ("gi-gstaudio", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
94 , ("gi-gstaudio", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
101 , ("gi-gstbase", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
95 , ("gi-gstbase", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
102 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
96 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
103− , ("gi-gtk", set runHaddock True )
104 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
97 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
105 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
98 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
106− , ("gi-pango", set runHaddock True )
107 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
99 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
108− , ("gi-vte", set runHaddock True )
109 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
100 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
110 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
101 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
111 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
102 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
@@ -116,7 +107,6 @@ hooks =
116 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
107 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
117 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
108 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
118 , ("gtk3", gtk3Hook)
109 , ("gtk3", gtk3Hook)
119− , ("gtkglext", gtkglextHook)
120 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
110 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
121 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
111 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
122 , ("haskell-src-exts", set doCheck False)
112 , ("haskell-src-exts", set doCheck False)
@@ -127,8 +117,8 @@ hooks =
127 , ("holy-project", set doCheck False) -- attempts to access the network
117 , ("holy-project", set doCheck False) -- attempts to access the network
128 , ("hoogle", set testTarget "--test-option=--no-net")
118 , ("hoogle", set testTarget "--test-option=--no-net")
129 , ("hsignal < 0.2.7.4", set phaseOverrides "prePatch = \"rm -v Setup.lhs\";") -- https://github.com/amcphail/hsignal/issues/1
119 , ("hsignal < 0.2.7.4", set phaseOverrides "prePatch = \"rm -v Setup.lhs\";") -- https://github.com/amcphail/hsignal/issues/1
130− , ("hslua < 0.9.3", over (libraryDepends . system) (replace (pkg "lua") (pkg "lua5_1")))
120+ , ("hslua < 0.9.3", over (libraryDepends . each) (replace (pkg "lua") (pkg "lua5_1")))
131− , ("hslua >= 0.9.3", over (libraryDepends . system) (replace (pkg "lua") (pkg "lua5_3")))
121+ , ("hslua >= 0.9.3", over (libraryDepends . each) (replace (pkg "lua") (pkg "lua5_3")))
132 , ("hspec-core >= 2.4.4", hspecCoreOverrides)
122 , ("hspec-core >= 2.4.4", hspecCoreOverrides)
133 , ("http-client", set doCheck False) -- attempts to access the network
123 , ("http-client", set doCheck False) -- attempts to access the network
134 , ("http-client-openssl >= 0.2.0.1", set doCheck False) -- attempts to access the network
124 , ("http-client-openssl >= 0.2.0.1", set doCheck False) -- attempts to access the network
@@ -148,13 +138,10 @@ hooks =
148 , ("network-attoparsec", set doCheck False) -- test suite requires network access
138 , ("network-attoparsec", set doCheck False) -- test suite requires network access
149 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
139 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
150 , ("opencv", opencvOverrides)
140 , ("opencv", opencvOverrides)
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
141+ , ("pandoc >= 1.16.0.2", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
152− , ("pandoc < 2.6", pandocPre26Overrides)
142+ , ("pandoc", set jailbreak False) -- jailbreak-cabal break the build
153− , ("pandoc >= 2.6", pandocOverrides)
154− , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/369
143+ , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/172
155 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
144 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
156− , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
157− , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
158 , ("qtah-cpp-qt5", set (libraryDepends . system . contains (bind "pkgs.qt5.qtbase")) True)
145 , ("qtah-cpp-qt5", set (libraryDepends . system . contains (bind "pkgs.qt5.qtbase")) True)
159 , ("qtah-qt5", set (libraryDepends . tool . contains (bind "pkgs.qt5.qtbase")) True)
146 , ("qtah-qt5", set (libraryDepends . tool . contains (bind "pkgs.qt5.qtbase")) True)
160 , ("readline", over (libraryDepends . system) (Set.union (pkgs ["readline", "ncurses"])))
147 , ("readline", over (libraryDepends . system) (Set.union (pkgs ["readline", "ncurses"])))
@@ -168,11 +155,10 @@ hooks =
168 , ("target", set (testDepends . system . contains (pkg "z3")) True)
155 , ("target", set (testDepends . system . contains (pkg "z3")) True)
169 , ("terminfo", set (libraryDepends . system . contains (pkg "ncurses")) True)
156 , ("terminfo", set (libraryDepends . system . contains (pkg "ncurses")) True)
170 , ("text", set doCheck False) -- break infinite recursion
157 , ("text", set doCheck False) -- break infinite recursion
171− , ("tensorflow-proto", set (libraryDepends . tool . contains (pkg "protobuf")) True)
172 , ("thyme", set (libraryDepends . tool . contains (self "cpphs")) True) -- required on Darwin
158 , ("thyme", set (libraryDepends . tool . contains (self "cpphs")) True) -- required on Darwin
173 , ("twilio", set doCheck False) -- attempts to access the network
159 , ("twilio", set doCheck False) -- attempts to access the network
174 , ("tz", set phaseOverrides "preConfigure = \"export TZDIR=${pkgs.tzdata}/share/zoneinfo\";")
160 , ("tz", set phaseOverrides "preConfigure = \"export TZDIR=${pkgs.tzdata}/share/zoneinfo\";")
175− , ("udev", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
161+ , ("udev", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux))) , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
176 , ("webkitgtk3", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
162 , ("webkitgtk3", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
177 , ("webkitgtk3-javascriptcore", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
163 , ("webkitgtk3-javascriptcore", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
178 , ("websockets", set doCheck False) -- https://github.com/jaspervdj/websockets/issues/104
164 , ("websockets", set doCheck False) -- https://github.com/jaspervdj/websockets/issues/104
@@ -181,10 +167,9 @@ hooks =
181 , ("wxc", wxcHook)
167 , ("wxc", wxcHook)
182 , ("wxcore", set (libraryDepends . pkgconfig . contains (pkg "wxGTK")) True)
168 , ("wxcore", set (libraryDepends . pkgconfig . contains (pkg "wxGTK")) True)
183 , ("X11", over (libraryDepends . system) (Set.union (Set.fromList $ map bind ["pkgs.xorg.libXinerama","pkgs.xorg.libXext","pkgs.xorg.libXrender","pkgs.xorg.libXScrnSaver"])))
169 , ("X11", over (libraryDepends . system) (Set.union (Set.fromList $ map bind ["pkgs.xorg.libXinerama","pkgs.xorg.libXext","pkgs.xorg.libXrender","pkgs.xorg.libXScrnSaver"])))
184− , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
170+ , ("xmonad", set phaseOverrides xmonadPostInstall)
185 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
171 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
186 , ("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
172 , ("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)
188 ]
173 ]
189
174
190pkg :: Identifier -> Binding
175pkg :: Identifier -> Binding
@@ -202,18 +187,10 @@ bind s = binding # (i, path # is)
202 is = map (review ident) (splitOn "." s)
187 is = map (review ident) (splitOn "." s)
203 i = last is
188 i = last is
204
189
205−-- | @replace old new bset@ replaces the Nix binding @old@ with @new@ in the
206−-- set of bindings @bset@. If @old@ is not found in @bset@, then the function
207−-- fails with an 'error'.
208replace :: Binding -> Binding -> Set Binding -> Set Binding
190replace :: Binding -> Binding -> Set Binding -> Set Binding
209−replace old new bs
210− | old `Set.member` bs = Set.insert new (Set.delete old bs)
191+replace old new bs = if old `Set.member` bs then Set.insert new (Set.delete old bs) else bs
211− | otherwise = error (unwords [ "post-process: cannot replace name binding"
212− , show old, "by", show new
213− , "because it's not found in set"
214− , show bs
215− ])
216
192
193+-- TODO: I need to figure out how to conveniently replace a binding in a set.
217gtk3Hook :: Derivation -> Derivation -- https://github.com/NixOS/cabal2nix/issues/145
194gtk3Hook :: Derivation -> Derivation -- https://github.com/NixOS/cabal2nix/issues/145
218gtk3Hook = set (libraryDepends . pkgconfig . contains (pkg "gtk3")) True
195gtk3Hook = set (libraryDepends . pkgconfig . contains (pkg "gtk3")) True
219 . over (libraryDepends . pkgconfig) (Set.filter (\b -> view localName b /= "gtk3"))
196 . over (libraryDepends . pkgconfig) (Set.filter (\b -> view localName b /= "gtk3"))
@@ -230,12 +207,13 @@ gitAnnexHook = set phaseOverrides gitAnnexOverrides
230 where
207 where
231 gitAnnexOverrides = unlines
208 gitAnnexOverrides = unlines
232 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
209 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
233− , "postBuild = ''"
210+ , "installPhase = \"make PREFIX=$out BUILDER=: install\";"
211+ , "checkPhase = ''"
234 , " ln -sf dist/build/git-annex/git-annex git-annex"
212 , " ln -sf dist/build/git-annex/git-annex git-annex"
235 , " ln -sf git-annex git-annex-shell"
213 , " ln -sf git-annex git-annex-shell"
214+ , " export PATH+=\":$PWD\""
215+ , " git-annex test"
236 , "'';"
216 , "'';"
237− , "installPhase = \"make PREFIX=$out BUILDER=: install install-completions\";"
238− , "checkPhase = ''PATH+=\":$PWD\" git-annex test'';"
239 , "enableSharedExecutables = false;"
217 , "enableSharedExecutables = false;"
240 ]
218 ]
241 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
219 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
@@ -256,7 +234,7 @@ gfPhaseOverrides = unlines
256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
234 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
257 -- Parallel compilation fails. Disable it.
235 -- Parallel compilation fails. Disable it.
258 , "'';"
236 , "'';"
259− , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH'';"
237+ , "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
238 -- 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.
239 -- to find the library it just built in order to compile grammar files.
262 ]
240 ]
@@ -292,8 +270,10 @@ darcsInstallPostInstall = unlines
292xmonadPostInstall :: String
270xmonadPostInstall :: String
293xmonadPostInstall = unlines
271xmonadPostInstall = unlines
294 [ "postInstall = ''"
272 [ "postInstall = ''"
295− , " install -D man/xmonad.1 ''${!outputDoc}/share/man/man1/xmonad.1"
273+ , " shopt -s globstar"
296− , " install -D man/xmonad.hs ''${!outputDoc}/share/doc/$name/sample-xmonad.hs"
274+ , " mkdir -p $doc/share/man/man1"
275+ , " mv \"$data/\"**\"/man/\"*[0-9] $doc/share/man/man1/"
276+ , " rm \"$data/\"**\"/man/\"*"
297 , "'';"
277 , "'';"
298 ]
278 ]
299
279
@@ -360,50 +340,8 @@ webkitgtk24xHook = set (libraryDepends . pkgconfig . contains (pkg "webkitgtk24x
360opencvOverrides :: Derivation -> Derivation
340opencvOverrides :: Derivation -> Derivation
361opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
341opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
362 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
342 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
343+ . set (configureFlags . contains "--with-gcc=${stdenv.cc}/bin/c++") True
344+ . set (configureFlags . contains "--with-ld=${stdenv.cc}/bin/c++") True
363
345
364hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
346hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
365hspecCoreOverrides = set phaseOverrides "testTarget = \"--test-option=--skip --test-option='Test.Hspec.Core.Runner.hspecResult runs specs in parallel'\";"
347hspecCoreOverrides = set phaseOverrides "testTarget = \"--test-option=--skip --test-option='Test.Hspec.Core.Runner.hspecResult runs specs in parallel'\";"
366−
367−cabal2nixOverrides :: Derivation -> Derivation
368−cabal2nixOverrides = set phaseOverrides $ unlines
369− [ "preCheck = ''"
370− , " export PATH=\"$PWD/dist/build/cabal2nix:$PATH\""
371− , " export HOME=\"$TMPDIR/home\""
372− , "'';"
373− ]
374−
375−gtkglextHook :: Derivation -> Derivation
376−gtkglextHook = over (libraryDepends . system) (Set.union (Set.fromList deps))
377− where
378− deps :: [Binding]
379− deps = bind <$> [ "pkgs.gtk2"
380− , "pkgs.libGLU"
381− , "pkgs.xorg.libSM"
382− , "pkgs.xorg.libICE"
383− , "pkgs.xorg.libXt"
384− , "pkgs.xorg.libXmu"
385− ]
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+3−28
@@ -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
@@ -52,10 +49,6 @@ instance FromJSON PackageIdentifier where
52 parseJSON (String s) = return (fromString (T.unpack s))
49 parseJSON (String s) = return (fromString (T.unpack s))
53 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell package identifier")
50 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell package identifier")
54
51
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−
59instance FromJSON Dependency where
52instance FromJSON Dependency where
60 parseJSON (String s) = return (fromString (T.unpack s))
53 parseJSON (String s) = return (fromString (T.unpack s))
61 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")
54 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")
@@ -64,25 +57,7 @@ instance FromJSON CompilerInfo where
64 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
57 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
65 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
58 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
66
59
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
60-- parsing tools
86
61
87−text2isString :: Parsec a => String -> String -> a
62+text2isString :: Text a => String -> String -> a
88−text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParsec s)
63+text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParse s)
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs+35−61
@@ -1,5 +1,5 @@
1module Distribution.Nixpkgs.Haskell.PackageSourceSpec
1module Distribution.Nixpkgs.Haskell.PackageSourceSpec
2− ( HpackUse(..), Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
2+ ( Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
3 ) where
3 ) where
4
4
5import qualified Control.Exception as Exception
5import qualified Control.Exception as Exception
@@ -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,12 +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
35−
33+import qualified Data.Text.Encoding as T
36−data HpackUse
37− = ForceHpack
38− | PackageYamlHpack
39− | NoHpack
40
34
41data Package = Package
35data Package = Package
42 { pkgSource :: DerivationSource
36 { pkgSource :: DerivationSource
@@ -45,43 +39,37 @@ data Package = Package
45 }
39 }
46 deriving (Show)
40 deriving (Show)
47
41
48−getPackage :: HpackUse
42+getPackage :: Bool
49− -- ^ the way hpack should be used.
43+ -- ^ Whether hpack should regenerate the cabal file.
50− -> Bool
51− -- ^ Whether to fetch submodules if fetching from git
52 -> Maybe FilePath
44 -> Maybe FilePath
53 -- ^ The path to the Hackage database.
45 -- ^ The path to the Hackage database.
54 -> Maybe UTCTime
46 -> Maybe UTCTime
55 -- ^ If we have hackage-snapshot time.
47 -- ^ If we have hackage-snapshot time.
56 -> Source
48 -> Source
57 -> IO Package
49 -> IO Package
58−getPackage optHpack optSubmodules optHackageDB optHackageSnapshot =
50+getPackage optHpack optHackageDB optHackageSnapshot =
59− getPackage' optHpack optSubmodules (loadHackageDB optHackageDB optHackageSnapshot)
51+ getPackage' optHpack (loadHackageDB optHackageDB optHackageSnapshot)
60
52
61−getPackage' :: HpackUse
53+getPackage' :: Bool
62− -- ^ the way hpack should be used.
54+ -- ^ Whether hpack should regenerate the cabal file.
63− -> Bool
64− -- ^ Whether to fetch submodules if fetching from git
65 -> IO DB.HackageDB
55 -> IO DB.HackageDB
66 -> Source
56 -> Source
67 -> IO Package
57 -> IO Package
68−getPackage' optHpack optSubmodules hackageDB source = do
58+getPackage' optHpack hackageDB source = do
69− (derivSource, ranHpack, pkgDesc) <- fetchOrFromDB optHpack optSubmodules hackageDB source
59+ (derivSource, ranHpack, pkgDesc) <- fetchOrFromDB optHpack hackageDB source
70 (\s -> Package s ranHpack pkgDesc) <$> maybe (sourceFromHackage (sourceHash source) (showPackageIdentifier pkgDesc) $ sourceCabalDir source) return derivSource
60 (\s -> Package s ranHpack pkgDesc) <$> maybe (sourceFromHackage (sourceHash source) (showPackageIdentifier pkgDesc) $ sourceCabalDir source) return derivSource
71
61
72−fetchOrFromDB :: HpackUse
62+fetchOrFromDB :: Bool
73− -- ^ the way hpack should be used
63+ -- ^ Whether hpack should regenerate the cabal file
74− -> Bool
75− -- ^ Whether to fetch submodules if fetching from git
76 -> IO DB.HackageDB
64 -> IO DB.HackageDB
77 -> Source
65 -> Source
78 -> IO (Maybe DerivationSource, Bool, Cabal.GenericPackageDescription)
66 -> IO (Maybe DerivationSource, Bool, Cabal.GenericPackageDescription)
79−fetchOrFromDB optHpack optSubmodules hackageDB src
67+fetchOrFromDB optHpack hackageDB src
80 | "cabal://" `isPrefixOf` sourceUrl src = do
68 | "cabal://" `isPrefixOf` sourceUrl src = do
81 (msrc, pkgDesc) <- fromDB hackageDB . drop (length "cabal://") $ sourceUrl src
69 (msrc, pkgDesc) <- fromDB hackageDB . drop (length "cabal://") $ sourceUrl src
82 return (msrc, False, pkgDesc)
70 return (msrc, False, pkgDesc)
83 | otherwise = do
71 | otherwise = do
84− r <- fetch optSubmodules (\dir -> cabalFromPath optHpack (dir </> sourceCabalDir src)) src
72+ r <- fetch (\dir -> cabalFromPath optHpack (dir </> sourceCabalDir src)) src
85 case r of
73 case r of
86 Nothing -> fail $ "Failed to fetch source. Does this source exist? " ++ show src
74 Nothing -> fail $ "Failed to fetch source. Does this source exist? " ++ show src
87 Just (derivSource, (externalSource, ranHpack, pkgDesc)) ->
75 Just (derivSource, (externalSource, ranHpack, pkgDesc)) ->
@@ -104,16 +92,16 @@ fromDB hackageDBIO pkg = do
104 vd <- maybe unknownPackageError return (DB.lookup name hackageDB >>= lookupVersion)
92 vd <- maybe unknownPackageError return (DB.lookup name hackageDB >>= lookupVersion)
105 let ds = case DB.tarballSha256 vd of
93 let ds = case DB.tarballSha256 vd of
106 Nothing -> Nothing
94 Nothing -> Nothing
107− Just hash -> Just (urlDerivationSource url hash)
95+ Just hash -> Just (DerivationSource "url" url "" hash)
108 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
96 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
109 where
97 where
110 pkgId :: Cabal.PackageIdentifier
98 pkgId :: Cabal.PackageIdentifier
111− pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParsec pkg)
99+ pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
112 name = Cabal.packageName pkgId
100 name = Cabal.packageName pkgId
113
101
114− unknownPackageError = fail $ "No such package " ++ prettyShow pkgId ++ " in the cabal database. Did you run cabal update?"
102+ unknownPackageError = fail $ "No such package " ++ display pkgId ++ " in the cabal database. Did you run cabal update?"
115
103
116− url = "mirror://hackage/" ++ prettyShow pkgId ++ ".tar.gz"
104+ url = "mirror://hackage/" ++ display pkgId ++ ".tar.gz"
117
105
118 version :: Version
106 version :: Version
119 version = Cabal.packageVersion pkgId
107 version = Cabal.packageVersion pkgId
@@ -150,20 +138,20 @@ sourceFromHackage optHash pkgId cabalDir = do
150 -- Use the cached hash (either from cache file or given on cmdline via sha256 opt)
138 -- Use the cached hash (either from cache file or given on cmdline via sha256 opt)
151 -- if available, otherwise download from hackage to compute hash.
139 -- if available, otherwise download from hackage to compute hash.
152 case cachedHash of
140 case cachedHash of
153− Guess hash -> return $ urlDerivationSource url hash
141+ Guess hash -> return $ DerivationSource "url" url "" hash
154 Certain hash ->
142 Certain hash ->
155 -- We need to force the hash here. If we didn't do this, then when reading the
143 -- We need to force the hash here. If we didn't do this, then when reading the
156 -- hash from the cache file, the cache file will still be open for reading
144 -- hash from the cache file, the cache file will still be open for reading
157 -- (because lazy io) when writeFile opens the file again for writing. By forcing
145 -- (because lazy io) when writeFile opens the file again for writing. By forcing
158 -- the hash here, we ensure that the file is closed before opening it again.
146 -- the hash here, we ensure that the file is closed before opening it again.
159 seq (length hash) $
147 seq (length hash) $
160− urlDerivationSource url hash <$ writeFile cacheFile hash
148+ DerivationSource "url" url "" hash <$ writeFile cacheFile hash
161 UnknownHash -> do
149 UnknownHash -> do
162 maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", []) (Source url "" UnknownHash cabalDir))
150 maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", []) (Source url "" UnknownHash cabalDir))
163 case maybeHash of
151 case maybeHash of
164 Just hash ->
152 Just hash ->
165 seq (length hash) $
153 seq (length hash) $
166− urlDerivationSource url hash <$ writeFile cacheFile hash
154+ DerivationSource "url" url "" hash <$ writeFile cacheFile hash
167 Nothing -> do
155 Nothing -> do
168 hPutStr stderr $ unlines
156 hPutStr stderr $ unlines
169 [ "*** cannot compute hash. (Not a hackage project?)"
157 [ "*** cannot compute hash. (Not a hackage project?)"
@@ -176,12 +164,12 @@ sourceFromHackage optHash pkgId cabalDir = do
176 exitFailure
164 exitFailure
177
165
178showPackageIdentifier :: Cabal.GenericPackageDescription -> String
166showPackageIdentifier :: Cabal.GenericPackageDescription -> String
179−showPackageIdentifier pkgDesc = name ++ "-" ++ prettyShow version where
167+showPackageIdentifier pkgDesc = name ++ "-" ++ display version where
180 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
168 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
181 name = Cabal.unPackageName (Cabal.packageName pkgId)
169 name = Cabal.unPackageName (Cabal.packageName pkgId)
182 version = Cabal.packageVersion pkgId
170 version = Cabal.packageVersion pkgId
183
171
184−cabalFromPath :: HpackUse -- ^ the way hpack should be used
172+cabalFromPath :: Bool -- ^ Whether hpack should regenerate the cabal file
185 -> FilePath -> MaybeT IO (Bool, Bool, Cabal.GenericPackageDescription)
173 -> FilePath -> MaybeT IO (Bool, Bool, Cabal.GenericPackageDescription)
186cabalFromPath optHpack path = do
174cabalFromPath optHpack path = do
187 d <- liftIO $ doesDirectoryExist path
175 d <- liftIO $ doesDirectoryExist path
@@ -191,25 +179,17 @@ cabalFromPath optHpack path = do
191 return (d, ranHpack, pkg)
179 return (d, ranHpack, pkg)
192 else (,,) d False <$> cabalFromFile False path
180 else (,,) d False <$> cabalFromFile False path
193
181
194−cabalFromDirectory :: HpackUse -- ^ the way hpack should be used
182+cabalFromDirectory :: Bool -- ^ Whether hpack should regenerate the cabal file
195 -> FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
183 -> FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
196−cabalFromDirectory ForceHpack dir = hpackDirectory dir
184+cabalFromDirectory True dir = hpackDirectory dir
197−cabalFromDirectory NoHpack dir = onlyCabalFromDirectory dir "*** No .cabal file was found. Exiting."
185+cabalFromDirectory False dir = do
198−cabalFromDirectory PackageYamlHpack dir = do
199− useHpack <- liftIO $ doesFileExist (dir </> "package.yaml")
200− if useHpack
201− then do
202− liftIO $ hPutStrLn stderr "*** found package.yaml. Using hpack..."
203− hpackDirectory dir
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`)
186 cabals <- liftIO $ getDirectoryContents dir >>= filterM doesFileExist . map (dir </>) . filter (".cabal" `isSuffixOf`)
209 case cabals of
187 case cabals of
210− [] -> fail errMsg
188+ [] -> do
189+ liftIO $ hPutStrLn stderr "*** found zero cabal files. Trying hpack..."
190+ hpackDirectory dir
211 [cabalFile] -> (,) False <$> cabalFromFile True cabalFile
191 [cabalFile] -> (,) False <$> cabalFromFile True cabalFile
212− _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
192+ _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
213
193
214handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
194handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
215handleIO = Exception.handle
195handleIO = Exception.handle
@@ -219,17 +199,11 @@ encodeUtf8 = T.encodeUtf8 . T.pack
219
199
220hpackDirectory :: FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
200hpackDirectory :: FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
221hpackDirectory dir = do
201hpackDirectory dir = do
222− mPackage <- liftIO $ Hpack.readPackageConfig Hpack.defaultDecodeOptions {
202+ mPackage <- liftIO $ Hpack.readPackageConfig Hpack.defaultDecodeOptions {Hpack.decodeOptionsTarget = dir </> Hpack.packageConfig}
223− Hpack.decodeOptionsProgramName = Hpack.ProgramName "cabal2nix"
224− , Hpack.decodeOptionsTarget = dir </> Hpack.packageConfig
225− }
226 case mPackage of
203 case mPackage of
227 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
204 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
228 Right r -> do
205 Right r -> do
229− let hpackOutput =
230− let body = Hpack.renderPackage [] (Hpack.decodeResultPackage r)
206+ let hpackOutput = encodeUtf8 $ Hpack.renderPackage [] (Hpack.decodeResultPackage r)
231− cabalVersion = Hpack.decodeResultCabalVersion r
232− in encodeUtf8 $ cabalVersion ++ body
233 hash = printSHA256 $ digest (digestByName "sha256") hpackOutput
207 hash = printSHA256 $ digest (digestByName "sha256") hpackOutput
234 case runParseGenericPackageDescription "<hpack output>" hpackOutput of
208 case runParseGenericPackageDescription "<hpack output>" hpackOutput of
235 Left msg -> liftIO $ do
209 Left msg -> liftIO $ do
test/Main.hs+14−10
@@ -46,7 +46,7 @@ testLibrary cabalFile = do
46 cabal2nix :: GenericPackageDescription -> Derivation
46 cabal2nix :: GenericPackageDescription -> Derivation
47 cabal2nix gpd = fromGenericPackageDescription
47 cabal2nix gpd = fromGenericPackageDescription
48 (const True)
48 (const True)
49− (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
49+ (\i -> Just (binding # (i, path # [i])))
50 (Platform X86_64 Linux)
50 (Platform X86_64 Linux)
51 (unknownCompilerInfo (CompilerId GHC (mkVersion [8,2])) NoAbiTag)
51 (unknownCompilerInfo (CompilerId GHC (mkVersion [8,2])) NoAbiTag)
52 (configureCabalFlags (packageId gpd))
52 (configureCabalFlags (packageId gpd))
@@ -57,7 +57,6 @@ testLibrary cabalFile = do
57 , derivUrl = "mirror://hackage/foo.tar.gz"
57 , derivUrl = "mirror://hackage/foo.tar.gz"
58 , derivRevision = ""
58 , derivRevision = ""
59 , derivHash = "deadbeef"
59 , derivHash = "deadbeef"
60− , derivSubmodule = Nothing
61 }
60 }
62 & extraFunctionArgs %~ Set.union (Set.singleton "inherit stdenv")
61 & extraFunctionArgs %~ Set.union (Set.singleton "inherit stdenv")
63 goldenVsFileDiff
62 goldenVsFileDiff
@@ -79,10 +78,7 @@ testLibrary cabalFile = do
79-- some temporary location that is empty.
78-- some temporary location that is empty.
80--
79--
81-- * Run this test with different kinds of encodings.
80-- * Run this test with different kinds of encodings.
82−--
81+
83−-- * Run tests with a different target OS, like Darwin. The packages "iconv",
84−-- "crypt-sha512", "gl" might be worthwhile for testing since their output
85−-- differs on Darwin.
86
82
87testExecutable :: FilePath -> FilePath -> TestTree
83testExecutable :: FilePath -> FilePath -> TestTree
88testExecutable exe cabalFile = do
84testExecutable exe cabalFile = do
@@ -93,12 +89,20 @@ testExecutable exe cabalFile = do
93 (\ref new -> ["diff", "-u", ref, new])
89 (\ref new -> ["diff", "-u", ref, new])
94 goldenFile
90 goldenFile
95 nixFile
91 nixFile
96− (callCommand (unwords ["env LANG=en_US.UTF-8", exe, "--sha256=deadbeef", "--system=x86_64-linux", "--compiler=ghc-8.2", "--", cabalFile, ">"++nixFile]))
92+ (callCommand (unwords ["env LANG=en_US.UTF-8", exe, "--sha256=deadbeef", "--compiler=ghc-8.2", "--", cabalFile, ">"++nixFile]))
97
93
98-------------------------------------------------------------------------------
94-------------------------------------------------------------------------------
99-- * Helper functions
95-- * Helper functions
100-------------------------------------------------------------------------------
96-------------------------------------------------------------------------------
101
97
98+-- | Find all *files* in the given directory. This function does not recurse,
99+-- nor does it include the special entries @'.'@ or @'..'@ in the result.
100+
101+listDirectoryFiles :: FilePath -> IO [FilePath]
102+listDirectoryFiles dirPath = do
103+ entries <- listDirectory dirPath
104+ filterM doesFileExist (map (dirPath </>) entries)
105+
102-- | Find all *files* in the given directory that end with the given suffix.
106-- | Find all *files* in the given directory that end with the given suffix.
103-- This function does not recurse, nor does it include the special entries
107-- This function does not recurse, nor does it include the special entries
104-- @'.'@ or @'..'@ in the result.
108-- @'.'@ or @'..'@ in the result.
@@ -111,9 +115,9 @@ testExecutable exe cabalFile = do
111-- we prefer our own simpler code.
115-- we prefer our own simpler code.
112
116
113listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
117listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
114−listDirectoryFilesBySuffix suff dirPath = do
118+listDirectoryFilesBySuffix suff =
115− entries <- listDirectory dirPath
119+ fmap (filter ((suff ==) . takeExtension)) . listDirectoryFiles
116− filterM doesFileExist [ dirPath </> e | e <- entries, takeExtension e == suff ]
120+
117
121
118-- | A variant of 'writeFile' that appends a newline to the end of the buffer
122-- | A variant of 'writeFile' that appends a newline to the end of the buffer
119-- before writing.
123-- before writing.
test/golden-test-cases/ede.nix.golden−1
@@ -21,5 +21,4 @@ mkDerivation {
21 homepage = "http://github.com/brendanhay/ede";
21 homepage = "http://github.com/brendanhay/ede";
22 description = "Templating language with similar syntax and features to Liquid or Jinja2";
22 description = "Templating language with similar syntax and features to Liquid or Jinja2";
23 license = "unknown";
23 license = "unknown";
24− hydraPlatforms = stdenv.lib.platforms.none;
25}
24}
test/golden-test-cases/gogol-adexchange-buyer.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Ad Exchange Buyer SDK";
8 description = "Google Ad Exchange Buyer SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-admin-emailmigration.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Email Migration API v2 SDK";
8 description = "Google Email Migration API v2 SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-affiliates.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Affiliate Network SDK";
8 description = "Google Affiliate Network SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-apps-tasks.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Tasks SDK";
8 description = "Google Tasks SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-appstate.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google App State SDK";
8 description = "Google App State SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-blogger.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Blogger SDK";
8 description = "Google Blogger SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-datastore.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Cloud Datastore SDK";
8 description = "Google Cloud Datastore SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-dfareporting.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google DCM/DFA Reporting And Trafficking SDK";
8 description = "Google DCM/DFA Reporting And Trafficking SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-firebase-rules.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Firebase Rules SDK";
8 description = "Google Firebase Rules SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-gmail.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Gmail SDK";
8 description = "Google Gmail SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-kgsearch.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Knowledge Graph Search SDK";
8 description = "Google Knowledge Graph Search SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-maps-engine.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Maps Engine SDK";
8 description = "Google Maps Engine SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-plus.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google + SDK";
8 description = "Google + SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-resourceviews.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Compute Engine Instance Groups SDK";
8 description = "Google Compute Engine Instance Groups SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-translate.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Translate SDK";
8 description = "Google Translate SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-webmaster-tools.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google Search Console SDK";
8 description = "Google Search Console SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/gogol-youtube.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "https://github.com/brendanhay/gogol";
7 homepage = "https://github.com/brendanhay/gogol";
8 description = "Google YouTube Data SDK";
8 description = "Google YouTube Data SDK";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/hxt-expat.nix.golden−1
@@ -7,5 +7,4 @@ mkDerivation {
7 homepage = "http://www.fh-wedel.de/~si/HXmlToolbox/index.html";
7 homepage = "http://www.fh-wedel.de/~si/HXmlToolbox/index.html";
8 description = "Expat parser for HXT";
8 description = "Expat parser for HXT";
9 license = "unknown";
9 license = "unknown";
10− hydraPlatforms = stdenv.lib.platforms.none;
11}
10}
test/golden-test-cases/hxt-tagsoup.nix.golden−1
@@ -11,5 +11,4 @@ mkDerivation {
11 homepage = "https://github.com/UweSchmidt/hxt";
11 homepage = "https://github.com/UweSchmidt/hxt";
12 description = "TagSoup parser for HXT";
12 description = "TagSoup parser for HXT";
13 license = "unknown";
13 license = "unknown";
14− hydraPlatforms = stdenv.lib.platforms.none;
15}
14}
test/golden-test-cases/opencv.cabaldeleted−263
@@ -1,263 +0,0 @@
1−name: opencv
2−version: 0.0.2.1
3−homepage: https://github.com/LumiGuide/haskell-opencv
4−bug-reports: https://github.com/LumiGuide/haskell-opencv/issues
5−license: BSD3
6−license-file: LICENSE
7−author: Roel van Dijk <roel@lambdacube.nl>, Bas van Dijk <v.dijk.bas@gmail.com>
8−maintainer: Roel van Dijk <roel@lambdacube.nl>, Bas van Dijk <v.dijk.bas@gmail.com>
9−build-type: Custom
10−cabal-version: >=1.23
11−category: AI, Graphics
12−synopsis: Haskell binding to OpenCV-3.x
13−description: <<https://raw.githubusercontent.com/LumiGuide/haskell-opencv/master/data/haskell-opencv-logo-200x82.png>>
14− .
15− This is a Haskell library providing a binding to OpenCV-3.x.
16− It binds directly with the C++ API using the @inline-c@ Haskell library.
17− .
18− The library is far from complete but the framework is there to easily
19− bind missing functionality.
20− .
21− Note that the OpenCV contrib modules are provided by
22− <http://hackage.haskell.org/package/opencv-extra opencv-extra>.
23− .
24− Make sure to checkout the
25− <https://github.com/LumiGuide/haskell-opencv/tree/master/opencv-examples opencv-examples>.
26−
27−extra-source-files:
28− CHANGELOG.md
29− data/*.png
30− data/*.jpg
31− data/*.mp4
32− data/*.xml
33−
34−extra-doc-files:
35− doc/generated/*.png
36− doc/generated/examples/*.png
37− doc/generated/examples/*.gif
38− doc/color_conversions.png
39−
40−source-repository head
41− type: git
42− location: git://github.com/LumiGuide/haskell-opencv.git
43− subdir: opencv
44−
45−flag internal-documentation
46− description: Enables documentation generation for internal modules.
47− default: False
48− manual: True
49−
50−custom-setup
51− setup-depends: base, Cabal >= 1.23
52−
53−library
54− hs-source-dirs: src
55− include-dirs: include
56− install-includes:
57− haskell_opencv_matx_typedefs.hpp
58− hsc_macros.hpp
59− namespace.hpp
60− orb.hpp
61− simple_blob_detector.hpp
62− termcriteria.hpp
63− video_motion_analysis.hpp
64−
65− cc-options: -Wall -std=c++11
66− ghc-options: -Wall -fwarn-incomplete-patterns -funbox-strict-fields
67− if flag(internal-documentation)
68− cpp-options: -DENABLE_INTERNAL_DOCUMENTATION
69−
70− build-depends:
71− aeson >= 0.9.0.1
72− , base >= 4.8 && <5
73− , base64-bytestring >= 1.0.0.1
74− , bindings-DSL >= 1.0.23
75− , bytestring >= 0.10.6
76− , containers >= 0.5.6.2
77− , data-default >= 0.7.1.1
78− , deepseq >= 1.4.1.1
79− , inline-c >= 0.6
80− , inline-c-cpp >= 0.2.1
81− , JuicyPixels >= 3.2.8.1
82− , linear >= 1.20.4
83− , primitive >= 0.6.1
84− , repa >= 3.4.0.2
85− , template-haskell >= 2.10
86− , text >= 1.2.2.1
87− , transformers >= 0.4.2
88− , vector >= 0.11
89−
90− exposed-modules:
91− OpenCV
92− OpenCV.Calib3d
93− OpenCV.Core.ArrayOps
94− OpenCV.Core.Types
95− OpenCV.Core.Types.Mat
96− OpenCV.Core.Types.Mat.HMat
97− OpenCV.Core.Types.Mat.Repa
98− OpenCV.Core.Types.Matx
99− OpenCV.Core.Types.Point
100− OpenCV.Core.Types.Rect
101− OpenCV.Core.Types.Size
102− OpenCV.Core.Types.Vec
103− OpenCV.Exception
104− OpenCV.Features2d
105− OpenCV.HighGui
106− OpenCV.ImgCodecs
107− OpenCV.ImgProc.ColorMaps
108− OpenCV.ImgProc.Drawing
109− OpenCV.ImgProc.FeatureDetection
110− OpenCV.ImgProc.GeometricImgTransform
111− OpenCV.ImgProc.ImgFiltering
112− OpenCV.ImgProc.MiscImgTransform
113− OpenCV.ImgProc.MiscImgTransform.ColorCodes
114− OpenCV.ImgProc.ObjectDetection
115− OpenCV.ImgProc.StructuralAnalysis
116− OpenCV.ImgProc.Types
117− OpenCV.ImgProc.CascadeClassifier
118− OpenCV.JSON
119− OpenCV.Photo
120− OpenCV.TypeLevel
121− OpenCV.Unsafe
122− OpenCV.Video
123− OpenCV.Video.MotionAnalysis
124− OpenCV.VideoIO.Types
125− OpenCV.VideoIO.VideoCapture
126− OpenCV.VideoIO.VideoWriter
127−
128− OpenCV.Internal
129− OpenCV.Internal.Mutable
130− OpenCV.Internal.C.Inline
131− OpenCV.Internal.C.PlacementNew
132− OpenCV.Internal.C.PlacementNew.TH
133− OpenCV.Internal.C.Types
134− OpenCV.Internal.Calib3d.Constants
135− OpenCV.Internal.Core.ArrayOps
136− OpenCV.Internal.Core.Types
137− OpenCV.Internal.Core.Types.Constants
138− OpenCV.Internal.Core.Types.Mat
139− OpenCV.Internal.Core.Types.Mat.Depth
140− OpenCV.Internal.Core.Types.Mat.HMat
141− OpenCV.Internal.Core.Types.Mat.Marshal
142− OpenCV.Internal.Core.Types.Mat.ToFrom
143− OpenCV.Internal.Core.Types.Matx
144− OpenCV.Internal.Core.Types.Matx.TH
145− OpenCV.Internal.Core.Types.Point
146− OpenCV.Internal.Core.Types.Point.TH
147− OpenCV.Internal.Core.Types.Rect
148− OpenCV.Internal.Core.Types.Rect.TH
149− OpenCV.Internal.Core.Types.Size
150− OpenCV.Internal.Core.Types.Size.TH
151− OpenCV.Internal.Core.Types.Vec
152− OpenCV.Internal.Core.Types.Vec.TH
153− OpenCV.Internal.Exception
154− OpenCV.Internal.ImgCodecs
155− OpenCV.Internal.ImgProc.MiscImgTransform
156− OpenCV.Internal.ImgProc.MiscImgTransform.TypeLevel
157− OpenCV.Internal.ImgProc.MiscImgTransform.ColorCodes
158− OpenCV.Internal.ImgProc.Types
159− OpenCV.Internal.Photo.Constants
160− OpenCV.Internal.VideoIO.Constants
161− OpenCV.Internal.VideoIO.Types
162− OpenCV.Juicy
163−
164− default-extensions:
165− BangPatterns
166− DataKinds
167− FlexibleContexts
168− FlexibleInstances
169− LambdaCase
170− OverloadedStrings
171− PackageImports
172− PolyKinds
173− ScopedTypeVariables
174− TupleSections
175− TypeFamilies
176− TypeOperators
177−
178− default-language: Haskell2010
179− pkgconfig-depends: opencv >= 3.0.0
180− extra-libraries: stdc++
181−
182−test-suite doc-images-opencv
183− type: exitcode-stdio-1.0
184− hs-source-dirs: doc
185− main-is: images.hs
186− other-modules:
187− ExampleExtractor
188− Language.Haskell.Meta.Syntax.Translate
189− default-language: Haskell2010
190− ghc-options: -Wall -fwarn-incomplete-patterns -threaded -funbox-strict-fields -rtsopts
191− build-depends:
192− base >= 4.8 && < 5
193− , bytestring >= 0.10.6
194− , containers >= 0.5.6.2
195− , data-default >= 0.7.1.1
196− , directory >= 1.2.2
197− , Glob >= 0.9
198− , haskell-src-exts >= 1.18.2
199− , JuicyPixels >= 3.2.8.1
200− , linear >= 1.20.4
201− , opencv
202− , primitive >= 0.6.1
203− , template-haskell >= 2.10
204− , text >= 1.2.2.1
205− , transformers >= 0.4.2
206− , vector >= 0.11
207−
208− default-extensions:
209− BangPatterns
210− DataKinds
211− LambdaCase
212− OverloadedStrings
213− PackageImports
214− PolyKinds
215− ScopedTypeVariables
216− TupleSections
217− TypeFamilies
218− TypeOperators
219−
220−test-suite test-opencv
221− type: exitcode-stdio-1.0
222− hs-source-dirs: test
223− main-is: test.hs
224− default-language: Haskell2010
225− ghc-options: -Wall -fwarn-incomplete-patterns -threaded -funbox-strict-fields -rtsopts
226− build-depends:
227− base >= 4.8 && < 5
228− , bytestring >= 0.10.6
229− , lens >= 4.13
230− , linear >= 1.20.4
231− , opencv
232− , QuickCheck >= 2.10.1
233− , repa >= 3.4.0.2
234− , tasty >= 0.11.0.2
235− , tasty-hunit >= 0.9.2
236− , tasty-quickcheck >= 0.8.4
237− , transformers >= 0.4.2
238− , vector >= 0.11
239−
240− default-extensions:
241− DataKinds
242− FlexibleContexts
243− PackageImports
244− RankNTypes
245− ScopedTypeVariables
246− TypeOperators
247−
248−benchmark bench-opencv
249− type: exitcode-stdio-1.0
250− hs-source-dirs: bench
251− main-is: bench.hs
252− default-language: Haskell2010
253− ghc-options: -Wall -fwarn-incomplete-patterns -threaded -funbox-strict-fields -rtsopts
254− build-depends:
255− base >= 4.8 && < 5
256− , bytestring >= 0.10.6
257− , criterion >= 1.1.1
258− , opencv
259− , repa >= 3.4.0.2
260−
261− default-extensions:
262− DataKinds
263− PackageImports
test/golden-test-cases/opencv.nix.goldendeleted−30
@@ -1,30 +0,0 @@
1−{ mkDerivation, aeson, base, base64-bytestring, bindings-DSL
2−, bytestring, Cabal, containers, criterion, data-default, deepseq
3−, directory, Glob, haskell-src-exts, inline-c, inline-c-cpp
4−, JuicyPixels, lens, linear, opencv3, primitive, QuickCheck, repa
5−, stdenv, tasty, tasty-hunit, tasty-quickcheck, template-haskell
6−, text, transformers, vector
7−}:
8−mkDerivation {
9− pname = "opencv";
10− version = "0.0.2.1";
11− sha256 = "deadbeef";
12− setupHaskellDepends = [ base Cabal ];
13− libraryHaskellDepends = [
14− aeson base base64-bytestring bindings-DSL bytestring containers
15− data-default deepseq inline-c inline-c-cpp JuicyPixels linear
16− primitive repa template-haskell text transformers vector
17− ];
18− libraryPkgconfigDepends = [ opencv3 ];
19− testHaskellDepends = [
20− base bytestring containers data-default directory Glob
21− haskell-src-exts JuicyPixels lens linear primitive QuickCheck repa
22− tasty tasty-hunit tasty-quickcheck template-haskell text
23− transformers vector
24− ];
25− benchmarkHaskellDepends = [ base bytestring criterion repa ];
26− hardeningDisable = [ "bindnow" ];
27− homepage = "https://github.com/LumiGuide/haskell-opencv";
28− description = "Haskell binding to OpenCV-3.x";
29− license = stdenv.lib.licenses.bsd3;
30−}
test/golden-test-cases/openpgp-asciiarmor.nix.golden−1
@@ -15,5 +15,4 @@ mkDerivation {
15 homepage = "http://floss.scru.org/openpgp-asciiarmor";
15 homepage = "http://floss.scru.org/openpgp-asciiarmor";
16 description = "OpenPGP (RFC4880) ASCII Armor codec";
16 description = "OpenPGP (RFC4880) ASCII Armor codec";
17 license = "unknown";
17 license = "unknown";
18− hydraPlatforms = stdenv.lib.platforms.none;
19}
18}
test/golden-test-cases/swagger.nix.golden−1
@@ -11,5 +11,4 @@ mkDerivation {
11 testHaskellDepends = [ aeson base bytestring tasty tasty-hunit ];
11 testHaskellDepends = [ aeson base bytestring tasty tasty-hunit ];
12 description = "Implementation of swagger data model";
12 description = "Implementation of swagger data model";
13 license = "unknown";
13 license = "unknown";
14− hydraPlatforms = stdenv.lib.platforms.none;
15}
14}
update-stackage.sh+9−13
@@ -2,14 +2,11 @@
2
2
3set -eu -o pipefail
3set -eu -o pipefail
4
4
5−cd "$(dirname "$0")"
5+tmpfile=$(mktemp "stackage-update.XXXXXXX")
6+trap "rm $tmpfile" 0
6
7
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"
8+curl -L -s "https://www.stackage.org/lts/cabal.config" >"$tmpfile"
12−version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.lts-//p" "$tmpfile")
9+version=$(sed -n "s/^--.*http:..www.stackage.org.snapshot.lts-//p" "$tmpfile")
13
10
14# Create a simple yaml version of the file.
11# Create a simple yaml version of the file.
15sed -r \
12sed -r \
@@ -19,13 +16,12 @@ sed -r \
19 -e 's|,$||' \
16 -e 's|,$||' \
20 -e '/installed$/d' \
17 -e '/installed$/d' \
21 -e '/^$/d' \
18 -e '/^$/d' \
22− < "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"
19+ -i "$tmpfile"
23
20
24# Drop restrictions on some tools where we always want the latest version.
21# Drop restrictions on some tools where we always want the latest version.
25sed -r \
22sed -r \
26 -e '/ cabal-install /d' \
23 -e '/ cabal-install /d' \
27 -e '/ cabal2nix /d' \
24 -e '/ cabal2nix /d' \
28− -e '/ cabal2spec /d' \
29 -e '/ distribution-nixpkgs /d' \
25 -e '/ distribution-nixpkgs /d' \
30 -e '/ git-annex /d' \
26 -e '/ git-annex /d' \
31 -e '/ hindent /d' \
27 -e '/ hindent /d' \
@@ -35,16 +31,16 @@ sed -r \
35 -e '/ hopenssl /d' \
31 -e '/ hopenssl /d' \
36 -e '/ jailbreak-cabal /d' \
32 -e '/ jailbreak-cabal /d' \
37 -e '/ json-autotype/d' \
33 -e '/ json-autotype/d' \
34+ -e '/ lambdabot-core /d' \
35+ -e '/ lambdabot-irc-plugins /d' \
38 -e '/ language-nix /d' \
36 -e '/ language-nix /d' \
39− -e '/ shake /d' \
40 -e '/ ShellCheck /d' \
37 -e '/ ShellCheck /d' \
41 -e '/ stack /d' \
38 -e '/ stack /d' \
42 -e '/ weeder /d' \
39 -e '/ weeder /d' \
43− < "${tmpfile}.new" > "${tmpfile}"
40+ -i "$tmpfile"
44
41
45# Drop the previous configuration ...
42# Drop the previous configuration ...
46−# shellcheck disable=SC1004
47−sed -e '/ # LTS Haskell/,/^$/c \TODO\
43+sed -e '/# LTS Haskell/,/^$/c \TODO\
48' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
44' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
49
45
50# ... and replace it with the new one.
46# ... and replace it with the new one.