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

haskellPackages: unbreak bson and mongoDB #122428

Closed
wants to merge 1 commit into from

Conversation

NorfairKing
Copy link
Contributor

Motivation for this change

Unbreaking bson and mongoDB.

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.
Questions:
  1. The problem is that the network/network-bsd dependency flag is not picked up correctly. Is this the correct place to fix it?
  2. Is there a nicer way to 'replace' network by network-bsd than to re-enumerate all the dependencies and omit network?

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 10, 2021
@NorfairKing
Copy link
Contributor Author

cc @peti

@@ -1898,4 +1898,19 @@ EOT
})
];

bson = overrideCabal super.bson (drv: {
# We replace 'network' by 'network-bsd' because cabal2nix cannot correctly that pick up.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# We replace 'network' by 'network-bsd' because cabal2nix cannot correctly that pick up.
# We replace 'network' by 'network-bsd' because cabal2nix cannot correctly pick that up.

@maralorn
Copy link
Member

How is it possible that the cabal file does not declare the correct package name?

@NorfairKing
Copy link
Contributor Author

@maralorn https://github.com/mongodb-haskell/bson/blob/d8e70185fb34a9e92aa98f17bf6a8c6bc1dc651d/bson.cabal#L40-L45 have a look here, a flag is used to choose between two packages and it looks like cabal2nix chooses the wrong one.

@NorfairKing
Copy link
Contributor Author

Oh I just noticed that this flag is on by default: https://github.com/mongodb-haskell/bson/blob/d8e70185fb34a9e92aa98f17bf6a8c6bc1dc651d/bson.cabal#L28 Maybe if I just set the flag differently, cabal2Nix will pick it up correctly. How do I do that?

@maralorn
Copy link
Member

haskell.lib.enableCabalFlag and haskell.lib.disableCabalFlag

@NorfairKing
Copy link
Contributor Author

haskell.lib.enableCabalFlag and haskell.lib.disableCabalFlag

Yes but that doesn't fix the dependencies. I'd want to set this flag when callCabal2Nix is called, not afterwards.

@NorfairKing
Copy link
Contributor Author

We could also just apply this patch instead: aske/bson@288cfac

Copy link
Member

@sternenseemann sternenseemann left a comment

Choose a reason for hiding this comment

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

I think this should go into configure-nix.nix. I don't think we'll get rid of this in the near future since it'd require us to implement some generation-time configuration mechanism for hackage2nix.

Comment on lines +1901 to +1914
bson = overrideCabal super.bson (drv: {
# We replace 'network' by 'network-bsd' because cabal2nix cannot correctly that pick up.
libraryHaskellDepends = with pkgs.haskellPackages; [
base
binary
bytestring
cryptohash-md5
data-binary-ieee754
mtl
network-bsd # network-bsd AND NOT network
text
time
];
});
Copy link
Member

Choose a reason for hiding this comment

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

This should be much simpler and not require us to maintain a list of dependencies

Suggested change
bson = overrideCabal super.bson (drv: {
# We replace 'network' by 'network-bsd' because cabal2nix cannot correctly that pick up.
libraryHaskellDepends = with pkgs.haskellPackages; [
base
binary
bytestring
cryptohash-md5
data-binary-ieee754
mtl
network-bsd # network-bsd AND NOT network
text
time
];
});
bson = appendConfigureFlag (super.bson.override { network = self.network-bsd; }) "-f-_old_network";

@sternenseemann
Copy link
Member

We could also just apply this patch instead: aske/bson@288cfac

This won't work I'm afraid since the patch is only applied after we already resolve the dependencies. We should ask upstream to release a new version or update the cabal file on hackage though.

@NorfairKing
Copy link
Contributor Author

@sternenseemann I already made this: mongodb-haskell/bson#26

@NorfairKing
Copy link
Contributor Author

NorfairKing commented May 10, 2021

@sternenseemann what can we do in the meantime?
EDIT: just saw your suggestion, if that works then it's fine by me, feel free to replace my commit by your suggestion and merge at your discretion.

@sternenseemann
Copy link
Member

Done in 978f8b381f2eb0900d27b0e6ae52e919695b8fc6.

@NorfairKing
Copy link
Contributor Author

@sternenseemann mongoDB should also be unbroken now.

@sternenseemann
Copy link
Member

Yeah, it is! We've reworked how this works in haskellPackages, so it does evaluate again and we'll do an automatic sweep to make it being built by hydra again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: haskell 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants