summary refs log tree commit diff
path: root/pkgs/top-level/dhall-packages.nix
diff options
context:
space:
mode:
authorGabriel Gonzalez <Gabriel439@gmail.com>2020-11-01 12:26:33 -0800
committerEmery Hemingway <ehmry@posteo.net>2020-11-11 11:16:04 +0100
commit87d5e6fc1adc56c3fb2b731e4183c6fd0c6a75a8 (patch)
treedd7074645309e001e4352daffac674e843c516f4 /pkgs/top-level/dhall-packages.nix
parentf9dd8f04a02568b202df0c37fc34b95fec0721c6 (diff)
Change idiom for overriding Dhall package version
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.
Diffstat (limited to 'pkgs/top-level/dhall-packages.nix')
-rw-r--r--pkgs/top-level/dhall-packages.nix18
1 files changed, 5 insertions, 13 deletions
diff --git a/pkgs/top-level/dhall-packages.nix b/pkgs/top-level/dhall-packages.nix
index 9d4801e9dc5cc..c1c2c5f0e3bbc 100644
--- a/pkgs/top-level/dhall-packages.nix
+++ b/pkgs/top-level/dhall-packages.nix
@@ -8,16 +8,6 @@ let
     let
       callPackage = newScope self;
 
-      prefer = version: path:
-        let
-          packages = callPackage path { };
-
-        in
-          packages."${version}".overrideAttrs (_: {
-              passthru = packages;
-            }
-          );
-
       buildDhallPackage =
         callPackage ../development/interpreters/dhall/build-dhall-package.nix { };
 
@@ -34,14 +24,16 @@ let
           buildDhallDirectoryPackage
         ;
 
+        lib = import ../development/dhall-modules/lib.nix { inherit lib; };
+
         dhall-kubernetes =
-          prefer "3.0.0" ../development/dhall-modules/dhall-kubernetes.nix;
+          callPackage ../development/dhall-modules/dhall-kubernetes.nix { };
 
         dhall-packages =
-          prefer "0.11.1" ../development/dhall-modules/dhall-packages.nix;
+          callPackage ../development/dhall-modules/dhall-packages.nix { };
 
         Prelude =
-          prefer "13.0.0" ../development/dhall-modules/Prelude.nix;
+          callPackage ../development/dhall-modules/Prelude.nix { };
       };
 
 in