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

Nixpkgs support for dhall-to-nixpkgs #89237

Merged
merged 1 commit into from Jun 17, 2020

Conversation

Gabriella439
Copy link
Contributor

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

Motivation for this change
Things done

I also verified that all of pkgs.dhallPackages still builds and I also verified that several
representative Nix packages generated by dhall-to-nixpkgs successfully build with
these changes.

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
Comment on lines +24 to +25
buildDhallGitHubPackage =
callPackage ../development/interpreters/dhall/build-dhall-github-package.nix { };
Copy link
Member

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.

Copy link
Contributor Author

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)

@Gabriella439
Copy link
Contributor Author

@Profpatsch: Is there anything left to do here?

@Profpatsch
Copy link
Member

No, I’m sorry, this stagnated in my open tabs. Thanks for pinging again, I’ll merge.

@Profpatsch
Copy link
Member

I think we can try to build everything with ofborg:

@GrahamcOfBorg build dhallPackages

@Profpatsch Profpatsch merged commit 459cf94 into NixOS:master Jun 17, 2020
@Gabriella439
Copy link
Contributor Author

@Profpatsch: Thank you! 🙂

@Gabriella439 Gabriella439 deleted the gabriel/build_dhall_utils_3 branch June 19, 2020 04:32
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

2 participants