Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dhall-json: fix to work with newer tasty #108765

Merged
merged 1 commit into from Jan 9, 2021

Conversation

cideM
Copy link
Contributor

@cideM cideM commented Jan 8, 2021

Motivation for this change

dhall-json does not compile on haskell-updates right now. It has a dependency on tasty-silver and this in turn only
compiles if we supply a newer version of tasty. This PR therefore overrides tasty-hunit to use tasty_1_4_0_2.

Disclaimer: I'm super new to the Haskell part of Nixpkgs so apologies if I missed something really obvious in retrospect ^_^

Tested it with nix-build -A dhall-json on MacOS and NixOS and a quick dhall-to-json --version which is now at 1.7.4

Will run nixpkgs-review now.

2 packages updated:
dhall-json dhall-lsp-server

no apparent problems

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@cideM cideM changed the title Fix dhall-json to work with tasty dhall-json: fix to work with newer tasty Jan 8, 2021
Comment on lines 948 to 950
tasty-silver = self.tasty-silver.override {
tasty-hunit = tastyHunitWithOverrides;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cideM I'm not really sure what to do here.

Maybe you could move this tasty-silver override to the top-level in this file? I don't think it makes sense to have tasty-silver only working for dhall-json.

Alternatively, you could use overrideScope on dhall-json so all you have to do is override the tasty version, and that gets automatically propogated to tasty-silver and tasty-hunit. (grep through this file for other examples of overrideScope)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, also, just disabling tests for dhall-json with dontCheck might be the easiest thing to do, since then it probably wouldn't pull in any of the tasty dependencies.

You could just link to commercialhaskell/stackage#5795 in the code.

@cdepillabout
Copy link
Member

cdepillabout commented Jan 8, 2021

Here's the issue about updating to tasty-1.4 in stackage: commercialhaskell/stackage#5795

Looks like a lot of packages haven't updated yet :-\


Hmm, I don't really understand what is going on here, since dhall-json appears to be in the list of packages that haven't updated yet. However, I don't understand how dhall-json could even be in stackage if it has a dependency that is not in stackage: tasty-silver.

@cideM Do you know what is going on here?

@cideM
Copy link
Contributor Author

cideM commented Jan 8, 2021

@cdepillabout unfortunately I have no idea this is the first time I'm interacting with Haskell dependencies outside of little projects. dhall-json depends on tasty-silver but only for tests so maybe that explains the stackage inclusion? But it only depends on tasty-silver >= 3.0 which is a pretty broad range in terms of time that passed between version bumps in the 3.x range. So that shouldn't force tasty 1.4. tasty-hunit also won't cause this.

Yet it won't build without it :(

overrideScope also doesn't do the trick here as it now seems to be too broad;

diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 05740979b8a..46d14aa85a6 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -937,7 +937,9 @@ self: super: {
 
   # Generate cli completions for dhall.
   dhall = generateOptparseApplicativeCompletion "dhall" super.dhall;
-  dhall-json = generateOptparseApplicativeCompletions ["dhall-to-json" "dhall-to-yaml"] super.dhall-json;
+  dhall-json = generateOptparseApplicativeCompletions ["dhall-to-json" "dhall-to-yaml"] (super.dhall-json.overrideScope (self: super: {
+      tasty = pkgs.haskellPackages.tasty_1_4_0_2;
+  }));
   dhall-nix = generateOptparseApplicativeCompletion "dhall-to-nix" super.dhall-nix;
 
   # https://github.com/haskell-hvr/netrc/pull/2#issuecomment-469526558
Configuring tasty-ant-xml-1.1.7...
CallStack (from HasCallStack):
  $, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1024:20 in Cabal-3.2.1.0:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:477:12 in Cabal-3.2.1.0:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:625:20 in Cabal-3.2.1.0:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:65:5 in Cabal-3.2.1.0:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.2.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.2.1.0:Distribution.Simple
  defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing or private dependencies:
tasty >=0.10 && <1.4

builder for '/nix/store/2a701jh8wyf6qrd0l0ghx0ifbc4ldhz6-tasty-ant-xml-1.1.7.drv' failed with exit code 1
building '/nix/store/a96clw8f6jjsvdmwa0zjhymxsbgbc224-ListLike-4.7.4.drv'...
cannot build derivation '/nix/store/d931vimdfq1g5zicqqcjy5hp6kyjr8vi-scientific-0.3.6.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/23d192qgdb5x642n6q2w9amaadba281s-dhall-json-1.7.4.drv': 1 dependencies couldn't be built
error: build of '/nix/store/23d192qgdb5x642n6q2w9amaadba281s-dhall-json-1.7.4.drv' failed

I think my PR is one of those "makes a very specific thing work" fixes but it's probably not the right thing to do here, at least that's my feeling :\

For posterity, this is the original error that prompted this PR

  /nix/store/7nsr5djbz05pfj2kf260cdqy21h7dwaa-dhall-json-1.7.4.drv
building '/nix/store/0rg75x8l3s4y7mskx3nvdi7la72mjhbf-tasty-silver-3.2.1.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/517wgv7ii4jc440r525gw5f9gjmk07ac-ghc-8.10.3.
unpacking sources
unpacking source archive /nix/store/y0iwpsgbig7vjrj5s9hm9cr2cy16vp08-tasty-silver-3.2.1.tar.gz
source root is tasty-silver-3.2.1
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file tasty-silver-3.2.1/tests/test.hs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/private/tmp/nix-build-tasty-silver-3.2.1.drv-0/setup-package.conf.d -j4 -threaded -rtsopts
[1 of 1] Compiling Main             ( Setup.hs, /private/tmp/nix-build-tasty-silver-3.2.1.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/y81lpjmg0q588kz3hb0idcpfw6hbcd5g-tasty-silver-3.2.1 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/7ymhwn5pb9fkpxxw04142zs5bp073f0z-tasty-silver-3.2.1-doc/share/doc/tasty-silver-3.2.1 --with-gcc=clang --package-db=/private/tmp/nix-build-tasty-silver-3.2.1.drv-0/package.conf.d --ghc-options=-j4 --disable-split-objs --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --extra-include-dirs=/nix/store/jrbjxz6670s4hjj18mgq5nn35yg79vh1-libc++-7.1.0/include --extra-lib-dirs=/nix/store/jrbjxz6670s4hjj18mgq5nn35yg79vh1-libc++-7.1.0/lib --extra-include-dirs=/nix/store/l1dz56sfk1ayqz7igqah52jdhil6cf32-libc++abi-7.1.0/include --extra-lib-dirs=/nix/store/l1dz56sfk1ayqz7igqah52jdhil6cf32-libc++abi-7.1.0/lib --extra-include-dirs=/nix/store/yzyaggdax6xxd8mp7c4pc2wahpmpxss7-compiler-rt-7.1.0-dev/include --extra-lib-dirs=/nix/store/i7y5w01bg0qa5m5ki89wbhdcvdlim3rq-compiler-rt-7.1.0/lib --extra-lib-dirs=/nix/store/26ka1cznkwk0bsfc1rg5c29f648ylybd-ncurses-6.2/lib --extra-lib-dirs=/nix/store/jj168y4bc6qnzwcgaqrspwhhyihbcj9v-libffi-3.3/lib --extra-lib-dirs=/nix/store/hm6ny7xhmdxkpj7ydxpk8hiqcss54wag-gmp-6.2.1/lib --extra-include-dirs=/nix/store/hxcwxf1bhx8dhlyzjyzcgpw91b66cnrw-libiconv-osx-10.12.6/include --extra-lib-dirs=/nix/store/hxcwxf1bhx8dhlyzjyzcgpw91b66cnrw-libiconv-osx-10.12.6/lib --extra-framework-dirs=/nix/store/y90c707k7h5lk2pidnjsafnri6aa4fn6-swift-corefoundation/Library/Frameworks
Using Parsec parser
Configuring tasty-silver-3.2.1...
CallStack (from HasCallStack):
  $, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1024:20 in Cabal-3.2.1.0:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:477:12 in Cabal-3.2.1.0:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:625:20 in Cabal-3.2.1.0:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:65:5 in Cabal-3.2.1.0:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.2.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.2.1.0:Distribution.Simple
  defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing or private dependencies:
tasty >=1.4

@cdepillabout
Copy link
Member

cdepillabout commented Jan 8, 2021

@cideM Hmm, yeah that is quite annoying.

Why don't you just update this PR to mark dhall-json as dontCheck? That is probably the easiest thing to do to get it built here in nixpkgs.

@cideM cideM force-pushed the haskell-updates branch 2 times, most recently from 357ae9b to 8be7c02 Compare January 8, 2021 15:06
dhall-json has a dependency on tasty-silver and this in turn only
compiles if we supply a newer version of tasty. We can get around this
issue until stackage has caught up to tasty 1.4 by skipping tests
@cideM
Copy link
Contributor Author

cideM commented Jan 8, 2021

Done @cdepillabout thanks for the tip about just using dontCheck here. Is this generally recommended for cases like this? I was a bit torn between just disabling tests and keeping the change small.

Copy link
Member

@cdepillabout cdepillabout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for working with me on this!

@cdepillabout cdepillabout merged commit fcbb152 into NixOS:haskell-updates Jan 9, 2021
@cideM cideM deleted the haskell-updates branch January 9, 2021 14:44
@jkachmar
Copy link
Contributor

However, I don't understand how dhall-json could even be in stackage if it has a dependency that is not in stackage: tasty-silver.

@cdepillabout We disable the dhall-json test suite (cf. https://github.com/commercialhaskell/stackage/blob/397581eaff122a14810066429d3660fda96cbd65/build-constraints.yaml#L5364), which means that any dependencies that it would pull in are elided entirely.

@cdepillabout
Copy link
Member

@jkachmar Ah thanks, that makes sense. I guess that is basically what we're doing here in nixpkgs as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants