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

callCabal2nix: Passthru deriver #44356

Merged

Conversation

ElvishJerricco
Copy link
Contributor

Motivation for this change

When using callCabal2nix or callHackage, it is often useful to debug a failure by inspecting the Nix expression generated by cabal2nix. This can be accessed via this deriver field.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

/cc @shlevy

Copy link
Member

@basvandijk basvandijk left a comment

Choose a reason for hiding this comment

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

I occasionally need this myself. So I'm +1.

@basvandijk
Copy link
Member

Seems to work:

$ cat $(nix-store -r $(nix-build -E 'let pkgs = import ./. {}; drv = pkgs.haskellPackages.callHackage "scientific" "0.3.6.2" {}; in drv.deriver'))/default.nix
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
{ mkDerivation, base, binary, bytestring, containers, criterion
, deepseq, hashable, integer-gmp, integer-logarithms, primitive
, QuickCheck, smallcheck, stdenv, tasty, tasty-ant-xml, tasty-hunit
, tasty-quickcheck, tasty-smallcheck, text
}:
mkDerivation {
  pname = "scientific";
  version = "0.3.6.2";
  sha256 = "278d0afc87450254f8a76eab21b5583af63954efc9b74844a17a21a68013140f";
  libraryHaskellDepends = [
    base binary bytestring containers deepseq hashable integer-gmp
    integer-logarithms primitive text
  ];
  testHaskellDepends = [
    base binary bytestring QuickCheck smallcheck tasty tasty-ant-xml
    tasty-hunit tasty-quickcheck tasty-smallcheck text
  ];
  benchmarkHaskellDepends = [ base criterion ];
  homepage = "https://github.com/basvandijk/scientific";
  description = "Numbers represented using scientific notation";
  license = stdenv.lib.licenses.bsd3;
}

@basvandijk
Copy link
Member

@ryantm agree to merge this?

@ElvishJerricco
Copy link
Contributor Author

Is deriver too general a name? I could see that namespace being valuable for other derivation related things at some point. Maybe it should be cabal2nixDeriver?

@basvandijk
Copy link
Member

Good point. I wonder if we shouldn't name it: cabal2nixDerivation or cabal2nixDrv since it evaluates to a path of a .drv file in the nix store.

@ElvishJerricco
Copy link
Contributor Author

since it evaluates to a path of a .drv file in the nix store.

That's not true. It evaluates to a directory whose only contents are a default.nix file

@basvandijk
Copy link
Member

Oh you're right of course. I got confused by my own example above.

Then I agree cabal2nixDeriver is a good name.

@basvandijk
Copy link
Member

I also like cabal2nixOutput but I don't want to bikeshed this too much so I'm fine with cabal2nixDeriver.

@ElvishJerricco
Copy link
Contributor Author

Alright. I've changed it. Anything else before merging?

@basvandijk basvandijk merged commit e9b7e73 into NixOS:master Aug 11, 2018
@basvandijk
Copy link
Member

Thank you!

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

4 participants