mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-09-17 10:27:08 +03:00
90c1eb8851
This improves the granularity of the Nix build graph in order to minimize unnecessary rebuilds. This also fixed several bugs in the package generation along the way, so this change includes those fixes.
43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
{ fetchurl, make-dhall-kubernetes-package, lib, stdenv }:
|
|
|
|
let
|
|
kubernetesDirectory = ./kubernetes;
|
|
|
|
kubernetesPaths = builtins.readDir kubernetesDirectory;
|
|
|
|
toKeyValue =
|
|
file: _:
|
|
let
|
|
version = builtins.replaceStrings [ ".txt" ] [ "" ] file;
|
|
|
|
in
|
|
{ name = version;
|
|
|
|
value =
|
|
let
|
|
spec =
|
|
stdenv.mkDerivation {
|
|
name = "kubernetes-${version}";
|
|
|
|
src =
|
|
fetchurl {
|
|
url = "https://github.com/kubernetes/kubernetes/archive/release-${version}.tar.gz";
|
|
|
|
sha256 =
|
|
builtins.replaceStrings [ "\n" ] [ "" ]
|
|
(builtins.readFile (kubernetesDirectory + "/${file}"));
|
|
};
|
|
|
|
phases = [ "unpackPhase" "installPhase" ];
|
|
|
|
installPhase = ''
|
|
cp api/openapi-spec/swagger.json $out
|
|
'';
|
|
};
|
|
in
|
|
make-dhall-kubernetes-package spec;
|
|
};
|
|
|
|
in
|
|
lib.mapAttrs' toKeyValue kubernetesPaths
|