dhall-kubernetes/release.nix
Gabriel Gonzalez 2ed2ffd073
Improve user experience for generating files (#165)
This improves the documentation and scripts responsible for
generating files.  The main changes from the user's point of view
are:

* The `generate` script now supports four subcommands:

  * `generate kubernetes` - Generate all Kubernetes bindings
  * `generate examples` - Generate examples for the preferred Kubernetes version
  * `generate readme` - Generate the README from the Dhall template
  * `generate preferred` - Generate top-level files that re-export the preferred
    Kubernetes version

  The `generate` script without arguments generates everything

* Generation should be faster and more incremental now

  For example, regenerating the `README` by itself should go more quickly since
  it no longer requires regenerating any examples or Kubernetes bindings if
  they haven't changed

This required overhauling the internal Nix code for generating these files
to support more granular builds.

Another consequence of this change is that the preferred Kubernetes
version no longer packages `Prelude.dhall`, `README.dhall` or the
`examples`.  Those are now only stored within the top-level directory.
2021-03-23 11:32:34 -07:00

28 lines
909 B
Nix

{ pkgs ? import ./nix/nixpkgs.nix
, src ? { rev = ""; }
, ...
}:
let
products = {
# Derivation that trivially depends on the input source code revision.
# As this is included in the "dhall-lang" aggregate, it forces every
# commit to have a corresponding GitHub status check, even if the
# commit doesn't make any changes (which can happen when merging
# master in).
rev = pkgs.runCommand "rev" {} ''echo "${src.rev}" > $out'';
inherit (pkgs) examples readme;
} // builtins.removeAttrs pkgs.dhall-kubernetes
[ "override" "overrideDerivation" ]
// builtins.removeAttrs pkgs.dhall-kubernetes-tests
[ "override-test" "overrideDerivation-test" ];
dhall-kubernetes = pkgs.releaseTools.aggregate {
name = "dhall-kubernetes-aggregate";
constituents = pkgs.lib.mapAttrsToList (_: v: v) products;
};
in
products // { inherit dhall-kubernetes; }