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

Change idiom for overriding Dhall package version #102392

Merged

Conversation

Gabriella439
Copy link
Contributor

Before this change, a Dhall package like the Prelude would be
encoded as a record with one field per supported version. Then
downstream packages would specify which package to override
by selecting a different record field.

The problem with that approach is that it did not provide an
easy way to override a package to a version other than the default
ones supplied by Nixpkgs. Normally you would use the .override
method for this purpose, but the override method added by
buildDhall{Directory,GitHub}Package is clobbered by the
override method added by callPackage in
./pkgs/top-level/dhall-packages.nix.

The solution is to add a separate .overridePackage method which is
essentially the exact same as .override, except that it is no
longer clobbered by callPackage. This .overridePackage method
allows one to override the arguments supplied to
buildDhall{Directory,GitHub}Package, making it easier to specify
package versions outside of the ones supported by Nixpkgs..

This also includes a change to only build one (preferred) version of each
package (instead of multiple supported versions per package), in order to
minimize the maintenance burden for the Dhall package set.

I verified that all of the supported Dhall packages still build after this change.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Before this change, a Dhall package like the Prelude would be
encoded as a record with one field per supported version.  Then
downstream packages would specify which package to override
by selecting a different record field.

The problem with that approach is that it did not provide an
easy way to override a package to a version other than the default
ones supplied by Nixpkgs.  Normally you would use the `.override`
method for this purpose, but the `override` method added by
`buildDhall{Directory,GitHub}Package` is clobbered by the
`override` method added by `callPackage` in
`./pkgs/top-level/dhall-packages.nix`.

The solution is to add a separate `.overridePackage` method which is
essentially the exact same as `.override`, except that it is no
longer clobbered by `callPackage`.  This `.overridePackage` method
allows one to override the arguments supplied to
`buildDhall{Directory,GitHub}Package`, making it easier to specify
package versions outside of the ones supported by Nixpkgs..

This also includes a change to only build one (preferred) version of each
package (instead of multiple supported versions per package), in order to
minimize the maintenance burden for the Dhall package set.
Gabriella439 added a commit to dhall-lang/dhall-haskell that referenced this pull request Nov 1, 2020
The following pull request explains why this change is necessary:

NixOS/nixpkgs#102392
@Gabriella439
Copy link
Contributor Author

What's the next step for merging this? I don't have permission to merge

@Gabriella439
Copy link
Contributor Author

@Profpatsch: Do you have the ability to merge this in?

@ehmry
Copy link
Contributor

ehmry commented Nov 11, 2020

This change is a transparent refactor so I'm merging.

@ehmry ehmry merged commit 87d5e6f into NixOS:master Nov 11, 2020
Gabriella439 added a commit to dhall-lang/dhall-haskell that referenced this pull request Nov 12, 2020
The following pull request explains why this change is necessary:

NixOS/nixpkgs#102392
Gabriella439 added a commit to dhall-lang/dhall-lang that referenced this pull request Nov 23, 2020
The motivation of this change is to pick up
[newer Nixpkgs code](NixOS/nixpkgs#102392)
necessary to support `store.dhall-lang.org`.  See:

https://discourse.dhall-lang.org/t/rfc-proxy-dhall-lang-org/144

This also consolidates all of our Nixpkgs references into a single reference
to simplify future upgrades.
Gabriella439 added a commit to dhall-lang/dhall-lang that referenced this pull request Nov 24, 2020
The motivation of this change is to pick up
[newer Nixpkgs code](NixOS/nixpkgs#102392)
necessary to support `store.dhall-lang.org`.  See:

https://discourse.dhall-lang.org/t/rfc-proxy-dhall-lang-org/144

This also consolidates all of our Nixpkgs references into a single reference
to simplify future upgrades.
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