feat: improve helm code

This commit is contained in:
Chris Kruining 2025-11-06 15:48:06 +01:00
parent 410396c215
commit 42c3e9224a
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
4 changed files with 249 additions and 20 deletions

View file

@ -1,4 +1,4 @@
{ lib, pkgs, ... }:
{ lib, pkgs, self, ... }:
let
inherit (builtins) readFile;
inherit (lib) mkOption types;
@ -48,9 +48,9 @@ in
};
perInstance = { instanceName, settings, machine, roles, ... }: {
nixosModule = { config, pkgs, inputs, system, ... }:
nixosModule = { config, pkgs, system, ... }:
let
terraform = inputs.terranix.lib.terranixConfiguration {
terraform = self.inputs.terranix.lib.terranixConfiguration {
inherit pkgs system;
modules = [
@ -76,6 +76,16 @@ in
];
};
chart = name: set:
let
rename = map: set: lib.mapAttrs' (n: v: lib.nameValuePair (map.${n} or n) v) set;
updateWith = b: a: a // b;
in
self.inputs.nixhelm.chartsMetadata
|> lib.attrByPath (lib.splitString "/" name) {}
|> rename { chart = "name"; chartHash = "hash"; }
|> updateWith set;
valuesYamlKey = "amarth/service/zitadel-${instanceName}-values.yml";
in
{
@ -117,12 +127,7 @@ in
};
services.k3s.autoDeployCharts = {
postgres = {
name = "postgresql";
repo = "https://charts.bitnami.com/bitnami";
version = "12.10.0";
hash = "sha256-htb+iCfdIV2hNbDvxivQDC1MwF9EDuT2juDEsyrVTrs=";
postgres = chart "bitnami/postgresql" {
targetNamespace = "postgres-system";
createNamespace = true;
@ -140,12 +145,7 @@ in
};
};
zitadel = {
name = "zitadel";
repo = "https://charts.zitadel.com";
version = "9.12.3";
hash = "sha256-eSpqy2vK1tJp0Ci20R7+zGLfUDKPuKOz1iWyvawqEpc=";
zitadel = chart "zitadel/zitadel" {
targetNamespace = "zitadel-system";
createNamespace = true;

View file

@ -1,6 +1,6 @@
{ ... }:
{ self, lib, pkgs, ... }:
let
module = ./default.nix;
module = lib.modules.importApply ./default.nix { inherit self lib pkgs; };
in
{
clan.modules.zitadel = module;

231
flake.lock generated
View file

@ -210,6 +210,63 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"haumea": {
"inputs": {
"nixpkgs": [
"nixhelm",
"nixpkgs"
]
},
"locked": {
"lastModified": 1685133229,
"narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=",
"owner": "nix-community",
"repo": "haumea",
"rev": "34dd58385092a23018748b50f9b23de6266dffc2",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "v0.2.2",
"repo": "haumea",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -231,6 +288,43 @@
"type": "github"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"nixhelm",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729742964,
"narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "e04df33f62cdcf93d73e9a04142464753a16db67",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix-kube-generators": {
"locked": {
"lastModified": 1729269463,
"narHash": "sha256-8jDDpC99fYl5CSHjZyPwb5PK7nQSknhkpfe8+DXI910=",
"owner": "farcaller",
"repo": "nix-kube-generators",
"rev": "2be4f3cb99e179d9f94e6c8723862421437f8efb",
"type": "github"
},
"original": {
"owner": "farcaller",
"repo": "nix-kube-generators",
"type": "github"
}
},
"nix-select": {
"locked": {
"lastModified": 1755887746,
@ -244,6 +338,28 @@
"url": "https://git.clan.lol/clan/nix-select/archive/main.tar.gz"
}
},
"nixhelm": {
"inputs": {
"flake-utils": "flake-utils",
"haumea": "haumea",
"nix-kube-generators": "nix-kube-generators",
"nixpkgs": "nixpkgs_2",
"poetry2nix": "poetry2nix"
},
"locked": {
"lastModified": 1762392780,
"narHash": "sha256-IiyS2AIxHlZC/BgO3ebtW20BWiZUQ1EbVlRNVGmljtI=",
"owner": "nix-community",
"repo": "nixhelm",
"rev": "c1b20cbaad6710af4dd031fac700f01a58786268",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixhelm",
"type": "github"
}
},
"nixos-facter-modules": {
"locked": {
"lastModified": 1762264948,
@ -276,6 +392,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1739020877,
"narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a79cfe0ebd24952b580b1cf08cd906354996d547",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1762111121,
"narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=",
@ -291,13 +423,39 @@
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"nixhelm",
"nixpkgs"
],
"systems": "systems_5",
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1738741221,
"narHash": "sha256-UiTOA89yQV5YNlO1ZAp4IqJUGWOnTyBC83netvt8rQE=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "be1fe795035d3d36359ca9135b26dcc5321b31fb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"amarth-customer-portal": "amarth-customer-portal",
"clan-core": "clan-core",
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_2",
"systems": "systems_3",
"nixhelm": "nixhelm",
"nixpkgs": "nixpkgs_3",
"systems": "systems_6",
"terranix": "terranix"
}
},
@ -382,13 +540,58 @@
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_7": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"terranix": {
"inputs": {
"flake-parts": "flake-parts_3",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_4"
"systems": "systems_7"
},
"locked": {
"lastModified": 1762161791,
@ -446,6 +649,28 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_3": {
"inputs": {
"nixpkgs": [
"nixhelm",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1730120726,
"narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "9ef337e492a5555d8e17a51c911ff1f02635be15",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -29,6 +29,10 @@
url = "github:terranix/terranix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixhelm = {
url = "github:nix-community/nixhelm";
};
};
outputs =