kube-parts/flake.nix
s0me1newithhand7s 0078a09395 initial commit
Signed-off-by: s0me1newithhand7s <git+me@hand7s.org>
2026-03-29 04:20:33 +03:00

228 lines
5.2 KiB
Nix

{
inputs = {
"cachix" = {
flake = true;
type = "github";
owner = "cachix";
repo = "cachix";
};
"devenv" = {
flake = true;
type = "github";
owner = "cachix";
repo = "devenv";
};
"flake-parts" = {
flake = true;
type = "github";
owner = "hercules-ci";
repo = "flake-parts";
};
"github-actions-nix" = {
flake = true;
type = "github";
owner = "synapdeck";
repo = "github-actions-nix";
};
"git-hooks-nix" = {
flake = true;
type = "github";
owner = "cachix";
repo = "git-hooks.nix";
};
"nixpkgs" = {
flake = true;
type = "github";
owner = "nixos";
repo = "nixpkgs";
ref = "nixos-unstable";
};
"treefmt-nix" = {
flake = true;
type = "github";
owner = "numtide";
repo = "treefmt-nix";
};
};
outputs = inputs @ {
self,
flake-parts,
...
}:
flake-parts.lib.mkFlake {
inherit
inputs
self
;
} {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
imports = [
inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule
inputs.devenv.flakeModule
inputs.github-actions-nix.flakeModule
./lib/flakeModules.nix
];
flake = {
flakeModules = {
default = ./lib/flakeModules.nix;
};
};
perSystem = {
config,
pkgs,
...
}: {
devenv = {
shells = {
"default" = {
enterShell = config.pre-commit.shellHook;
devenv = {
root = toString /home/hand7s/Projects/flake;
};
packages =
[
config.treefmt.build.wrapper
]
++ config.pre-commit.settings.enabledPackages
++ config.kubeClusters."test".toolchainPkgs;
};
};
};
pre-commit = {
check = {
enable = true;
};
settings = {
enable = true;
package = pkgs.prek;
gitPackage = pkgs.git;
hooks = {
"alejandra" = {
enable = true;
settings = {
verbosity = "quiet";
check = true;
};
};
"deadnix" = {
enable = true;
settings = {
edit = false;
};
};
"statix" = {
enable = true;
};
};
};
};
kubeClusters = {
"test" = {
objects = [
{
type = "talosObject";
content = {
"controlplane.yaml" = {
version = "v1alpha1";
debug = false;
persist = true;
machine = {
type = "controlplane";
token = "abc123def456";
ca = {
crt = "qUoOLPqZw4XVehCSe11VQV62SIbTSVmP8dy+hpVQkBQ=";
key = "PF8jB7W4JQr7AIItDdILgKE19LseiCUkF7zyDBE9rl8=";
};
};
};
};
}
{
type = "helmObject";
content = {
name = "kube-prometheus-stack";
namespace = "monitoring";
chart = "prometheus-community/kube-prometheus-stack";
version = "45.0.0";
values = {
grafana = {
enabled = true;
adminPassword = "prom-operator";
};
prometheus = {
prometheusSpec = {
scrapeInterval = "15s";
};
};
};
};
}
{
type = "helmfileObject";
content = {
repositories = [
{
name = "bitnami"; # lord forgive me
url = "https://charts.bitnami.com";
}
];
releases = [
{
name = "redis";
chart = "bitnami/redis";
values = [{sentinel = {enabled = true;};}];
}
];
};
}
{
type = "kubeObject";
content = {
"pod.yaml" = {
apiVersion = "v1";
kind = "Pod";
metadata.name = "nginx";
spec.containers = [
{
name = "nginx";
image = "nginx:1.14.2";
}
];
};
};
}
];
};
};
};
};
}