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

Haskell: Added haskellPackages.shellFor #36393

Merged
merged 1 commit into from Mar 7, 2018

Conversation

ElvishJerricco
Copy link
Contributor

Motivation for this change

Building multi-package projects is pretty common, and nixpkgs currently doesn't provide a standard way to work on them simultaneously with an incremental tool like cabal new-build. This function achieves that by extracting your packages' build inputs and making a shell with those available.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@ElvishJerricco
Copy link
Contributor Author

/cc @shlevy, I think you might be interested in this :)

Copy link
Member

@shlevy shlevy left a comment

Choose a reason for hiding this comment

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

🎆

packageInputs = builtins.map (p: p.override { mkDerivation = haskellLib.extractBuildInputs p.compiler; }) selected;
haskellInputs =
builtins.filter
(input: pkgs.lib.all (p: builtins.toString input != builtins.toString p) selected)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this an ok way of comparing two packages for equality? I thought comparing on pname would be too ad-hoc and error prone.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this is the right way. Though I'd do input.outPath != p.outPath

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

@ElvishJerricco
Copy link
Contributor Author

@shlevy Is it too late to get this into 18.03?

@shlevy
Copy link
Member

shlevy commented Mar 7, 2018

@ElvishJerricco That's up to @vcunat and @fpletz

@Ericson2314
Copy link
Member

  1. The is a super useful thing to have, thanks @ElvishJerricco!

  2. @shlevy I thought you already wrote something like this?

  3. I'm worried about correctness. If the list is [ p1 p2 ..], and p1 depends on a (not in the list) which depends on p2, then a shouldn't be built either.

@shlevy
Copy link
Member

shlevy commented Mar 8, 2018

@Ericson2314 I don't have anything quite like this... But yeah, agreed about point 3.

@Ericson2314
Copy link
Member

@shlevy there'd be a real nifty way with poisoned derivations to do that :D.

@ElvishJerricco
Copy link
Contributor Author

@Ericson2314 I think it would suffice to simply leave a warning about that case. But a more comprehensive solution would be nice :) I just wouldn't want certain packages to be not built without the user having any idea why, so I think I'd rather see that case become an error than have it handled implicitly.

@Ericson2314
Copy link
Member

@ElvishJerricco I'd do a warning, but this shouldn't be an errror. It's quite normal to fork a dependency that your other dependencies also depend on.

@vcunat
Copy link
Member

vcunat commented Mar 12, 2018

In 18.03 since b8ebbc0. Adding new functions seems safe to me 👍

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

Successfully merging this pull request may close these issues.

None yet

6 participants