mirror of
https://git.sr.ht/~goorzhel/turboprop
synced 2024-12-14 11:37:37 +00:00
69 lines
1.9 KiB
Nix
69 lines
1.9 KiB
Nix
{
|
|
description = "Kubernetes deployments flake";
|
|
|
|
inputs = {
|
|
# Base
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
nix-kube-generators.url = "github:farcaller/nix-kube-generators";
|
|
nixhelm.url = "github:farcaller/nixhelm";
|
|
|
|
# Dev
|
|
devshell.url = "github:numtide/devshell";
|
|
|
|
# Need to import charts or YAML bundles from Git? Clues in 37cabf5.
|
|
};
|
|
|
|
outputs = inputs @ {
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
nix-kube-generators,
|
|
nixhelm,
|
|
devshell,
|
|
}: let
|
|
rakeLeaves = (import ./lib/rake.nix).rakeLeaves;
|
|
in
|
|
{
|
|
releaseData = rakeLeaves ./releases;
|
|
repos = rakeLeaves ./charts;
|
|
}
|
|
// flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [devshell.overlays.default];
|
|
};
|
|
kubelib = nix-kube-generators.lib {inherit pkgs;};
|
|
lib = import ./lib {inherit kubelib pkgs;};
|
|
|
|
downloadCharts = reponame: charts:
|
|
builtins.mapAttrs
|
|
(chartname: chartspec: kubelib.downloadHelmChart chartspec)
|
|
charts;
|
|
charts = builtins.mapAttrs downloadCharts self.repos;
|
|
|
|
buildReleases = namespace: releases:
|
|
builtins.mapAttrs
|
|
(name: module: (module {inherit name namespace lib charts kubelib;}))
|
|
releases;
|
|
releases = builtins.mapAttrs buildReleases self.releaseData;
|
|
in {
|
|
packages = {
|
|
inherit charts releases;
|
|
|
|
default = pkgs.stdenv.mkDerivation {
|
|
pname = "kubeflake";
|
|
version = "0.0.1";
|
|
releases = with pkgs.lib; attrsets.collect isDerivation releases;
|
|
src = ./.;
|
|
buildInputs = [pkgs.kustomize];
|
|
phases = ["installPhase"];
|
|
installPhase = builtins.readFile ./lib/output.sh;
|
|
};
|
|
};
|
|
devShell = pkgs.devshell.mkShell {
|
|
imports = [(pkgs.devshell.importTOML ./devshell.toml)];
|
|
};
|
|
formatter = pkgs.alejandra;
|
|
});
|
|
}
|