-
Notifications
You must be signed in to change notification settings - Fork 211
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
Add support for building remote imports as FOD to dhall-nixpkgs #2318
Add support for building remote imports as FOD to dhall-nixpkgs #2318
Conversation
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.
Looks great! Just one minor comment
dhall-nixpkgs/Main.hs
Outdated
parseUrlAsFOD :: Parser Bool | ||
parseUrlAsFOD = | ||
Options.switch | ||
( Options.long "url-as-fod" |
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.
I'd suggest renaming this to --fixed-output-derivations
and not reference URLs specifically. That way if we want to add support for other fixed output derivations (like local path imports or environment variables protected by integrity checks, for whatever reason), then we don't need to rename the option.
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.
That's a good idea.
I rebased this PR on master
and added a commit changing the --url-as-fod
flag to --fixed-output-derivations
: c65b550
79f31dc
to
c65b550
Compare
@cdepillabout: Thank you for your patience working on this! 🙂 |
Thanks for merging this in :-) The next step is to get the Nix functions from https://github.com/cdepillabout/example-dhall-nix/blob/e6a675c72ecd4dd23d254a02aea8181fe875747f/default.nix into Nixpkgs (along with necessary documentation updates). Since Personally I'd also like to get the other functions from that file into Nixpkgs ( If this sounds good, I'll start putting together PRs to Nixpkgs adding these functions. |
Yeah, go ahead and open a PR to add those utilities to Nixpkgs |
`buildDhallUrl` is a function to download a Dhall remote import. It is introduced to `dhall-to-nixpkgs` in dhall-lang/dhall-haskell#2318.
This PR adds support for converting remote imports to fixed-output derivations (FOD) to
dhall-to-nixpkgs
.This functionality was discussed in #2304 (comment) (and the next few comments).
This PR adds a
--url-as-fod
argument todhall-to-nixpkgs directory
. Passing--url-as-fod
causesdhall-to-nixpkgs directory
to turn remote imports into FOD.For instance, the current
dhall-to-nixpkgs
will output the following for mydhallfile.dhall:With the code from this PR, and using the
--url-as-fod
argument, the following will be output:This uses
buildDhallUrl
to build all of the remote imports.buildDhallUrl
is a function I propose in #2304 (comment). You can find its implementation here. This would likely need to be added to Nixpkgs.