forked from mirrors/nixpkgs
459cf94991
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
26 lines
609 B
Nix
26 lines
609 B
Nix
{ buildDhallPackage, lib }:
|
|
|
|
# This is a minor variation on `buildDhallPackage` that splits the `code`
|
|
# argument into `src` and `file` in such a way that you can easily override
|
|
# the `file`
|
|
#
|
|
# This function is used by `dhall-to-nixpkgs` when given a directory
|
|
lib.makeOverridable
|
|
( { # Arguments passed through to `buildDhallPackage`
|
|
name
|
|
, dependencies ? []
|
|
, source ? false
|
|
|
|
, src
|
|
, # The file to import, relative to the root directory
|
|
file ? "package.dhall"
|
|
}:
|
|
|
|
buildDhallPackage {
|
|
inherit name dependencies source;
|
|
|
|
code = "${src}/${file}";
|
|
}
|
|
)
|
|
|