git.iko.soy/typeable/cabal2nix
on master help sign in
.travis.yml+131−105
since splitsnapshots
unifiedsplit
@@ -1,135 +1,161 @@
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−# runghc make_travis_yml_2.hs '--doctest' '--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen' '--hlint' '-o' '.travis.yml' 'cabal2nix.cabal'
3+# haskell-ci '--installed=+all -Cabal' '--hlint' '--doctest' '--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen' '-o' '.travis.yml' 'cabal2nix.cabal' '--head-hackage' '--head-hackage-jobs' '> 8.8'
4#
4#
5# For more information, see https://github.com/haskell-CI/haskell-ci
5# For more information, see https://github.com/haskell-CI/haskell-ci
6#
6#
7+# version: 0.9.20200306
8+#
9+version: ~> 1.0
7language: c
10language: c
8−sudo: false
11+os: linux
9−
12+dist: xenial
10git:
13git:
11− submodules: false # whether to recursively clone submodules
14+ # whether to recursively clone submodules
12−
15+ submodules: false
13cache:
16cache:
14 directories:
17 directories:
15 - $HOME/.cabal/packages
18 - $HOME/.cabal/packages
16 - $HOME/.cabal/store
19 - $HOME/.cabal/store
17−
20+ - $HOME/.hlint
18before_cache:
21before_cache:
19− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
22+ - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
20 # remove files that are regenerated by 'cabal update'
23 # remove files that are regenerated by 'cabal update'
21− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
24+ - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
22− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
25+ - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
23− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
26+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
24− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
27+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
25− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
28+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
26−
27− - rm -rfv $HOME/.cabal/packages/head.hackage
29+ - rm -rfv $CABALHOME/packages/head.hackage
28−
30+jobs:
29−matrix:
30 include:
31 include:
31− - compiler: "ghc-8.6.1"
32+ - compiler: ghc-8.10.1
32− env: GHCHEAD=true
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"]}}
33− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}
34+ os: linux
34− - compiler: "ghc-8.4.3"
35+ - compiler: ghc-8.8.3
35− # env: TEST=--disable-tests BENCH=--disable-benchmarks
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"]}}
36− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
37+ os: linux
37−
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
38 allow_failures:
41 allow_failures:
39− - compiler: "ghc-8.6.1"
42+ - compiler: ghc-8.8.3
40−
43+ - compiler: ghc-8.10.1
41before_install:
44before_install:
42− - HC=${CC}
45+ - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
46+ - WITHCOMPILER="-w $HC"
47+ - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
43− - HCPKG=${HC/ghc/ghc-pkg}
48+ - HCPKG="$HC-pkg"
44 - unset CC
49 - unset CC
45− - ROOTDIR=$(pwd)
50+ - CABAL=/opt/ghc/bin/cabal
46− - mkdir -p $HOME/.local/bin
51+ - CABALHOME=$HOME/.cabal
47− - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
52+ - export PATH="$CABALHOME/bin:$PATH"
53+ - TOP=$(pwd)
48− - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
54+ - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
49 - echo $HCNUMVER
55 - echo $HCNUMVER
50−
56+ - CABAL="$CABAL -vnormal+nowrap"
57+ - set -o pipefail
58+ - TEST=--enable-tests
59+ - BENCH=--enable-benchmarks
60+ - HEADHACKAGE=false
61+ - if [ $HCNUMVER -ge 80800 ] ; then HEADHACKAGE=true ; fi
62+ - rm -f $CABALHOME/config
63+ - |
64+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
65+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
66+ echo "write-ghc-environment-files: always" >> $CABALHOME/config
67+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
68+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
69+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
70+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
71+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
72+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
73+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
74+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
75+ echo "install-dirs user" >> $CABALHOME/config
76+ echo " prefix: $CABALHOME" >> $CABALHOME/config
77+ echo "repository hackage.haskell.org" >> $CABALHOME/config
78+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
79+ - |
80+ if $HEADHACKAGE; then
81+ echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config
82+ echo "repository head.hackage.ghc.haskell.org" >> $CABALHOME/config
83+ echo " url: https://ghc.gitlab.haskell.org/head.hackage/" >> $CABALHOME/config
84+ echo " secure: True" >> $CABALHOME/config
85+ echo " root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config
86+ echo " 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config
87+ echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config
88+ echo " key-threshold: 3" >> $CABALHOME/config
89+ fi
51install:
90install:
52− - cabal --version
91+ - ${CABAL} --version
53 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
92 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
54− - BENCH=${BENCH---enable-benchmarks}
55− - TEST=${TEST---enable-tests}
56− - HADDOCK=${HADDOCK-true}
57− - UNCONSTRAINED=${UNCONSTRAINED-true}
58− - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
59− - GHCHEAD=${GHCHEAD-false}
60− - travis_retry cabal update -v
61− - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
62− - rm -fv cabal.project cabal.project.local
63− # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
64 - |
93 - |
65− if $GHCHEAD; then
94+ echo "program-default-options" >> $CABALHOME/config
66− sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config
95+ echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
67− for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done
96+ - cat $CABALHOME/config
68−
97+ - rm -fv cabal.project cabal.project.local cabal.project.freeze
69− echo 'repository head.hackage' >> ${HOME}/.cabal/config
98+ - travis_retry ${CABAL} v2-update -v
70− echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config
71− echo ' secure: True' >> ${HOME}/.cabal/config
72− echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
73− echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
74− echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
75− echo ' key-threshold: 3' >> ${HOME}/.cabal.config
76−
77− grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
78−
79− cabal new-update head.hackage -v
80− fi
81− - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
82− - if [ $HCNUMVER -ge 80000 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin doctest --constraint='doctest ==0.16.*'; fi
99+ - (cd /tmp && ${CABAL} v2-install $WITHCOMPILER -j2 doctest --constraint='doctest ==0.16.2.*')
83− - if [ $HCNUMVER -eq 80403 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin hlint --constraint='hlint ==2.1.*'; 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
84− - "printf 'packages: \".\"\\n' > cabal.project"
101+ - "if [ $HCNUMVER -lt 80800 ] ; then if [ ! -e $HOME/.hlint/hlint-$HLINTVER/hlint ]; then echo \"Downloading HLint version $HLINTVER\"; mkdir -p $HOME/.hlint; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\\n' --silent --location --output $HOME/.hlint/hlint-$HLINTVER.tar.gz \"https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz\"; tar -xzv -f $HOME/.hlint/hlint-$HLINTVER.tar.gz -C $HOME/.hlint; fi ; fi"
102+ - if [ $HCNUMVER -lt 80800 ] ; then mkdir -p $CABALHOME/bin && ln -sf "$HOME/.hlint/hlint-$HLINTVER/hlint" $CABALHOME/bin/hlint ; fi
103+ - if [ $HCNUMVER -lt 80800 ] ; then hlint --version ; fi
104+ # Generate cabal.project
105+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
85− - touch cabal.project.local
106+ - touch cabal.project
107+ - |
108+ echo "packages: ." >> cabal.project
109+ - |
86− - "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"
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"
87 - cat cabal.project || true
111 - cat cabal.project || true
88 - cat cabal.project.local || true
112 - cat cabal.project.local || true
89− - if [ -f "./configure.ac" ]; then
113+ - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
90− (cd "." && autoreconf -i);
114+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
91− fi
115+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
92− - rm -f cabal.project.freeze
116+ - rm cabal.project.freeze
93− - 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
94− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
118+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
95− - rm -rf .ghc.environment.* "."/dist
96− - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
97−
98−# Here starts the actual work to be performed for the package under test;
99−# any command which exits with a non-zero exit code causes the build to fail.
100script:
119script:
101− # test that source-distributions can be generated
120+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
102− - (cd "." && cabal sdist)
121+ # Packaging...
122+ - ${CABAL} v2-sdist all
123+ # Unpacking...
103− - mv "."/dist/cabal2nix-*.tar.gz ${DISTDIR}/
124+ - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
104 - cd ${DISTDIR} || false
125 - cd ${DISTDIR} || false
105− - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
126+ - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
127+ - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
128+ - PKGDIR_cabal2nix="$(find . -maxdepth 1 -type d -regex '.*/cabal2nix-[0-9.]*')"
129+ # Generate cabal.project
130+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
131+ - touch cabal.project
132+ - |
106− - "printf 'packages: cabal2nix-*/*.cabal\\n' > cabal.project"
133+ echo "packages: ${PKGDIR_cabal2nix}" >> cabal.project
107− - touch cabal.project.local
134+ - |
108− - "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"
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"
109 - cat cabal.project || true
136 - cat cabal.project || true
110 - cat cabal.project.local || true
137 - cat cabal.project.local || true
138+ # Building...
111 # this builds all libraries and executables (without tests/benchmarks)
139 # this builds all libraries and executables (without tests/benchmarks)
112− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
140+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
113−
141+ # Building with tests and benchmarks...
114 # build & run tests, build benchmarks
142 # build & run tests, build benchmarks
115− - cabal new-build -w ${HC} ${TEST} ${BENCH} all
143+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
116− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
144+ # Testing...
117−
145+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
118− # doctest
146+ # Doctest...
119− - if [ $HCNUMVER -ge 80000 ]; then (cd cabal2nix-* && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen -XMonadFailDesugaring src); fi
147+ - (cd ${PKGDIR_cabal2nix} && doctest -i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen src)
120−
148+ # HLint..
121− # hlint
149+ - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint src) ; fi
122− - if [ $HCNUMVER -eq 80403 ]; then (cd cabal2nix-* && hlint -XMonadFailDesugaring src); fi
150+ - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint hackage2nix) ; fi
123−
151+ - if [ $HCNUMVER -lt 80800 ] ; then (cd ${PKGDIR_cabal2nix} && hlint cabal2nix) ; fi
124− # cabal check
152+ # cabal check...
125− - (cd cabal2nix-* && cabal check)
153+ - (cd ${PKGDIR_cabal2nix} && ${CABAL} -vnormal check)
126−
127− # haddock
154+ # haddock...
128− - rm -rf ./dist-newstyle
155+ - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
129− - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
130−
131− # Build without installed constraints for packages in global-db
156+ # Building without installed constraints for packages in global-db...
132− - 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
157+ - rm -f cabal.project.local
133−
158+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
159+
134−# REGENDATA ["--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","--hlint","-o",".travis.yml","cabal2nix.cabal"]
160+# REGENDATA ("0.9.20200306",["--installed=+all -Cabal","--hlint","--doctest","--doctest-options=-i ../dist-newstyle/build/*/*/cabal2nix-*/build/autogen","-o",".travis.yml","cabal2nix.cabal","--head-hackage","--head-hackage-jobs","> 8.8"])
135# EOF
161# 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 obviously still causes network traffic. Run the
30+code to compute the hash, which still causes network traffic. Run the utility
31−utility with `--help` to see the complete list of supported command line flags.
31+with `--help` to see the complete list of supported command-line flags.
32
32
33−Detailed instructions how to use those generated files with Nix can be found at
33+Detailed instructions on how to use those generated files with Nix can be found at
34−http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure.
34+https://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages.
35
35
36`cabal2nix` can also build derivations for projects from other sources than
36`cabal2nix` can also build derivations for projects from other sources than
37−hackage. You only need to provide an URI that points to a cabal project. The
37+Hackage. You only need to provide a URI that points to a cabal project. The
38−most common usecase for this is probably to generate a derivation for a project
38+most common use-case for this is probably to generate a derivation for a
39−on the local file system:
39+project 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+29−81
@@ -1,5 +1,5 @@
1name: cabal2nix
1name: cabal2nix
2−version: 2.11
2+version: 2.15.1
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,73 +8,26 @@ 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,
11+author: Peter Simons, Andres Loeh, Benno Fünfstück, Mateusz Kowalczyk,
12− Andres Loeh,
13− Benno Fünfstück,
14− Mateusz Kowalczyk,
15− Michael Alan Dorman,
12+ Michael Alan Dorman, Tom Smalley, Mathijs Kwik, Shea Levy, Dmitry
16− Tom Smalley,
17− Mathijs Kwik,
18− Shea Levy,
19− Dmitry Malikov,
20− Eric Seidel,
21− Jacob Mitchell,
22− Graham Christensen,
13+ Malikov, Eric Seidel, Jacob Mitchell, Graham Christensen,
23− Hamish Mackenzie,
14+ Hamish Mackenzie, Nikolay Amiantov, Aycan iRiCAN, Bryan
24− Nikolay Amiantov,
25− Aycan iRiCAN,
26− Bryan Gardiner,
27− Joe Hermaszewski,
15+ Gardiner, Joe Hermaszewski, John Wiegley, Philipp Hausmann,
28− John Wiegley,
29− Philipp Hausmann,
30− Spencer Janssen,
16+ Spencer Janssen, Tom Hunger, William Casarin, koral,
31− Tom Hunger,
32− William Casarin,
33− koral,
34− ksaric,
35− Adam Vogt,
36− Alexey Shmalko,
17+ ksaric, Adam Vogt, Alexey Shmalko, Corey O'Connor, Cray
37− Corey O'Connor,
38− Cray Elliott,
39− David Johnson,
18+ Elliott, David Johnson, Dmitry Bushev, Domen Kožar, Felix
40− Dmitry Bushev,
41− Domen Kožar,
42− Felix Kunzmann,
43− Gabriel Ebner,
44− Gergely Risko,
45− Joachim Fasting,
19+ Kunzmann, Gabriel Ebner, Gergely Risko, Joachim Fasting,
46− John Albietz,
47− John Chee,
48− Jussi Maki,
49− Lisanna Dettwyler,
20+ John Albietz, John Chee, Jussi Maki, Lisanna Dettwyler,
50− Mark Laws,
51− Mark Wotton,
52− Matthew Pickering,
21+ Mark Laws, Mark Wotton, Matthew Pickering, Matthew Stewart,
53− Matthew Stewart,
54− Matvey Aksenov,
55− Nicholas Clarke,
22+ Matvey Aksenov, Nicholas Clarke, Nicolas Rolland, Oliver
56− Nicolas Rolland,
57− Oliver Charles,
58− Pascal Wittmann,
59− Patrick John Wheeler,
23+ Charles, Pascal Wittmann, Patrick John Wheeler, Phil de
60− Phil de Joux,
61− Piotr Bogdan,
62− Profpatsch,
63− Raymond Gauthier,
24+ Joux, Piotr Bogdan, Profpatsch, Raymond Gauthier, Renzo
64− Renzo Carbonara,
65− Rodney Lorrimar,
25+ Carbonara, Rodney Lorrimar, Sibi, Sukant Hajra, Tanner
66− Sibi,
67− Sukant Hajra,
68− Tanner Doshier,
69− Vaibhav Sagar,
70− Viktar Basharymau,
26+ Doshier, Vaibhav Sagar, Viktar Basharymau, danbst, karsten
71− danbst,
72− karsten gebbert,
73− laMudri,
74− Александр Цамутали
27+ gebbert, laMudri, Александр Цамутали
75maintainer: Peter Simons <simons@cryp.to>
28maintainer: Peter Simons <simons@cryp.to>
76stability: stable
29stability: stable
77−tested-with: GHC == 8.4.3, GHC == 8.6.1
30+tested-with: GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.1
78category: Distribution, Nix
31category: Distribution, Nix
79homepage: https://github.com/nixos/cabal2nix#readme
32homepage: https://github.com/nixos/cabal2nix#readme
80bug-reports: https://github.com/nixos/cabal2nix/issues
33bug-reports: https://github.com/nixos/cabal2nix/issues
@@ -107,15 +60,15 @@ library
107 Distribution.Nixpkgs.Haskell.PackageSourceSpec
60 Distribution.Nixpkgs.Haskell.PackageSourceSpec
108 other-modules: Paths_cabal2nix
61 other-modules: Paths_cabal2nix
109 hs-source-dirs: src
62 hs-source-dirs: src
110− build-depends: base < 5
63+ build-depends: base > 4.11
111− , Cabal > 2.2
64+ , Cabal == 3.0.*
112− , aeson
65+ , aeson > 1
113 , ansi-wl-pprint
66 , ansi-wl-pprint
114 , bytestring
67 , bytestring
115− , containers
68+ , containers >= 0.5.9
116 , deepseq >= 1.4
69 , deepseq >= 1.4
117 , directory
70 , directory
118− , distribution-nixpkgs >= 1.1.1
71+ , distribution-nixpkgs >= 1.3.1
119 , filepath
72 , filepath
120 , hackage-db >= 2.0.1
73 , hackage-db >= 2.0.1
121 , hopenssl >= 2
74 , hopenssl >= 2
@@ -131,7 +84,6 @@ library
131 , transformers
84 , transformers
132 , yaml
85 , yaml
133 default-language: Haskell2010
86 default-language: Haskell2010
134− default-extensions: MonadFailDesugaring
135 other-extensions: MultiParamTypeClasses
87 other-extensions: MultiParamTypeClasses
136 ScopedTypeVariables
88 ScopedTypeVariables
137 FlexibleInstances
89 FlexibleInstances
@@ -149,7 +101,6 @@ executable cabal2nix
149 hs-source-dirs: cabal2nix
101 hs-source-dirs: cabal2nix
150 build-depends: base, cabal2nix
102 build-depends: base, cabal2nix
151 default-language: Haskell2010
103 default-language: Haskell2010
152− default-extensions: MonadFailDesugaring
153 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
104 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
154 -Wredundant-constraints
105 -Wredundant-constraints
155
106
@@ -159,13 +110,13 @@ executable hackage2nix
159 Paths_cabal2nix
110 Paths_cabal2nix
160 hs-source-dirs: hackage2nix
111 hs-source-dirs: hackage2nix
161 build-depends: base < 5
112 build-depends: base < 5
162− , Cabal > 2.2
113+ , Cabal
163 , aeson
114 , aeson
164 , bytestring
115 , bytestring
165 , cabal2nix
116 , cabal2nix
166 , containers
117 , containers
167 , directory
118 , directory
168− , distribution-nixpkgs >= 1.1.1
119+ , distribution-nixpkgs >= 1.2
169 , filepath
120 , filepath
170 , hopenssl >= 2
121 , hopenssl >= 2
171 , language-nix
122 , language-nix
@@ -176,16 +127,15 @@ executable hackage2nix
176 , optparse-applicative
127 , optparse-applicative
177 , pretty >= 1.1.2
128 , pretty >= 1.1.2
178 default-language: Haskell2010
129 default-language: Haskell2010
179− default-extensions: MonadFailDesugaring
180 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
130 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
181− -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
131+ -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-maxN16
182
132
183test-suite regression-test
133test-suite regression-test
184 type: exitcode-stdio-1.0
134 type: exitcode-stdio-1.0
185 main-is: Main.hs
135 main-is: Main.hs
186 hs-source-dirs: test
136 hs-source-dirs: test
187 build-depends: base
137 build-depends: base
188− , Cabal > 2.2
138+ , Cabal
189 , cabal2nix
139 , cabal2nix
190 , containers
140 , containers
191 , directory
141 , directory
@@ -197,8 +147,6 @@ test-suite regression-test
197 , tasty
147 , tasty
198 , tasty-golden
148 , tasty-golden
199 default-language: Haskell2010
149 default-language: Haskell2010
200− default-extensions: MonadFailDesugaring
201 build-tools: cabal2nix
150 build-tools: cabal2nix
202 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
151 ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
203− -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
152+ -Wredundant-constraints -threaded -with-rtsopts=-K64K
204− -with-rtsopts=-K1K
hackage2nix/Main.hs+24−18
@@ -1,6 +1,5 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3−{-# LANGUAGE CPP #-}
4
3
5module Main ( main ) where
4module Main ( main ) where
6
5
@@ -11,13 +10,10 @@ import Control.Monad
11import Control.Monad.Par.Combinator
10import Control.Monad.Par.Combinator
12import Control.Monad.Par.IO
11import Control.Monad.Par.IO
13import Control.Monad.Trans ( liftIO )
12import Control.Monad.Trans ( liftIO )
14−import Data.List
13+import Data.List ( intercalate )
15import Data.Map.Strict ( Map )
14import Data.Map.Strict ( Map )
16import qualified Data.Map.Strict as Map
15import qualified Data.Map.Strict as Map
17import Data.Maybe
16import Data.Maybe
18−#if !MIN_VERSION_base(4,11,0)
19−import Data.Monoid
20−#endif
21import Data.Set ( Set )
17import Data.Set ( Set )
22import qualified Data.Set as Set
18import qualified Data.Set as Set
23import Data.String
19import Data.String
@@ -27,10 +23,11 @@ import Distribution.Nixpkgs.Haskell.Constraint
27import Distribution.Nixpkgs.Haskell.FromCabal
23import Distribution.Nixpkgs.Haskell.FromCabal
28import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
24import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config
29import Distribution.Nixpkgs.Haskell.FromCabal.Flags
25import Distribution.Nixpkgs.Haskell.FromCabal.Flags
26+import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
30import Distribution.Nixpkgs.Meta
27import Distribution.Nixpkgs.Meta
31import Distribution.Nixpkgs.PackageMap
28import Distribution.Nixpkgs.PackageMap
32import Distribution.Package
29import Distribution.Package
33−import Distribution.PackageDescription hiding ( options, buildDepends, extraLibs, buildTools, homepage )
30+import Distribution.PackageDescription hiding ( options, extraLibs, buildTools, homepage )
34import Distribution.System
31import Distribution.System
35import Distribution.Text
32import Distribution.Text
36import Distribution.Version
33import Distribution.Version
@@ -66,7 +63,7 @@ main = do
66 pinfo :: ParserInfo CLI
63 pinfo :: ParserInfo CLI
67 pinfo = info
64 pinfo = info
68 ( helper
65 ( helper
69− <*> infoOption ("hackage2nix " ++ display Main.version) (long "version" <> help "Show version number")
66+ <*> infoOption ("hackage2nix " ++ prettyShow Main.version) (long "version" <> help "Show version number")
70 <*> cliOptions
67 <*> cliOptions
71 )
68 )
72 ( fullDesc
69 ( fullDesc
@@ -75,13 +72,15 @@ main = do
75 CLI {..} <- execParser pinfo
72 CLI {..} <- execParser pinfo
76
73
77 config <- readConfiguration (nixpkgsRepository </> configFile)
74 config <- readConfiguration (nixpkgsRepository </> configFile)
78− nixpkgs <- readNixpkgPackageMap nixpkgsRepository Nothing
75+ nixpkgs <- readNixpkgPackageMap ["-f", nixpkgsRepository, "--arg", "config", "{ allowAliases = false; }"]
79 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
76 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
80 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
77 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
81 . Map.delete "som" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
78 . Map.delete "som" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
82 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
79 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
83 . Map.delete "control-invariants" -- TODO: depends on "assert"
80 . 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"
84− . over (at ("hermes")) ((fmap (set (contains "1.3.4.3") False))) -- TODO: https://github.com/haskell/hackage-server/issues/436
83+ . over (at "hermes") (fmap (set (contains "1.3.4.3") False)) -- TODO: https://github.com/haskell/hackage-server/issues/436
85 hackage <- fixup <$> readHackage hackageRepository
84 hackage <- fixup <$> readHackage hackageRepository
86 let
85 let
87 hackagePackagesFile :: FilePath
86 hackagePackagesFile :: FilePath
@@ -94,7 +93,7 @@ main = do
94 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
93 latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))
95
94
96 defaultPackageOverridesSet :: PackageSet
95 defaultPackageOverridesSet :: PackageSet
97− defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _) <- defaultPackageOverrides config ]
96+ defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _ _) <- defaultPackageOverrides config ]
98
97
99 generatedDefaultPackageSet :: PackageSet
98 generatedDefaultPackageSet :: PackageSet
100 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
99 generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet
@@ -107,7 +106,7 @@ main = do
107
106
108 extraPackageSet :: PackageMultiSet
107 extraPackageSet :: PackageMultiSet
109 extraPackageSet = Map.unionsWith Set.union
108 extraPackageSet = Map.unionsWith Set.union
110− [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _) <- extraPackages config ]
109+ [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _ _) <- extraPackages config ]
111
110
112 db :: PackageMultiSet
111 db :: PackageMultiSet
113 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
112 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
@@ -117,7 +116,7 @@ main = do
117 ]
116 ]
118
117
119 haskellResolver :: Dependency -> Bool
118 haskellResolver :: Dependency -> Bool
120− haskellResolver (Dependency name vrange)
119+ haskellResolver (Dependency name vrange _)
121 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
120 | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange
122 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
121 | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange
123 | otherwise = False
122 | otherwise = False
@@ -136,8 +135,13 @@ main = do
136 (descr, cabalSHA256) <- readPackage hackageRepository pkgId
135 (descr, cabalSHA256) <- readPackage hackageRepository pkgId
137 meta <- readPackageMeta hackageRepository pkgId
136 meta <- readPackageMeta hackageRepository pkgId
138
137
139− let isInDefaultPackageSet :: Bool
138+ let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool
140− isInDefaultPackageSet = maybe False (== v) (Map.lookup name generatedDefaultPackageSet)
139+ isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)
140+ isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)
141+ isBroken = any (withinRange v) [ vr | Dependency pn vr _ <- brokenPackages config, pn == name ]
142+
143+ droppedPlatforms :: Set Platform
144+ droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)
141
145
142 tarballSHA256 :: SHA256Hash
146 tarballSHA256 :: SHA256Hash
143 tarballSHA256 = fromMaybe (error (display pkgId ++ ": meta data has no hash for the tarball"))
147 tarballSHA256 = fromMaybe (error (display pkgId ++ ": meta data has no hash for the tarball"))
@@ -153,13 +157,15 @@ main = do
153 drv = fromGenericPackageDescription haskellResolver nixpkgsResolver targetPlatform (compilerInfo config) flagAssignment [] descr
157 drv = fromGenericPackageDescription haskellResolver nixpkgsResolver targetPlatform (compilerInfo config) flagAssignment [] descr
154 & src .~ urlDerivationSource ("mirror://hackage/" ++ display pkgId ++ ".tar.gz") tarballSHA256
158 & src .~ urlDerivationSource ("mirror://hackage/" ++ display pkgId ++ ".tar.gz") tarballSHA256
155 & editedCabalFile .~ cabalSHA256
159 & editedCabalFile .~ cabalSHA256
156− & metaSection.hydraPlatforms %~ (`Set.difference` Map.findWithDefault Set.empty name (dontDistributePackages config))
160+ & metaSection.platforms %~ (`Set.difference` Map.findWithDefault Set.empty name (unsupportedPlatforms config))
161+ & metaSection.hydraPlatforms %~ (if Set.null droppedPlatforms then id else (`Set.difference` droppedPlatforms))
162+ & metaSection.hydraPlatforms %~ (if isHydraEnabled then id else const Set.empty)
163+ & metaSection.broken ||~ isBroken
157 & metaSection.maintainers .~ Map.findWithDefault Set.empty name globalPackageMaintainers
164 & metaSection.maintainers .~ Map.findWithDefault Set.empty name globalPackageMaintainers
158− & metaSection.hydraPlatforms %~ (if isInDefaultPackageSet then id else const Set.empty)
159 & metaSection.homepage .~ ""
165 & metaSection.homepage .~ ""
160
166
161 overrides :: Doc
167 overrides :: Doc
162− overrides = fcat $ punctuate space [ disp b <> semi | b <- Set.toList ((view (dependencies . each) drv) `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]
168+ overrides = fcat $ punctuate space [ pPrint b <> semi | b <- Set.toList (view (dependencies . each) drv `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]
163 return $ render $ nest 2 $
169 return $ render $ nest 2 $
164 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
170 hang (doubleQuotes (text attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi)
165
171
@@ -199,7 +205,7 @@ resolveConstraint c = fromMaybe (error msg) . resolveConstraint' c
199 ]
205 ]
200
206
201resolveConstraint' :: Constraint -> Hackage -> Maybe Version
207resolveConstraint' :: Constraint -> Hackage -> Maybe Version
202−resolveConstraint' (Dependency name vrange) hackage
208+resolveConstraint' (Dependency name vrange _) hackage
203 | Just vset' <- Map.lookup name hackage
209 | Just vset' <- Map.lookup name hackage
204 , vset <- Set.filter (`withinRange` vrange) vset'
210 , vset <- Set.filter (`withinRange` vrange) vset'
205 , not (Set.null vset) = Just (Set.findMax vset)
211 , not (Set.null vset) = Just (Set.findMax vset)
hackage2nix/README.md+3
@@ -15,6 +15,9 @@ and we want to check that hackage-packages.nix will be updated correctly.
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+
18#### Setup
21#### Setup
19Replace `git@github.com:NixOS/nixpkgs.git` with a fork you have access to.
22Replace `git@github.com:NixOS/nixpkgs.git` with a fork you have access to.
20```
23```
src/Cabal2nix.hs+23−15
@@ -11,14 +11,12 @@ 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
14+import Data.List ( intercalate, isPrefixOf )
15import Data.List.Split
15import Data.List.Split
16import Data.Maybe ( fromMaybe, isJust, listToMaybe )
16import Data.Maybe ( fromMaybe, isJust, listToMaybe )
17−import Data.Monoid ( (<>) )
18import qualified Data.Set as Set
17import qualified Data.Set as Set
19import Data.String
18import Data.String
20import Data.Time
19import Data.Time
21−import qualified Distribution.Compat.ReadP as P
22import Distribution.Compiler
20import Distribution.Compiler
23import Distribution.Nixpkgs.Fetch
21import Distribution.Nixpkgs.Fetch
24import Distribution.Nixpkgs.Haskell
22import Distribution.Nixpkgs.Haskell
@@ -26,13 +24,14 @@ import Distribution.Nixpkgs.Haskell.FromCabal
26import Distribution.Nixpkgs.Haskell.FromCabal.Flags
24import Distribution.Nixpkgs.Haskell.FromCabal.Flags
27import qualified Distribution.Nixpkgs.Haskell.FromCabal.PostProcess as PP (pkg)
25import qualified Distribution.Nixpkgs.Haskell.FromCabal.PostProcess as PP (pkg)
28import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
26import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
27+import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
29import Distribution.Nixpkgs.Haskell.PackageSourceSpec
28import Distribution.Nixpkgs.Haskell.PackageSourceSpec
30import Distribution.Nixpkgs.Meta
29import Distribution.Nixpkgs.Meta
31−import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )
32import Distribution.Package ( packageId )
30import Distribution.Package ( packageId )
31+import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )
32+import Distribution.Parsec as P
33import Distribution.Simple.Utils ( lowercase )
33import Distribution.Simple.Utils ( lowercase )
34import Distribution.System
34import Distribution.System
35−import Distribution.Text
36import Language.Nix
35import Language.Nix
37import Options.Applicative
36import Options.Applicative
38import Paths_cabal2nix ( version )
37import Paths_cabal2nix ( version )
@@ -46,9 +45,10 @@ data Options = Options
46 , optMaintainer :: [String]
45 , optMaintainer :: [String]
47--, optPlatform :: [String] -- TODO: fix command line handling of platforms
46--, optPlatform :: [String] -- TODO: fix command line handling of platforms
48 , optHaddock :: Bool
47 , optHaddock :: Bool
49− , optHpack :: Bool
48+ , optHpack :: HpackUse
50 , optDoCheck :: Bool
49 , optDoCheck :: Bool
51 , optJailbreak :: Bool
50 , 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
@@ -73,9 +73,17 @@ options = Options
73 <*> many (strOption $ long "maintainer" <> metavar "MAINTAINER" <> help "maintainer of this package (may be specified multiple times)")
73 <*> 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)")
74-- <*> 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")
75 <*> flag True False (long "no-haddock" <> help "don't run Haddock when building this package")
76+ <*>
77+ (
76− <*> switch (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
78+ flag' ForceHpack (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
79+ <|>
80+ flag' NoHpack (long "no-hpack" <> help "disable hpack run and use only cabal disregarding package.yaml existence")
81+ <|>
82+ pure PackageYamlHpack
83+ )
77 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
84 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
78 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
85 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
86+ <*> switch (long "benchmark" <> help "enable benchmarks for this package")
79 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
87 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
80 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
88 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
81 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
89 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
@@ -85,8 +93,8 @@ options = Options
85 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
93 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
86 <*> switch (long "shell" <> help "generate output suitable for nix-shell")
94 <*> switch (long "shell" <> help "generate output suitable for nix-shell")
87 <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")
95 <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")
88− <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)
96+ <*> option parseCabal (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith prettyShow)
89− <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
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)
90 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
98 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
91 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
99 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
92 <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
100 <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))
@@ -101,10 +109,8 @@ utcTimeReader = eitherReader $ \arg ->
101 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
109 Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
102 Just utcTime -> Right utcTime
110 Just utcTime -> Right utcTime
103
111
104−readP :: P.ReadP a a -> ReadM a
112+parseCabal :: Parsec a => ReadM a
105−readP p = eitherReader $ \s -> case [ r' | (r',"") <- P.readP_to_S p s ] of
113+parseCabal = eitherReader eitherParsec
106− (r:_) -> Right r
107− _ -> Left ("invalid value " ++ show s)
108
114
109-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
115-- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4
110-- since the output of that is what Cabal parses.
116-- since the output of that is what Cabal parses.
@@ -129,6 +135,7 @@ ghcConvertOS os = case os of
129 "watchos" -> "ios"
135 "watchos" -> "ios"
130 "tvos" -> "ios"
136 "tvos" -> "ios"
131 "linux-android" -> "linux-android"
137 "linux-android" -> "linux-android"
138+ "linux-androideabi" -> "linux-androideabi"
132 _ | "linux-" `isPrefixOf` os -> "linux"
139 _ | "linux-" `isPrefixOf` os -> "linux"
133 _ -> fromMaybe os $ listToMaybe
140 _ -> fromMaybe os $ listToMaybe
134 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
141 [prefix | prefix <- osPrefixes, prefix `isPrefixOf` os]
@@ -155,7 +162,7 @@ parsePlatformParts = \case
155pinfo :: ParserInfo Options
162pinfo :: ParserInfo Options
156pinfo = info
163pinfo = info
157 ( helper
164 ( helper
158− <*> infoOption ("cabal2nix " ++ display version) (long "version" <> help "Show version number")
165+ <*> infoOption ("cabal2nix " ++ prettyShow version) (long "version" <> help "Show version number")
159 <*> options
166 <*> options
160 )
167 )
161 ( fullDesc
168 ( fullDesc
@@ -184,7 +191,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() ->
184 cabal2nix =<< getArgs
191 cabal2nix =<< getArgs
185
192
186hpackOverrides :: Derivation -> Derivation
193hpackOverrides :: Derivation -> Derivation
187−hpackOverrides = over phaseOverrides (++ "preConfigure = \"hpack\";")
194+hpackOverrides = over phaseOverrides (++ "prePatch = \"hpack\";")
188 . set (libraryDepends . tool . contains (PP.pkg "hpack")) True
195 . set (libraryDepends . tool . contains (PP.pkg "hpack")) True
189
196
190cabal2nix' :: Options -> IO (Either Doc Derivation)
197cabal2nix' :: Options -> IO (Either Doc Derivation)
@@ -228,6 +235,7 @@ processPackage Options{..} pkg = do
228 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
235 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
229-- & metaSection.platforms .~ Set.fromList optPlatform
236-- & metaSection.platforms .~ Set.fromList optPlatform
230 & doCheck &&~ optDoCheck
237 & doCheck &&~ optDoCheck
238+ & doBenchmark ||~ optDoBenchmark
231 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
239 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
232
240
233 shell :: Doc
241 shell :: Doc
src/Distribution/Nixpkgs/Fetch.hs+3−1
@@ -161,7 +161,9 @@ fetchWith (supportsRev, kind, addArgs) source = do
161 ExitFailure _ -> return Nothing
161 ExitFailure _ -> return Nothing
162 ExitSuccess -> do
162 ExitSuccess -> do
163 buf <- BS.hGetContents stdoutH
163 buf <- BS.hGetContents stdoutH
164− let (l:ls) = reverse (BS.lines buf)
164+ let (l,ls) = case reverse (BS.lines buf) of
165+ [] -> error "This can't happen, but GHC doesn't know that."
166+ (x:xs) -> (x,xs)
165 buf' = BS.unlines (reverse ls)
167 buf' = BS.unlines (reverse ls)
166 case length ls of
168 case length ls of
167 0 -> return Nothing
169 0 -> return Nothing
src/Distribution/Nixpkgs/Haskell/Constraint.hs+1−1
@@ -9,7 +9,7 @@ import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
9type Constraint = Dependency
9type Constraint = Dependency
10
10
11satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool
11satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool
12−satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr) = (pn /= cn) || (v `withinRange` vr)
12+satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr _) = (pn /= cn) || (v `withinRange` vr)
13
13
14satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool
14satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool
15satisfiesConstraints p = all (satisfiesConstraint p)
15satisfiesConstraints p = all (satisfiesConstraint p)
src/Distribution/Nixpkgs/Haskell/Derivation.hs+7−4
@@ -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, testTarget, hyperlinkSource, enableSplitObjs
10+ , cabalFlags, runHaddock, jailbreak, doCheck, doBenchmark, 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
18+import Data.List ( isPrefixOf )
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,6 +55,7 @@ data Derivation = MkDerivation
55 , _runHaddock :: Bool
55 , _runHaddock :: Bool
56 , _jailbreak :: Bool
56 , _jailbreak :: Bool
57 , _doCheck :: Bool
57 , _doCheck :: Bool
58+ , _doBenchmark :: Bool
58 , _testTarget :: String
59 , _testTarget :: String
59 , _hyperlinkSource :: Bool
60 , _hyperlinkSource :: Bool
60 , _enableLibraryProfiling :: Bool
61 , _enableLibraryProfiling :: Bool
@@ -86,6 +87,7 @@ nullDerivation = MkDerivation
86 , _runHaddock = error "undefined Derivation.runHaddock"
87 , _runHaddock = error "undefined Derivation.runHaddock"
87 , _jailbreak = error "undefined Derivation.jailbreak"
88 , _jailbreak = error "undefined Derivation.jailbreak"
88 , _doCheck = error "undefined Derivation.doCheck"
89 , _doCheck = error "undefined Derivation.doCheck"
90+ , _doBenchmark = error "undefined Derivation.doBenchmark"
89 , _testTarget = error "undefined Derivation.testTarget"
91 , _testTarget = error "undefined Derivation.testTarget"
90 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
92 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
91 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
93 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
@@ -110,8 +112,8 @@ instance Pretty Derivation where
110 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
112 pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
111 [ text "mkDerivation" <+> lbrace
113 [ text "mkDerivation" <+> lbrace
112 , nest 2 $ vcat
114 , nest 2 $ vcat
113− [ attr "pname" $ doubleQuotes $ disp (packageName _pkgid)
115+ [ attr "pname" $ doubleQuotes $ pPrint (packageName _pkgid)
114− , attr "version" $ doubleQuotes $ disp (packageVersion _pkgid)
116+ , attr "version" $ doubleQuotes $ pPrint (packageVersion _pkgid)
115 , pPrint _src
117 , pPrint _src
116 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
118 , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack
117 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
119 , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
@@ -131,6 +133,7 @@ instance Pretty Derivation where
131 , boolattr "doHaddock" (not _runHaddock) _runHaddock
133 , boolattr "doHaddock" (not _runHaddock) _runHaddock
132 , boolattr "jailbreak" _jailbreak _jailbreak
134 , boolattr "jailbreak" _jailbreak _jailbreak
133 , boolattr "doCheck" (not _doCheck) _doCheck
135 , boolattr "doCheck" (not _doCheck) _doCheck
136+ , boolattr "doBenchmark" _doBenchmark _doBenchmark
134 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
137 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
135 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
138 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
136 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
139 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
src/Distribution/Nixpkgs/Haskell/FromCabal.hs+14−14
@@ -11,7 +11,6 @@ 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
15import Distribution.Nixpkgs.Haskell
14import Distribution.Nixpkgs.Haskell
16import qualified Distribution.Nixpkgs.Haskell as Nix
15import qualified Distribution.Nixpkgs.Haskell as Nix
17import Distribution.Nixpkgs.Haskell.Constraint
16import Distribution.Nixpkgs.Haskell.Constraint
@@ -59,14 +58,14 @@ finalizeGenericPackageDescription haskellResolver arch compiler flags constraint
59 }
58 }
60
59
61 jailbroken :: HaskellResolver -> HaskellResolver
60 jailbroken :: HaskellResolver -> HaskellResolver
62− jailbroken resolver (Dependency pkg _) = resolver (Dependency pkg anyVersion)
61+ jailbroken resolver (Dependency pkg _ _) = resolver (Dependency pkg anyVersion mempty)
63
62
64 withInternalLibs :: HaskellResolver -> HaskellResolver
63 withInternalLibs :: HaskellResolver -> HaskellResolver
65 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
64 withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d
66
65
67 internalNames :: [PackageName]
66 internalNames :: [PackageName]
68 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
67 internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]
69− ++ [ unqualComponentNameToPackageName n | Just n <- libName <$> subLibraries (packageDescription genDesc) ]
68+ ++ [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries (packageDescription genDesc) ]
70
69
71 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
70 in case finalize (jailbroken (withInternalLibs haskellResolver)) of
72 Left m -> case finalize (const True) of
71 Left m -> case finalize (const True) of
@@ -92,6 +91,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
92 & runHaddock .~ doHaddockPhase
91 & runHaddock .~ doHaddockPhase
93 & jailbreak .~ False
92 & jailbreak .~ False
94 & doCheck .~ True
93 & 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 nixLicense == Nix.Known "stdenv.lib.licenses.unfree" then Set.empty else Nix.allKnownPlatforms)
111+ & Nix.hydraPlatforms .~ (if isFreeLicense nixLicense then Nix.allKnownPlatforms else Set.empty)
112 & Nix.maintainers .~ mempty
112 & Nix.maintainers .~ mempty
113 & Nix.broken .~ not (null missingDeps)
113 & Nix.broken .~ not (null missingDeps)
114 )
114 )
@@ -116,10 +116,10 @@ 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 = fromCabalLicense (either licenseFromSPDX id licenseRaw)
119+ nixLicense = either fromSPDXLicense fromCabalLicense licenseRaw
120
120
121 resolveInHackage :: Identifier -> Binding
121 resolveInHackage :: Identifier -> Binding
122− resolveInHackage i | (i^.ident) `elem` [ unPackageName n | (Dependency n _) <- missingDeps ] = bindNull i
122+ resolveInHackage i | (i^.ident) `elem` [ unPackageName n | (Dependency n _ _) <- missingDeps ] = bindNull i
123 | otherwise = binding # (i, path # ["self",i]) -- TODO: "self" shouldn't be hardcoded.
123 | otherwise = binding # (i, path # ["self",i]) -- TODO: "self" shouldn't be hardcoded.
124
124
125 -- TODO: This is all very confusing. Haskell packages refer to the Nixpkgs
125 -- TODO: This is all very confusing. Haskell packages refer to the Nixpkgs
@@ -136,19 +136,19 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
136 resolveInNixpkgs :: Identifier -> Binding
136 resolveInNixpkgs :: Identifier -> Binding
137 resolveInNixpkgs i
137 resolveInNixpkgs i
138 | i `elem` ["clang","lldb","llvm"] = binding # (i, path # ["self","llvmPackages",i]) -- TODO: evil!
138 | i `elem` ["clang","lldb","llvm"] = binding # (i, path # ["self","llvmPackages",i]) -- TODO: evil!
139− | i == "gtk2" = binding # (i, path # ["pkgs","gnome2","gtk"])
139+ | i == "gtk2" = binding # (i, path # ["pkgs","gtk2"]) -- TODO: these cases should not be necessary
140− | i == "gtk3" = binding # (i, path # ["pkgs","gnome3","gtk"])
140+ | i == "gtk3" = binding # (i, path # ["pkgs","gtk3"])
141− | i == "gtksourceview3" = binding # (i, path # ["pkgs","gnome3","gtksourceview"])
141+ | i == "gtksourceview3" = binding # (i, path # ["pkgs","gtksourceview3"])
142− | i == "vte_291" = binding # (i, path # ["pkgs","gnome3","vte"])
142+ | i == "vte_291" = binding # (i, path # ["pkgs","vte"])
143 | Just p <- nixpkgsResolver i, init (view (reference . path) p) `Set.member` goodScopes = p
143 | Just p <- nixpkgsResolver i, init (view (reference . path) p) `Set.member` goodScopes = p
144 | otherwise = bindNull i
144 | otherwise = bindNull i
145
145
146 resolveInHackageThenNixpkgs :: Identifier -> Binding
146 resolveInHackageThenNixpkgs :: Identifier -> Binding
147− resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion) = resolveInHackage i
147+ resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion mempty) = resolveInHackage i
148 | otherwise = resolveInNixpkgs i
148 | otherwise = resolveInNixpkgs i
149
149
150 internalLibNames :: [PackageName]
150 internalLibNames :: [PackageName]
151− internalLibNames = fmap unqualComponentNameToPackageName . catMaybes $ libName <$> subLibraries
151+ internalLibNames = [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries ]
152
152
153 doHaddockPhase :: Bool
153 doHaddockPhase :: Bool
154 doHaddockPhase | not (null internalLibNames) = False
154 doHaddockPhase | not (null internalLibNames) = False
@@ -158,7 +158,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
158 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
158 convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
159 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
159 convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
160 convertBuildInfo Cabal.BuildInfo {..} = mempty
160 convertBuildInfo Cabal.BuildInfo {..} = mempty
161− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- targetBuildDepends, x `notElem` internalLibNames ]
161+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- targetBuildDepends, x `notElem` internalLibNames ]
162 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
162 & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]
163 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
163 & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]
164 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
164 & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName
@@ -166,7 +166,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
166
166
167 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
167 convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo
168 convertSetupBuildInfo bi = mempty
168 convertSetupBuildInfo bi = mempty
169− & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- Cabal.setupDepends bi ]
169+ & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- Cabal.setupDepends bi ]
170
170
171bindNull :: Identifier -> Binding
171bindNull :: Identifier -> Binding
172bindNull i = binding # (i, path # ["null"])
172bindNull i = binding # (i, path # ["null"])
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+28−32
@@ -1,16 +1,21 @@
1{-# LANGUAGE RecordWildCards #-}
1{-# LANGUAGE RecordWildCards #-}
2−{-# LANGUAGE CPP #-}
3{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE OverloadedStrings #-}
5{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE DeriveGeneric #-}
6{-# OPTIONS_GHC -fno-warn-orphans #-}
5{-# OPTIONS_GHC -fno-warn-orphans #-}
7
6
8−module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
7+module Distribution.Nixpkgs.Haskell.FromCabal.Configuration
8+ ( Configuration(..), readConfiguration, assertConsistency
9+ )
10+ where
11+
12+import Prelude hiding ( fail )
9
13
10−import Control.Exception ( throwIO )
11import Control.DeepSeq
14import Control.DeepSeq
15+import Control.Exception ( throwIO )
12import Control.Lens
16import Control.Lens
13−import Control.Monad
17+import Control.Monad hiding ( fail )
18+import Control.Monad.Fail
14import Data.Aeson
19import Data.Aeson
15import Data.Map as Map
20import Data.Map as Map
16import Data.Set as Set
21import Data.Set as Set
@@ -40,14 +45,22 @@ data Configuration = Configuration
40 -- role during dependency resolution.
45 -- role during dependency resolution.
41 , extraPackages :: [Constraint]
46 , extraPackages :: [Constraint]
42
47
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]
51 }
64 }
52 deriving (Show, Generic)
65 deriving (Show, Generic)
53
66
@@ -59,50 +72,33 @@ instance FromJSON Configuration where
59 <*> o .:? "core-packages" .!= mempty
72 <*> o .:? "core-packages" .!= mempty
60 <*> o .:? "default-package-overrides" .!= mempty
73 <*> o .:? "default-package-overrides" .!= mempty
61 <*> o .:? "extra-packages" .!= mempty
74 <*> o .:? "extra-packages" .!= mempty
62− <*> o .:? "dont-distribute-packages" .!= mempty
63 <*> o .:? "package-maintainers" .!= mempty
75 <*> o .:? "package-maintainers" .!= mempty
76+ <*> o .:? "unsupported-platforms" .!= mempty
77+ <*> o .:? "dont-distribute-packages" .!= mempty
78+ <*> o .:? "broken-packages" .!= mempty
64 parseJSON _ = error "invalid Configuration"
79 parseJSON _ = error "invalid Configuration"
65
80
66instance FromJSON Identifier where
81instance FromJSON Identifier where
67 parseJSON (String s) = pure (review ident (T.unpack s))
82 parseJSON (String s) = pure (review ident (T.unpack s))
68 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Nix identifier")
83 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Nix identifier")
69
84
70−#if MIN_VERSION_aeson(1,0,0)
71−
72instance FromJSONKey Identifier where
85instance FromJSONKey Identifier where
73 fromJSONKey = FromJSONKeyText parseKey
86 fromJSONKey = FromJSONKeyText parseKey
74
87
75instance FromJSONKey PackageName where
88instance FromJSONKey PackageName where
76 fromJSONKey = FromJSONKeyText parseKey
89 fromJSONKey = FromJSONKeyText parseKey
77
90
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−
93parseKey :: FromJSON k => Text -> k
91parseKey :: FromJSON k => Text -> k
94parseKey s = either error id (parseEither parseJSON (String s))
92parseKey s = either error id (parseEither parseJSON (String s))
95
93
96readConfiguration :: FilePath -> IO Configuration
94readConfiguration :: FilePath -> IO Configuration
97−readConfiguration path =
98− decodeFileEither path >>= either throwIO assertConsistency
95+readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency
99
96
100−assertConsistency :: Monad m => Configuration -> m Configuration
97+assertConsistency :: MonadFail m => Configuration -> m Configuration
101assertConsistency cfg@Configuration {..} = do
98assertConsistency cfg@Configuration {..} = do
102 let report msg = fail ("*** configuration error: " ++ msg)
99 let report msg = fail ("*** configuration error: " ++ msg)
103−
104 maintainedPackages = Set.unions (Map.elems packageMaintainers)
100 maintainedPackages = Set.unions (Map.elems packageMaintainers)
105− disabledPackages = Map.keysSet dontDistributePackages
101+ disabledPackages = dontDistributePackages `Set.union` Set.fromList (depPkgName <$> brokenPackages)
106 disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages
102 disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages
107 unless (Set.null disabledMaintainedPackages) $
103 unless (Set.null disabledMaintainedPackages) $
108 report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
104 report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+17−16
@@ -4,6 +4,7 @@ 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
7import Distribution.Package
8import Distribution.Package
8import Distribution.PackageDescription
9import Distribution.PackageDescription
9import Distribution.Version
10import Distribution.Version
@@ -15,30 +16,25 @@ configureCabalFlags' :: PackageIdentifier -> [(FlagName,Bool)]
15configureCabalFlags' (PackageIdentifier name version)
16configureCabalFlags' (PackageIdentifier name version)
16 | name == "accelerate-examples"= [disable "opencl"]
17 | name == "accelerate-examples"= [disable "opencl"]
17 | name == "arithmoi" = [disable "llvm"]
18 | name == "arithmoi" = [disable "llvm"]
19+ | name == "bustle" = [disable "hgettext"] -- https://gitlab.freedesktop.org/bustle/bustle/issues/13
18 | name == "cabal-plan" = [enable "exe"]
20 | name == "cabal-plan" = [enable "exe"]
19 | name == "cassava" = [disable "bytestring--lt-0_10_4"]
21 | name == "cassava" = [disable "bytestring--lt-0_10_4"]
20 | name == "darcs" = [enable "library", enable "force-char8-encoding"]
22 | name == "darcs" = [enable "library", enable "force-char8-encoding"]
21 | name == "diagrams-builder" = [enable "cairo", enable "svg", enable "ps", enable "rasterific"]
23 | name == "diagrams-builder" = [enable "cairo", enable "svg", enable "ps", enable "rasterific"]
24+ | name == "fltkhs" = [enable "opengl"]
22 | name == "folds" = [disable "test-hlint"]
25 | name == "folds" = [disable "test-hlint"]
23 | name == "git-annex" = [ enable "assistant"
26 | name == "git-annex" = [ enable "assistant"
24− , enable "cryptonite"
27+ , disable "benchmark"
25 , enable "dbus"
28 , enable "dbus"
26− , enable "desktopnotify"
29+ , disable "debuglocks"
27− , enable "dns"
28− , enable "feed"
30+ , enable "magicmime"
29− , enable "inotify"
31+ , enable "networkbsd"
30 , enable "pairing"
32 , enable "pairing"
31 , enable "production"
33 , enable "production"
32− , enable "quvi"
34+ , enable "s3"
33− , disable "s3"
34− , enable "tahoe"
35− , enable "tdfa"
36− , ("testsuite", version `withinRange` "< 6.20170925 || >= 6.20171214")
37 , enable "torrentparser"
35 , enable "torrentparser"
38− , disable "webapp"
36+ , enable "webapp"
39− , disable "webapp-secure"
40 , enable "webdav"
37 , enable "webdav"
41− , enable "xmpp"
42 ]
38 ]
43 | name == "haskeline" = [enable "terminfo"]
39 | name == "haskeline" = [enable "terminfo"]
44 | name == "haste-compiler" = [enable "portable"]
40 | name == "haste-compiler" = [enable "portable"]
@@ -51,17 +47,22 @@ configureCabalFlags' (PackageIdentifier name version)
51 | name == "io-streams" = [enable "NoInteractiveTests"]
47 | name == "io-streams" = [enable "NoInteractiveTests"]
52 | name == "liquid-fixpoint" = [enable "build-external"]
48 | name == "liquid-fixpoint" = [enable "build-external"]
53 | name == "pandoc" = [enable "https", disable "trypandoc"]
49 | name == "pandoc" = [enable "https", disable "trypandoc"]
50+ | name == "pandoc-placetable" = [enable "inlineMarkdown"]
54 | name == "persistent-sqlite" = [enable "systemlib"]
51 | name == "persistent-sqlite" = [enable "systemlib"]
55 | name == "reactive-banana-wx" = [disable "buildExamples"]
52 | name == "reactive-banana-wx" = [disable "buildExamples"]
56 | name == "snap-server" = [enable "openssl"]
53 | name == "snap-server" = [enable "openssl"]
54+ | name == "stack" = [enable "disable-git-info", enable "hide-dependency-versions", enable "supported-build"]
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"]
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"]
58 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
56 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
59− | name == "yaml" = [enable "system-libyaml"]
57+ | name == "yaml" = [("system-libyaml", version >= "0.10.1.1")]
60 | name == "yi" = [enable "pango", enable "vty"]
58 | name == "yi" = [enable "pango", enable "vty"]
61 | otherwise = []
59 | otherwise = []
62
60
63enable :: String -> (FlagName,Bool)
61enable :: String -> (FlagName,Bool)
64−enable name = (mkFlagName name, True)
62+enable name = (mkFlagName' name, True)
65
63
66disable :: String -> (FlagName,Bool)
64disable :: String -> (FlagName,Bool)
67−disable name = (mkFlagName name, False)
65+disable name = (mkFlagName' name, False)
66+
67+mkFlagName' :: String -> FlagName
68+mkFlagName' = mkFlagName . map toLower
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+132−3
@@ -1,11 +1,17 @@
1{-# LANGUAGE ViewPatterns #-}
1{-# LANGUAGE ViewPatterns #-}
2
2
3−module Distribution.Nixpkgs.Haskell.FromCabal.License ( fromCabalLicense ) where
3+module Distribution.Nixpkgs.Haskell.FromCabal.License
4+ ( fromCabalLicense
5+ , fromSPDXLicense
6+ , isFreeLicense
7+ ) where
4
8
5−import Distribution.Nixpkgs.License
9+import Data.List (intercalate)
6import Distribution.License ( License(..), knownLicenses )
10import Distribution.License ( License(..), knownLicenses )
11+import Distribution.Nixpkgs.License
12+import Distribution.Pretty (prettyShow)
13+import qualified Distribution.SPDX as SPDX
7import Distribution.Text (display)
14import Distribution.Text (display)
8−import Data.List (intercalate)
9import Distribution.Version
15import Distribution.Version
10
16
11-- TODO: Programmatically strip trailing zeros from license version numbers.
17-- TODO: Programmatically strip trailing zeros from license version numbers.
@@ -39,3 +45,126 @@ fromCabalLicense (UnknownLicense "CC0-1.0") = Known "stdenv.lib.l
39fromCabalLicense (UnknownLicense "BSD3ClauseORApache20") = Known "stdenv.lib.licenses.bsd3"
45fromCabalLicense (UnknownLicense "BSD3ClauseORApache20") = Known "stdenv.lib.licenses.bsd3"
40fromCabalLicense l = error $ "Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown license"
46fromCabalLicense l = error $ "Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown license"
41 ++ show l ++"\nChoose one of: " ++ intercalate ", " (map display knownLicenses)
47 ++ 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+18−7
@@ -29,6 +29,7 @@ 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"
32libNixName "bz2" = return "bzip2"
33libNixName "bz2" = return "bzip2"
33libNixName "c++" = [] -- What is that?
34libNixName "c++" = [] -- What is that?
34libNixName "cairo-gobject" = return "cairo"
35libNixName "cairo-gobject" = return "cairo"
@@ -47,7 +48,7 @@ libNixName "gconf" = return "GConf"
47libNixName "gconf-2.0" = return "GConf"
48libNixName "gconf-2.0" = return "GConf"
48libNixName "gdk-2.0" = return "gtk2"
49libNixName "gdk-2.0" = return "gtk2"
49libNixName "gdk-3.0" = return "gtk3"
50libNixName "gdk-3.0" = return "gtk3"
50−libNixName "gdk-pixbuf-2.0" = return "gdk_pixbuf"
51+libNixName "gdk-pixbuf-2.0" = return "gdk-pixbuf"
51libNixName "gdk-x11-2.0" = return "gdk_x11"
52libNixName "gdk-x11-2.0" = return "gdk_x11"
52libNixName "gdk-x11-3.0" = return "gtk3"
53libNixName "gdk-x11-3.0" = return "gtk3"
53libNixName "gio-2.0" = return "glib"
54libNixName "gio-2.0" = return "glib"
@@ -55,11 +56,11 @@ libNixName "GL" = return "libGL"
55libNixName "GLU" = ["libGLU","libGL"]
56libNixName "GLU" = ["libGLU","libGL"]
56libNixName "glut" = ["freeglut","libGLU","libGL"]
57libNixName "glut" = ["freeglut","libGLU","libGL"]
57libNixName "gnome-keyring" = return "gnome-keyring"
58libNixName "gnome-keyring" = return "gnome-keyring"
58−libNixName "gnome-keyring-1" = return "libgnome_keyring"
59+libNixName "gnome-keyring-1" = return "libgnome-keyring"
59libNixName "gnome-vfs-2.0" = return "gnome-vfs"
60libNixName "gnome-vfs-2.0" = return "gnome-vfs"
60libNixName "gnome-vfs-module-2.0" = return "gnome-vfs_module"
61libNixName "gnome-vfs-module-2.0" = return "gnome-vfs_module"
61libNixName "gobject-2.0" = return "glib"
62libNixName "gobject-2.0" = return "glib"
62−libNixName "gobject-introspection-1.0" = return "gobjectIntrospection"
63+libNixName "gobject-introspection-1.0" = return "gobject-introspection"
63libNixName "gstreamer-audio-0.10" = return "gst-plugins-base"
64libNixName "gstreamer-audio-0.10" = return "gst-plugins-base"
64libNixName "gstreamer-audio-1.0" = return "gst-plugins-base"
65libNixName "gstreamer-audio-1.0" = return "gst-plugins-base"
65libNixName "gstreamer-base-0.10" = return "gst-plugins-base"
66libNixName "gstreamer-base-0.10" = return "gst-plugins-base"
@@ -84,8 +85,8 @@ libNixName "ImageMagick" = return "imagemagick"
84libNixName "Imlib2" = return "imlib2"
85libNixName "Imlib2" = return "imlib2"
85libNixName "iw" = return "wirelesstools"
86libNixName "iw" = return "wirelesstools"
86libNixName "jack" = return "libjack2"
87libNixName "jack" = return "libjack2"
87−libNixName "javascriptcoregtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that.
88+libNixName "javascriptcoregtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that.
88−libNixName "javascriptcoregtk-4.0" = return "webkitgtk" -- This is the current API, so let it reference an alias for the latest version.
89+libNixName "javascriptcoregtk-4.0" = return "webkitgtk"
89libNixName "jpeg" = return "libjpeg"
90libNixName "jpeg" = return "libjpeg"
90libNixName "jvm" = return "jdk"
91libNixName "jvm" = return "jdk"
91libNixName "lapack" = return "liblapack"
92libNixName "lapack" = return "liblapack"
@@ -94,6 +95,9 @@ libNixName "ldap" = return "openldap"
94libNixName "libavutil" = return "ffmpeg"
95libNixName "libavutil" = return "ffmpeg"
95libNixName "libgsasl" = return "gsasl"
96libNixName "libgsasl" = return "gsasl"
96libNixName "libpcre" = return "pcre"
97libNixName "libpcre" = return "pcre"
98+libNixName "libpcre2" = return "pcre2"
99+libNixName "libpcre2-8" = libNixName "libpcre2"
100+libNixName "libqrencode" = return "qrencode"
97libNixName "libR" = return "R"
101libNixName "libR" = return "R"
98libNixName "libsoup-gnome-2.4" = return "libsoup"
102libNixName "libsoup-gnome-2.4" = return "libsoup"
99libNixName "libsystemd" = return "systemd"
103libNixName "libsystemd" = return "systemd"
@@ -104,9 +108,13 @@ libNixName "libzmq" = return "zeromq"
104libNixName "m" = [] -- in stdenv
108libNixName "m" = [] -- in stdenv
105libNixName "magic" = return "file"
109libNixName "magic" = return "file"
106libNixName "MagickWand" = return "imagemagick"
110libNixName "MagickWand" = return "imagemagick"
111+libNixName "mnl" = return "libmnl"
107libNixName "mpi" = return "openmpi"
112libNixName "mpi" = return "openmpi"
108libNixName "ncursesw" = return "ncurses"
113libNixName "ncursesw" = return "ncurses"
109libNixName "netsnmp" = return "net_snmp"
114libNixName "netsnmp" = return "net_snmp"
115+libNixName "nix-expr" = return "nix"
116+libNixName "nix-main" = return "nix"
117+libNixName "nix-store" = return "nix"
110libNixName "notify" = return "libnotify"
118libNixName "notify" = return "libnotify"
111libNixName "odbc" = return "unixODBC"
119libNixName "odbc" = return "unixODBC"
112libNixName "openblas" = return "openblasCompat"
120libNixName "openblas" = return "openblasCompat"
@@ -127,6 +135,7 @@ libNixName "Qt5Gui" = return "qt5"
127libNixName "Qt5Qml" = return "qt5"
135libNixName "Qt5Qml" = return "qt5"
128libNixName "Qt5Quick" = return "qt5"
136libNixName "Qt5Quick" = return "qt5"
129libNixName "Qt5Widgets" = return "qt5"
137libNixName "Qt5Widgets" = return "qt5"
138+libNixName "quadprog" = return "QuadProgpp"
130libNixName "rt" = [] -- in glibc
139libNixName "rt" = [] -- in glibc
131libNixName "rtlsdr" = return "rtl-sdr"
140libNixName "rtlsdr" = return "rtl-sdr"
132libNixName "ruby1.8" = return "ruby"
141libNixName "ruby1.8" = return "ruby"
@@ -152,8 +161,9 @@ libNixName "wayland-client" = return "wayland"
152libNixName "wayland-cursor" = return "wayland"
161libNixName "wayland-cursor" = return "wayland"
153libNixName "wayland-egl" = return "libGL"
162libNixName "wayland-egl" = return "libGL"
154libNixName "wayland-server" = return "wayland"
163libNixName "wayland-server" = return "wayland"
155−libNixName "webkit2gtk-4.0" = return "webkitgtk" -- This is the current API, so let it reference an alias for the latest version.
164+libNixName "webkit2gtk" = return "webkitgtk"
165+libNixName "webkit2gtk-4.0" = return "webkitgtk"
156−libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk-web-extension" -- This package doesn't actually exist in nixpkgs at present.
166+libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk"
157libNixName "webkitgtk-3.0" = return "webkitgtk24x-gtk3" -- These are the old APIs, of which 2.4 is the last provider, so map directly to that
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
158libNixName "X11" = return "libX11"
168libNixName "X11" = return "libX11"
159libNixName "x11" = return "xlibsWrapper"
169libNixName "x11" = return "xlibsWrapper"
@@ -172,6 +182,7 @@ libNixName "Xrender" = return "libXrender"
172libNixName "Xss" = return "libXScrnSaver"
182libNixName "Xss" = return "libXScrnSaver"
173libNixName "Xtst" = return "libXtst"
183libNixName "Xtst" = return "libXtst"
174libNixName "Xxf86vm" = return "libXxf86vm"
184libNixName "Xxf86vm" = return "libXxf86vm"
185+libNixName "yaml" = return "libyaml"
175libNixName "yaml-0.1" = return "libyaml"
186libNixName "yaml-0.1" = return "libyaml"
176libNixName "z" = return "zlib"
187libNixName "z" = return "zlib"
177libNixName "zmq" = return "zeromq"
188libNixName "zmq" = return "zeromq"
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+68−15
@@ -13,6 +13,7 @@ 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
16import Distribution.Package
17import Distribution.Package
17import Distribution.System
18import Distribution.System
18import Distribution.Text
19import Distribution.Text
@@ -21,7 +22,7 @@ import Language.Nix
21
22
22postProcess :: Derivation -> Derivation
23postProcess :: Derivation -> Derivation
23postProcess deriv =
24postProcess deriv =
24− foldr (.) id [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
25+ foldr (.) id [ f | (Dependency n vr _, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
25 . fixGtkBuilds
26 . fixGtkBuilds
26 . fixBuildDependsForTools
27 . fixBuildDependsForTools
27 $ deriv
28 $ deriv
@@ -55,7 +56,7 @@ fixGtkBuilds drv = drv & dependencies . pkgconfig %~ Set.filter (not . collidesW
55-- for a while packages scraped from Hackage will continue to improperly use
56-- for a while packages scraped from Hackage will continue to improperly use
56-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
57-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
57-- also work for Stack). Until that changes, we provide do this to work around
58-- also work for Stack). Until that changes, we provide do this to work around
58−-- those package's brokeness.
59+-- those package's brokenness.
59fixBuildDependsForTools :: Derivation -> Derivation
60fixBuildDependsForTools :: Derivation -> Derivation
60fixBuildDependsForTools = foldr (.) id
61fixBuildDependsForTools = foldr (.) id
61 [ fmap snd $ runState $ do
62 [ fmap snd $ runState $ do
@@ -78,25 +79,33 @@ hooks =
78 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
79 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
79 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
80 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
80 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
81 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
81− , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
82+ , ("bustle", bustleOverrides)
82 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
83 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
83 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
84 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
84 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
85 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
85 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
86 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
87+ , ("cabal2nix > 2", cabal2nixOverrides)
86 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
88 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
87 , ("dbus", set doCheck False) -- don't execute tests that try to access the network
89 , ("dbus", set doCheck False) -- 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
90 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
89 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
91 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
90 , ("freenect < 1.2.1", over configureFlags (Set.union (Set.fromList ["--extra-include-dirs=${pkgs.freenect}/include/libfreenect", "--extra-lib-dirs=${pkgs.freenect}/lib"])))
92 , ("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.
91 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
94 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
92 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
95 , ("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 )
93 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
99 , ("gi-gst", giGstLibOverrides "gstreamer") -- 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
100 , ("gi-gstaudio", 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
101 , ("gi-gstbase", 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
102 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
103+ , ("gi-gtk", set runHaddock True )
97 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
104 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
98 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
105 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
106+ , ("gi-pango", set runHaddock True )
99 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
107 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
108+ , ("gi-vte", set runHaddock True )
100 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
109 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
101 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
110 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
102 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
111 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
@@ -107,6 +116,7 @@ hooks =
107 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
116 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
108 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
117 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
109 , ("gtk3", gtk3Hook)
118 , ("gtk3", gtk3Hook)
119+ , ("gtkglext", gtkglextHook)
110 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
120 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
111 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
121 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
112 , ("haskell-src-exts", set doCheck False)
122 , ("haskell-src-exts", set doCheck False)
@@ -138,9 +148,10 @@ hooks =
138 , ("network-attoparsec", set doCheck False) -- test suite requires network access
148 , ("network-attoparsec", set doCheck False) -- test suite requires network access
139 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
149 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
140 , ("opencv", opencvOverrides)
150 , ("opencv", opencvOverrides)
141− , ("pandoc >= 1.16.0.2", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
151+ , ("pandoc >= 1.16.0.2 && < 2.5", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
142− , ("pandoc", set jailbreak False) -- jailbreak-cabal break the build
152+ , ("pandoc < 2.6", pandocPre26Overrides)
153+ , ("pandoc >= 2.6", pandocOverrides)
143− , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/172
154+ , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/369
144 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
155 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
145 , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
156 , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
146 , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
157 , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
@@ -173,6 +184,7 @@ hooks =
173 , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
184 , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
174 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
185 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
175 , ("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
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
187+ , ("zip-archive >= 0.4", set (testDepends . tool . contains (pkg "which")) True)
176 ]
188 ]
177
189
178pkg :: Identifier -> Binding
190pkg :: Identifier -> Binding
@@ -218,13 +230,12 @@ gitAnnexHook = set phaseOverrides gitAnnexOverrides
218 where
230 where
219 gitAnnexOverrides = unlines
231 gitAnnexOverrides = unlines
220 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
232 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
221− , "installPhase = \"make PREFIX=$out BUILDER=: install\";"
233+ , "postBuild = ''"
222− , "checkPhase = ''"
223 , " ln -sf dist/build/git-annex/git-annex git-annex"
234 , " ln -sf dist/build/git-annex/git-annex git-annex"
224 , " ln -sf git-annex git-annex-shell"
235 , " ln -sf git-annex git-annex-shell"
225− , " export PATH+=\":$PWD\""
226− , " git-annex test"
227 , "'';"
236 , "'';"
237+ , "installPhase = \"make PREFIX=$out BUILDER=: install install-completions\";"
238+ , "checkPhase = ''PATH+=\":$PWD\" git-annex test'';"
228 , "enableSharedExecutables = false;"
239 , "enableSharedExecutables = false;"
229 ]
240 ]
230 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
241 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
@@ -245,7 +256,7 @@ gfPhaseOverrides = unlines
245 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
246 -- Parallel compilation fails. Disable it.
257 -- Parallel compilation fails. Disable it.
247 , "'';"
258 , "'';"
248− , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build:$LD_LIBRARY_PATH'';"
259+ , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH'';"
249 -- The build step itself, after having built the library, needs to be able
260 -- The build step itself, after having built the library, needs to be able
250 -- to find the library it just built in order to compile grammar files.
261 -- to find the library it just built in order to compile grammar files.
251 ]
262 ]
@@ -281,8 +292,8 @@ darcsInstallPostInstall = unlines
281xmonadPostInstall :: String
292xmonadPostInstall :: String
282xmonadPostInstall = unlines
293xmonadPostInstall = unlines
283 [ "postInstall = ''"
294 [ "postInstall = ''"
284− , " install -D man/xmonad.1 $doc/share/man/man1/xmonad.1"
295+ , " install -D man/xmonad.1 ''${!outputDoc}/share/man/man1/xmonad.1"
285− , " install -D man/xmonad.hs $doc/share/doc/$name/sample-xmonad.hs"
296+ , " install -D man/xmonad.hs ''${!outputDoc}/share/doc/$name/sample-xmonad.hs"
286 , "'';"
297 , "'';"
287 ]
298 ]
288
299
@@ -349,8 +360,50 @@ webkitgtk24xHook = set (libraryDepends . pkgconfig . contains (pkg "webkitgtk24x
349opencvOverrides :: Derivation -> Derivation
360opencvOverrides :: Derivation -> Derivation
350opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
361opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
351 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
362 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
352− . set (configureFlags . contains "--with-gcc=${stdenv.cc}/bin/c++") True
353− . set (configureFlags . contains "--with-ld=${stdenv.cc}/bin/c++") True
354
363
355hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
364hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
356hspecCoreOverrides = set phaseOverrides "testTarget = \"--test-option=--skip --test-option='Test.Hspec.Core.Runner.hspecResult runs specs in parallel'\";"
365hspecCoreOverrides = 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+28−3
@@ -9,9 +9,12 @@ 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
12import Distribution.System
13import Distribution.System
13−import Distribution.Text
14+import Distribution.Pretty as Cabal
15+import qualified Data.Version as Base
14import Distribution.Version
16import Distribution.Version
17+import Language.Nix.PrettyPrinting as Nix
15
18
16instance NFData CompilerInfo
19instance NFData CompilerInfo
17instance NFData AbiTag
20instance NFData AbiTag
@@ -49,6 +52,10 @@ instance FromJSON PackageIdentifier where
49 parseJSON (String s) = return (fromString (T.unpack s))
52 parseJSON (String s) = return (fromString (T.unpack s))
50 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell package identifier")
53 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell package identifier")
51
54
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+
52instance FromJSON Dependency where
59instance FromJSON Dependency where
53 parseJSON (String s) = return (fromString (T.unpack s))
60 parseJSON (String s) = return (fromString (T.unpack s))
54 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")
61 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")
@@ -57,7 +64,25 @@ instance FromJSON CompilerInfo where
57 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
64 parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
58 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
65 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler")
59
66
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+
60-- parsing tools
85-- parsing tools
61
86
62−text2isString :: Text a => String -> String -> a
87+text2isString :: Parsec a => String -> String -> a
63−text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParse s)
88+text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParsec s)
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs+39−26
@@ -1,5 +1,5 @@
1module Distribution.Nixpkgs.Haskell.PackageSourceSpec
1module Distribution.Nixpkgs.Haskell.PackageSourceSpec
2− ( Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
2+ ( HpackUse(..), Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
3 ) where
3 ) where
4
4
5import qualified Control.Exception as Exception
5import qualified Control.Exception as Exception
@@ -11,16 +11,18 @@ 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
14import Data.Time
16import Data.Time
15import Distribution.Nixpkgs.Fetch
17import Distribution.Nixpkgs.Fetch
16import Distribution.Nixpkgs.Hashes
18import Distribution.Nixpkgs.Hashes
17import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
19import qualified Distribution.Nixpkgs.Haskell.Hackage as DB
20+import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
18import qualified Distribution.Package as Cabal
21import qualified Distribution.Package as Cabal
19import Distribution.PackageDescription
22import Distribution.PackageDescription
20import qualified Distribution.PackageDescription as Cabal
23import qualified Distribution.PackageDescription as Cabal
21import Distribution.PackageDescription.Parsec as Cabal
24import Distribution.PackageDescription.Parsec as Cabal
22−import Distribution.Parsec.Common (showPError)
25+import Distribution.Parsec
23−import Distribution.Text ( simpleParse, display )
24import Distribution.Version
26import Distribution.Version
25import qualified Hpack.Config as Hpack
27import qualified Hpack.Config as Hpack
26import qualified Hpack.Render as Hpack
28import qualified Hpack.Render as Hpack
@@ -29,8 +31,12 @@ import System.Directory ( doesDirectoryExist, doesFileExist, createDirectoryIfMi
29import System.Exit ( exitFailure )
31import System.Exit ( exitFailure )
30import System.FilePath ( (</>), (<.>) )
32import System.FilePath ( (</>), (<.>) )
31import System.IO
33import System.IO
32−import qualified Data.Text as T
34+import Text.PrettyPrint.HughesPJClass hiding ( first )
33−import qualified Data.Text.Encoding as T
35+
36+data HpackUse
37+ = ForceHpack
38+ | PackageYamlHpack
39+ | NoHpack
34
40
35data Package = Package
41data Package = Package
36 { pkgSource :: DerivationSource
42 { pkgSource :: DerivationSource
@@ -39,8 +45,8 @@ data Package = Package
39 }
45 }
40 deriving (Show)
46 deriving (Show)
41
47
42−getPackage :: Bool
48+getPackage :: HpackUse
43− -- ^ Whether hpack should regenerate the cabal file.
49+ -- ^ the way hpack should be used.
44 -> Bool
50 -> Bool
45 -- ^ Whether to fetch submodules if fetching from git
51 -- ^ Whether to fetch submodules if fetching from git
46 -> Maybe FilePath
52 -> Maybe FilePath
@@ -52,8 +58,8 @@ getPackage :: Bool
52getPackage optHpack optSubmodules optHackageDB optHackageSnapshot =
58getPackage optHpack optSubmodules optHackageDB optHackageSnapshot =
53 getPackage' optHpack optSubmodules (loadHackageDB optHackageDB optHackageSnapshot)
59 getPackage' optHpack optSubmodules (loadHackageDB optHackageDB optHackageSnapshot)
54
60
55−getPackage' :: Bool
61+getPackage' :: HpackUse
56− -- ^ Whether hpack should regenerate the cabal file.
62+ -- ^ the way hpack should be used.
57 -> Bool
63 -> Bool
58 -- ^ Whether to fetch submodules if fetching from git
64 -- ^ Whether to fetch submodules if fetching from git
59 -> IO DB.HackageDB
65 -> IO DB.HackageDB
@@ -63,8 +69,8 @@ getPackage' optHpack optSubmodules hackageDB source = do
63 (derivSource, ranHpack, pkgDesc) <- fetchOrFromDB optHpack optSubmodules hackageDB source
69 (derivSource, ranHpack, pkgDesc) <- fetchOrFromDB optHpack optSubmodules hackageDB source
64 (\s -> Package s ranHpack pkgDesc) <$> maybe (sourceFromHackage (sourceHash source) (showPackageIdentifier pkgDesc) $ sourceCabalDir source) return derivSource
70 (\s -> Package s ranHpack pkgDesc) <$> maybe (sourceFromHackage (sourceHash source) (showPackageIdentifier pkgDesc) $ sourceCabalDir source) return derivSource
65
71
66−fetchOrFromDB :: Bool
72+fetchOrFromDB :: HpackUse
67− -- ^ Whether hpack should regenerate the cabal file
73+ -- ^ the way hpack should be used
68 -> Bool
74 -> Bool
69 -- ^ Whether to fetch submodules if fetching from git
75 -- ^ Whether to fetch submodules if fetching from git
70 -> IO DB.HackageDB
76 -> IO DB.HackageDB
@@ -102,12 +108,12 @@ fromDB hackageDBIO pkg = do
102 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
108 return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))
103 where
109 where
104 pkgId :: Cabal.PackageIdentifier
110 pkgId :: Cabal.PackageIdentifier
105− pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
111+ pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParsec pkg)
106 name = Cabal.packageName pkgId
112 name = Cabal.packageName pkgId
107
113
108− unknownPackageError = fail $ "No such package " ++ display pkgId ++ " in the cabal database. Did you run cabal update?"
114+ unknownPackageError = fail $ "No such package " ++ prettyShow pkgId ++ " in the cabal database. Did you run cabal update?"
109
115
110− url = "mirror://hackage/" ++ display pkgId ++ ".tar.gz"
116+ url = "mirror://hackage/" ++ prettyShow pkgId ++ ".tar.gz"
111
117
112 version :: Version
118 version :: Version
113 version = Cabal.packageVersion pkgId
119 version = Cabal.packageVersion pkgId
@@ -170,12 +176,12 @@ sourceFromHackage optHash pkgId cabalDir = do
170 exitFailure
176 exitFailure
171
177
172showPackageIdentifier :: Cabal.GenericPackageDescription -> String
178showPackageIdentifier :: Cabal.GenericPackageDescription -> String
173−showPackageIdentifier pkgDesc = name ++ "-" ++ display version where
179+showPackageIdentifier pkgDesc = name ++ "-" ++ prettyShow version where
174 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
180 pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc
175 name = Cabal.unPackageName (Cabal.packageName pkgId)
181 name = Cabal.unPackageName (Cabal.packageName pkgId)
176 version = Cabal.packageVersion pkgId
182 version = Cabal.packageVersion pkgId
177
183
178−cabalFromPath :: Bool -- ^ Whether hpack should regenerate the cabal file
184+cabalFromPath :: HpackUse -- ^ the way hpack should be used
179 -> FilePath -> MaybeT IO (Bool, Bool, Cabal.GenericPackageDescription)
185 -> FilePath -> MaybeT IO (Bool, Bool, Cabal.GenericPackageDescription)
180cabalFromPath optHpack path = do
186cabalFromPath optHpack path = do
181 d <- liftIO $ doesDirectoryExist path
187 d <- liftIO $ doesDirectoryExist path
@@ -185,21 +191,25 @@ cabalFromPath optHpack path = do
185 return (d, ranHpack, pkg)
191 return (d, ranHpack, pkg)
186 else (,,) d False <$> cabalFromFile False path
192 else (,,) d False <$> cabalFromFile False path
187
193
188−cabalFromDirectory :: Bool -- ^ Whether hpack should regenerate the cabal file
194+cabalFromDirectory :: HpackUse -- ^ the way hpack should be used
189 -> FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
195 -> FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
190−cabalFromDirectory True dir = hpackDirectory dir
196+cabalFromDirectory ForceHpack dir = hpackDirectory dir
191−cabalFromDirectory False dir = do
197+cabalFromDirectory NoHpack dir = onlyCabalFromDirectory dir "*** No .cabal file was found. Exiting."
198+cabalFromDirectory PackageYamlHpack dir = do
192 useHpack <- liftIO $ doesFileExist (dir </> "package.yaml")
199 useHpack <- liftIO $ doesFileExist (dir </> "package.yaml")
193 if useHpack
200 if useHpack
194 then do
201 then do
195 liftIO $ hPutStrLn stderr "*** found package.yaml. Using hpack..."
202 liftIO $ hPutStrLn stderr "*** found package.yaml. Using hpack..."
196 hpackDirectory dir
203 hpackDirectory dir
197− else do
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
198− cabals <- liftIO $ getDirectoryContents dir >>= filterM doesFileExist . map (dir </>) . filter (".cabal" `isSuffixOf`)
208+ cabals <- liftIO $ getDirectoryContents dir >>= filterM doesFileExist . map (dir </>) . filter (".cabal" `isSuffixOf`)
199− case cabals of
209+ case cabals of
200− [] -> fail "*** Found neither a .cabal file nor package.yaml. Exiting."
210+ [] -> fail errMsg
201− [cabalFile] -> (,) False <$> cabalFromFile True cabalFile
211+ [cabalFile] -> (,) False <$> cabalFromFile True cabalFile
202− _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
212+ _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
203
213
204handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
214handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
205handleIO = Exception.handle
215handleIO = Exception.handle
@@ -216,7 +226,10 @@ hpackDirectory dir = do
216 case mPackage of
226 case mPackage of
217 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
227 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
218 Right r -> do
228 Right r -> do
229+ let hpackOutput =
219− let hpackOutput = encodeUtf8 $ Hpack.renderPackage [] (Hpack.decodeResultPackage r)
230+ let body = Hpack.renderPackage [] (Hpack.decodeResultPackage r)
231+ cabalVersion = Hpack.decodeResultCabalVersion r
232+ in encodeUtf8 $ cabalVersion ++ body
220 hash = printSHA256 $ digest (digestByName "sha256") hpackOutput
233 hash = printSHA256 $ digest (digestByName "sha256") hpackOutput
221 case runParseGenericPackageDescription "<hpack output>" hpackOutput of
234 case runParseGenericPackageDescription "<hpack output>" hpackOutput of
222 Left msg -> liftIO $ do
235 Left msg -> liftIO $ do
test/Main.hs+3−11
@@ -99,14 +99,6 @@ testExecutable exe cabalFile = do
99-- * Helper functions
99-- * Helper functions
100-------------------------------------------------------------------------------
100-------------------------------------------------------------------------------
101
101
102−-- | Find all *files* in the given directory. This function does not recurse,
103−-- nor does it include the special entries @'.'@ or @'..'@ in the result.
104−
105−listDirectoryFiles :: FilePath -> IO [FilePath]
106−listDirectoryFiles dirPath = do
107− entries <- listDirectory dirPath
108− filterM doesFileExist (map (dirPath </>) entries)
109−
110-- | Find all *files* in the given directory that end with the given suffix.
102-- | Find all *files* in the given directory that end with the given suffix.
111-- This function does not recurse, nor does it include the special entries
103-- This function does not recurse, nor does it include the special entries
112-- @'.'@ or @'..'@ in the result.
104-- @'.'@ or @'..'@ in the result.
@@ -119,9 +111,9 @@ listDirectoryFiles dirPath = do
119-- we prefer our own simpler code.
111-- we prefer our own simpler code.
120
112
121listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
113listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
122−listDirectoryFilesBySuffix suff =
114+listDirectoryFilesBySuffix suff dirPath = do
123− fmap (filter ((suff ==) . takeExtension)) . listDirectoryFiles
115+ entries <- listDirectory dirPath
124−
116+ filterM doesFileExist [ dirPath </> e | e <- entries, takeExtension e == suff ]
125
117
126-- | A variant of 'writeFile' that appends a newline to the end of the buffer
118-- | A variant of 'writeFile' that appends a newline to the end of the buffer
127-- before writing.
119-- before writing.
test/golden-test-cases/ede.nix.golden+1
@@ -21,4 +21,5 @@ 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;
24}
25}
test/golden-test-cases/gogol-adexchange-buyer.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-admin-emailmigration.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-affiliates.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-apps-tasks.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-appstate.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-blogger.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-datastore.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-dfareporting.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-firebase-rules.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-gmail.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-kgsearch.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-maps-engine.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-plus.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-resourceviews.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-translate.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-webmaster-tools.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/gogol-youtube.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/hxt-expat.nix.golden+1
@@ -7,4 +7,5 @@ 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;
10}
11}
test/golden-test-cases/hxt-tagsoup.nix.golden+1
@@ -11,4 +11,5 @@ 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;
14}
15}
test/golden-test-cases/opencv.nix.golden−3
@@ -9,9 +9,6 @@ mkDerivation {
9 pname = "opencv";
9 pname = "opencv";
10 version = "0.0.2.1";
10 version = "0.0.2.1";
11 sha256 = "deadbeef";
11 sha256 = "deadbeef";
12− configureFlags = [
13− "--with-gcc=${stdenv.cc}/bin/c++" "--with-ld=${stdenv.cc}/bin/c++"
14− ];
15 setupHaskellDepends = [ base Cabal ];
12 setupHaskellDepends = [ base Cabal ];
16 libraryHaskellDepends = [
13 libraryHaskellDepends = [
17 aeson base base64-bytestring bindings-DSL bytestring containers
14 aeson base base64-bytestring bindings-DSL bytestring containers
test/golden-test-cases/openpgp-asciiarmor.nix.golden+1
@@ -15,4 +15,5 @@ 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;
18}
19}
test/golden-test-cases/swagger.nix.golden+1
@@ -11,4 +11,5 @@ 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;
14}
15}
update-stackage.sh+13−9
@@ -2,11 +2,14 @@
2
2
3set -eu -o pipefail
3set -eu -o pipefail
4
4
5−tmpfile=$(mktemp "stackage-update.XXXXXXX")
5+cd "$(dirname "$0")"
6−trap "rm $tmpfile" 0
7
6
7+tmpfile=$(mktemp "update-stackage.XXXXXXX")
8+# shellcheck disable=SC2064
9+trap "rm ${tmpfile} ${tmpfile}.new" 0
10+
8−curl -L -s "https://www.stackage.org/lts/cabal.config" >"$tmpfile"
11+curl -L -s "https://stackage.org/lts/cabal.config" >"$tmpfile"
9−version=$(sed -n "s/^--.*http:..www.stackage.org.snapshot.lts-//p" "$tmpfile")
12+version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.lts-//p" "$tmpfile")
10
13
11# Create a simple yaml version of the file.
14# Create a simple yaml version of the file.
12sed -r \
15sed -r \
@@ -16,12 +19,13 @@ sed -r \
16 -e 's|,$||' \
19 -e 's|,$||' \
17 -e '/installed$/d' \
20 -e '/installed$/d' \
18 -e '/^$/d' \
21 -e '/^$/d' \
19− -i "$tmpfile"
22+ < "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"
20
23
21# Drop restrictions on some tools where we always want the latest version.
24# Drop restrictions on some tools where we always want the latest version.
22sed -r \
25sed -r \
23 -e '/ cabal-install /d' \
26 -e '/ cabal-install /d' \
24 -e '/ cabal2nix /d' \
27 -e '/ cabal2nix /d' \
28+ -e '/ cabal2spec /d' \
25 -e '/ distribution-nixpkgs /d' \
29 -e '/ distribution-nixpkgs /d' \
26 -e '/ git-annex /d' \
30 -e '/ git-annex /d' \
27 -e '/ hindent /d' \
31 -e '/ hindent /d' \
@@ -31,16 +35,16 @@ sed -r \
31 -e '/ hopenssl /d' \
35 -e '/ hopenssl /d' \
32 -e '/ jailbreak-cabal /d' \
36 -e '/ jailbreak-cabal /d' \
33 -e '/ json-autotype/d' \
37 -e '/ json-autotype/d' \
34− -e '/ lambdabot-core /d' \
35− -e '/ lambdabot-irc-plugins /d' \
36 -e '/ language-nix /d' \
38 -e '/ language-nix /d' \
39+ -e '/ shake /d' \
37 -e '/ ShellCheck /d' \
40 -e '/ ShellCheck /d' \
38 -e '/ stack /d' \
41 -e '/ stack /d' \
39 -e '/ weeder /d' \
42 -e '/ weeder /d' \
40− -i "$tmpfile"
43+ < "${tmpfile}.new" > "${tmpfile}"
41
44
42# Drop the previous configuration ...
45# Drop the previous configuration ...
46+# shellcheck disable=SC1004
43−sed -e '/# LTS Haskell/,/^$/c \TODO\
47+sed -e '/ # LTS Haskell/,/^$/c \TODO\
44' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
48' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
45
49
46# ... and replace it with the new one.
50# ... and replace it with the new one.