3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/top-level/dhall-packages.nix
Gabriel Gonzalez 459cf94991 Nixpkgs support for dhall-to-nixpkgs
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:

https://github.com/dhall-lang/dhall-haskell/pull/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
2020-06-17 15:57:21 +02:00

49 lines
1.1 KiB
Nix

{ lib
, newScope
, overrides ? (self: super: {})
}:
let
packages = self:
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 { };
buildDhallGitHubPackage =
callPackage ../development/interpreters/dhall/build-dhall-github-package.nix { };
buildDhallDirectoryPackage =
callPackage ../development/interpreters/dhall/build-dhall-directory-package.nix { };
in
{ inherit
buildDhallPackage
buildDhallGitHubPackage
buildDhallDirectoryPackage
;
dhall-kubernetes =
prefer "3.0.0" ../development/dhall-modules/dhall-kubernetes.nix;
dhall-packages =
prefer "0.11.1" ../development/dhall-modules/dhall-packages.nix;
Prelude =
prefer "13.0.0" ../development/dhall-modules/Prelude.nix;
};
in
lib.fix' (lib.extends overrides packages)