1
0
Fork 0
mirror of https://git.sr.ht/~goorzhel/turboprop synced 2024-12-14 11:37:37 +00:00
turboprop/flake.nix
Antonio Gurgel 805b8a1b74 Pare down example flake; document mkDerivation
`mkDerivation` doesn't have to be assigned beforehand; it can just be
passed two attrsets. I only realized this after writing out its
signature in the documentation.

Also, the example flake in the documentation doesn't use nixpkgs,
so I removed it.
2023-12-05 22:03:23 -08:00

70 lines
1.8 KiB
Nix

{
description = "Templates Helm deployments using Nix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
haumea = {
url = "github:nix-community/haumea/v0.2.2";
inputs.nixpkgs.follows = "nixpkgs";
};
nixhelm = {
url = "github:farcaller/nixhelm";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-kube-generators.url = "github:farcaller/nix-kube-generators";
};
outputs = inputs @ {
self,
flake-utils,
haumea,
nix-kube-generators,
nixhelm,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
kubelib = nix-kube-generators.lib {inherit pkgs;};
lib = import ./lib {inherit kubelib pkgs;};
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
};
in {
lib = {
mkDerivation = {
charts ? nixhelmCharts,
user ? {},
}:
(import self {
inherit charts haumea lib pkgs user;
})
.mkDerivation;
app-template = import src/app-template.nix {
charts = nixhelmCharts;
inherit lib pkgs;
};
inherit mkCharts;
mkChartsWithNixhelm = src:
pkgs.lib.attrsets.recursiveUpdate
nixhelmCharts
(mkCharts src);
};
formatter = pkgs.alejandra;
templates.default = {
path = ./templates/default;
description = "Example Turboprop flake";
};
});
}