2023-11-15 06:09:04 +00:00
|
|
|
{
|
2023-11-28 06:16:02 +00:00
|
|
|
description = "Templates Helm deployments using Nix";
|
2023-11-15 06:09:04 +00:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-12-04 01:07:21 +00:00
|
|
|
haumea = {
|
|
|
|
url = "github:nix-community/haumea/v0.2.2";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-12-04 06:39:09 +00:00
|
|
|
nixhelm = {
|
|
|
|
url = "github:farcaller/nixhelm";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-11-27 07:41:14 +00:00
|
|
|
nix-kube-generators.url = "github:farcaller/nix-kube-generators";
|
2023-11-15 06:09:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = inputs @ {
|
|
|
|
self,
|
|
|
|
flake-utils,
|
2023-12-04 06:39:09 +00:00
|
|
|
haumea,
|
2023-11-15 06:09:04 +00:00
|
|
|
nix-kube-generators,
|
2023-12-04 06:39:09 +00:00
|
|
|
nixhelm,
|
|
|
|
nixpkgs,
|
2023-12-04 01:07:21 +00:00
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
2023-11-27 07:41:14 +00:00
|
|
|
pkgs = import nixpkgs {inherit system;};
|
2023-11-15 06:55:56 +00:00
|
|
|
kubelib = nix-kube-generators.lib {inherit pkgs;};
|
2023-12-04 05:36:54 +00:00
|
|
|
lib = import ./lib {inherit kubelib pkgs;};
|
2023-12-04 06:39:09 +00:00
|
|
|
nixhelmCharts = nixhelm.chartsDerivations.${system};
|
|
|
|
|
|
|
|
mkCharts = src:
|
|
|
|
haumea.lib.load {
|
|
|
|
inherit src;
|
|
|
|
loader = {...}: p: lib.fetchers.helmChart (import p);
|
|
|
|
transformer = haumea.lib.transformers.liftDefault;
|
|
|
|
# TODO: split charts to own `.nix` files
|
|
|
|
# and remove this transformer
|
|
|
|
};
|
2023-11-15 06:09:04 +00:00
|
|
|
in {
|
2023-12-04 06:39:09 +00:00
|
|
|
inherit mkCharts;
|
|
|
|
|
|
|
|
# This may be used to generate the `charts` input to
|
|
|
|
# `turboprop.lib`, so filing this in `lib` would cause
|
|
|
|
# a catch-22.
|
|
|
|
mkChartsWithNixhelm = src:
|
|
|
|
pkgs.lib.attrsets.recursiveUpdate
|
|
|
|
nixhelmCharts
|
|
|
|
(mkCharts src);
|
|
|
|
|
|
|
|
# Can't file in lib for the same reason.
|
|
|
|
# I use this in my `userData`.
|
|
|
|
app-template = import src/app-template.nix {
|
|
|
|
charts = nixhelmCharts;
|
|
|
|
inherit lib pkgs;
|
|
|
|
};
|
|
|
|
|
|
|
|
lib = {
|
|
|
|
charts ? nixhelmCharts,
|
|
|
|
user ? {},
|
|
|
|
}:
|
2023-12-04 05:36:54 +00:00
|
|
|
import self {
|
|
|
|
inherit charts haumea lib pkgs user;
|
|
|
|
};
|
2023-12-04 01:07:21 +00:00
|
|
|
# TODO: make a template
|
2023-11-15 06:09:04 +00:00
|
|
|
formatter = pkgs.alejandra;
|
|
|
|
});
|
|
|
|
}
|