initial commit

Signed-off-by: s0me1newithhand7s <git+me@hand7s.org>
This commit is contained in:
s0me1newithhand7s 2026-03-29 04:20:33 +03:00
commit 0078a09395
10 changed files with 1859 additions and 0 deletions

View file

@ -0,0 +1,33 @@
{lib, ...}: pkgs: {
kubeObject =
import ./kube.nix {
inherit
lib
;
}
pkgs;
talosObject =
import ./talos.nix {
inherit
lib
;
}
pkgs;
helmObject =
import ./helm.nix {
inherit
lib
;
}
pkgs;
helmfileObject =
import ./helmfile.nix {
inherit
lib
;
}
pkgs;
}

10
lib/generators/helm.nix Normal file
View file

@ -0,0 +1,10 @@
_: pkgs: content:
pkgs.runCommand "helm-${content.name}" {} ''
mkdir -p $out/helm/${content.name}/templates
cp ${(pkgs.formats.yaml {}).generate "Chart.yaml" {
apiVersion = "v2";
name = content.name;
version = content.version or "0.1.0";
}} $out/helm/${content.name}/Chart.yaml
cp ${(pkgs.formats.yaml {}).generate "values.yaml" (content.values or {})} $out/helm/${content.name}/values.yaml
''

View file

@ -0,0 +1,8 @@
_: pkgs: content:
pkgs.runCommand "helmfile" {} ''
mkdir -p $out/helmfile
cp ${(pkgs.formats.yaml {}).generate "helmfile.yaml" {
repositories = content.repositories or [];
releases = map (r: r // {chart = "${r.chart}";}) content.releases;
}} $out/helmfile/helmfile.yaml
''

8
lib/generators/kube.nix Normal file
View file

@ -0,0 +1,8 @@
{lib, ...}: pkgs: content:
pkgs.runCommand "kube-manifests" {} ''
mkdir -p $out/kube
${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: attrs: ''
cp ${(pkgs.formats.yaml {}).generate name attrs} $out/kube/${name}
'')
content)}
''

8
lib/generators/talos.nix Normal file
View file

@ -0,0 +1,8 @@
{lib, ...}: pkgs: content:
pkgs.runCommand "talos-manifests" {} ''
mkdir -p $out/talos
${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: attrs: ''
cp ${(pkgs.formats.yaml {}).generate name attrs} $out/talos/${name}
'')
content)}
''