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
Nixpkgs support for dhall-to-nixpkgs
#89237
Nixpkgs support for dhall-to-nixpkgs
#89237
Conversation
The motivation for this change is to enable a new Dhall command-line utility called `dhall-to-nixpkgs` which converts Dhall packages to buildable Nix packages. You can think of `dhall-to-nixpkgs` as the Dhall analog of `cabal2nix`. You can find the matching pull request for `dhall-to-nixpkgs` here: dhall-lang/dhall-haskell#1826 The two main changes required to support `dhall-to-nixpkgs` are: * Two new `buildDhall{Directory,GitHub}Package` utilities are added `dhall-to-nixpkgs` uses these in the generated output * `pkgs.dhallPackages` now selects a default version for each package using the `prefer` utility All other versions are still buildable via a `passthru` attribute
buildDhallGitHubPackage = | ||
callPackage ../development/interpreters/dhall/build-dhall-github-package.nix { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to specialize this to github in nixpkgs? The dhall builder can just assume that pkgs.fetchFromGitHub
exists (it’s a stable interface of nixpkgs) and then put the result into src
, which makes it easily extendable to other source locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Profpatsch: Yeah, it is possible to do that. Conceptually, that is what the lower-level buildDhallPackage
utility already does, it just takes a src
as input and buildDhall{GitHub,Directory}Package
are just convenient wrappers around the buildDhallPackage
.
The main reason I created these intermediate utilities was to keep the code generated by dhall-to-nixpkgs
as small as possible, otherwise it would essentially be inlining the code that you see in build-dhall-github-package.nix
into every generated GitHub derivation (including the mkOverridable
and the removeAttrs
boilerplate)
@Profpatsch: Is there anything left to do here? |
No, I’m sorry, this stagnated in my open tabs. Thanks for pinging again, I’ll merge. |
I think we can try to build everything with ofborg: @GrahamcOfBorg build dhallPackages |
@Profpatsch: Thank you! 🙂 |
The motivation for this change is to enable a new Dhall command-line
utility called
dhall-to-nixpkgs
which converts Dhall packages tobuildable Nix packages. You can think of
dhall-to-nixpkgs
as theDhall analog of
cabal2nix
.You can find the matching pull request for
dhall-to-nixpkgs
here:dhall-lang/dhall-haskell#1826
The two main changes required to support
dhall-to-nixpkgs
are:Two new
buildDhall{Directory,GitHub}Package
utilities are addeddhall-to-nixpkgs
uses these in the generated outputpkgs.dhallPackages
now selects a default version for each packageusing the
prefer
utilityAll other versions are still buildable via a
passthru
attributeMotivation for this change
Things done
I also verified that all of
pkgs.dhallPackages
still builds and I also verified that severalrepresentative Nix packages generated by
dhall-to-nixpkgs
successfully build withthese changes.