commit 0078a09395aa12dd895755bdad1f691de0a7fa17 Author: s0me1newithhand7s Date: Sun Mar 29 04:20:33 2026 +0300 initial commit Signed-off-by: s0me1newithhand7s diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..117c726 --- /dev/null +++ b/.envrc @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM=" +fi + +export DEVENV_IN_DIRENV_SHELL=true + +watch_file flake.nix +watch_file flake.lock + +mkdir -p "$PWD/.devenv" +DEVENV_ROOT_FILE="$PWD/.devenv/root" +printf %s "$PWD" >"$DEVENV_ROOT_FILE" +if ! use flake . --override-input devenv-root "file+file://$DEVENV_ROOT_FILE"; then + echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 +fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a354729 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# stuff from devenv and direnv-nix +.direnv/ +.devenv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f33a657 --- /dev/null +++ b/flake.lock @@ -0,0 +1,1363 @@ +{ + "nodes": { + "cachix": { + "inputs": { + "devenv": "devenv", + "flake-compat": "flake-compat", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1774017633, + "narHash": "sha256-CWhnwL2M83/ItapPVeJqCevRoQttesYxJ1h0Mo6ZCXs=", + "owner": "cachix", + "repo": "cachix", + "rev": "e8be573b417f3daa3dd4cb9052178f848e0c9d1d", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, + "cachix_2": { + "inputs": { + "devenv": [ + "cachix", + "devenv" + ], + "flake-compat": [ + "cachix", + "devenv", + "flake-compat" + ], + "git-hooks": [ + "cachix", + "devenv", + "git-hooks" + ], + "nixpkgs": [ + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1760971495, + "narHash": "sha256-IwnNtbNVrlZIHh7h4Wz6VP0Furxg9Hh0ycighvL5cZc=", + "owner": "cachix", + "repo": "cachix", + "rev": "c5bfd933d1033672f51a863c47303fc0e093c2d2", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, + "cachix_3": { + "inputs": { + "devenv": [ + "devenv" + ], + "flake-compat": [ + "devenv", + "flake-compat" + ], + "git-hooks": [ + "devenv", + "git-hooks" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1767714506, + "narHash": "sha256-WaTs0t1CxhgxbIuvQ97OFhDTVUGd1HA+KzLZUZBhe0s=", + "owner": "cachix", + "repo": "cachix", + "rev": "894c649f0daaa38bbcfb21de64be47dfa7cd0ec9", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, + "cachix_4": { + "inputs": { + "devenv": [ + "devenv", + "crate2nix" + ], + "flake-compat": [ + "devenv", + "crate2nix" + ], + "git-hooks": "git-hooks_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1767714506, + "narHash": "sha256-WaTs0t1CxhgxbIuvQ97OFhDTVUGd1HA+KzLZUZBhe0s=", + "owner": "cachix", + "repo": "cachix", + "rev": "894c649f0daaa38bbcfb21de64be47dfa7cd0ec9", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, + "cachix_5": { + "inputs": { + "devenv": [ + "devenv", + "crate2nix", + "crate2nix_stable" + ], + "flake-compat": [ + "devenv", + "crate2nix", + "crate2nix_stable" + ], + "git-hooks": "git-hooks_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1767714506, + "narHash": "sha256-WaTs0t1CxhgxbIuvQ97OFhDTVUGd1HA+KzLZUZBhe0s=", + "owner": "cachix", + "repo": "cachix", + "rev": "894c649f0daaa38bbcfb21de64be47dfa7cd0ec9", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, + "crate2nix": { + "inputs": { + "cachix": "cachix_4", + "crate2nix_stable": "crate2nix_stable", + "devshell": "devshell_2", + "flake-compat": "flake-compat_3", + "flake-parts": "flake-parts_3", + "nix-test-runner": "nix-test-runner_2", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1773440526, + "narHash": "sha256-OcX1MYqUdoalY3/vU67PEx8m6RvqGxX0LwKonjzXn7I=", + "owner": "nix-community", + "repo": "crate2nix", + "rev": "e697d3049c909580128caa856ab8eb709556a97b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "crate2nix", + "type": "github" + } + }, + "crate2nix_stable": { + "inputs": { + "cachix": "cachix_5", + "crate2nix_stable": [ + "devenv", + "crate2nix", + "crate2nix_stable" + ], + "devshell": "devshell", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_2", + "nix-test-runner": "nix-test-runner", + "nixpkgs": "nixpkgs_4", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1769627083, + "narHash": "sha256-SUuruvw1/moNzCZosHaa60QMTL+L9huWdsCBN6XZIic=", + "owner": "nix-community", + "repo": "crate2nix", + "rev": "7c33e664668faecf7655fa53861d7a80c9e464a2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "0.15.0", + "repo": "crate2nix", + "type": "github" + } + }, + "devenv": { + "inputs": { + "cachix": "cachix_2", + "flake-compat": [ + "cachix", + "flake-compat" + ], + "flake-parts": "flake-parts", + "git-hooks": [ + "cachix", + "git-hooks" + ], + "nix": "nix", + "nixd": "nixd", + "nixpkgs": [ + "cachix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772738982, + "narHash": "sha256-9MN0FV0XeYJV7kFtUxY6uQMxbZmlrPQLUm3yLbEEJ7Q=", + "owner": "cachix", + "repo": "devenv", + "rev": "22ec127af85396b04af045ec20d004d11a0675af", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "cachix": "cachix_3", + "crate2nix": "crate2nix", + "flake-compat": "flake-compat_4", + "flake-parts": "flake-parts_4", + "git-hooks": "git-hooks_4", + "nix": "nix_2", + "nixd": "nixd_2", + "nixpkgs": "nixpkgs_5", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1774725838, + "narHash": "sha256-Y5/p+IcOWvTBC3aQ39GroyzWFKo/edJVG537Yzel/Mc=", + "owner": "cachix", + "repo": "devenv", + "rev": "488860aa6389de926c6f465f176e0ed83cbe8077", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768818222, + "narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=", + "owner": "numtide", + "repo": "devshell", + "rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "devshell_2": { + "inputs": { + "nixpkgs": [ + "devenv", + "crate2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768818222, + "narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=", + "owner": "numtide", + "repo": "devshell", + "rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "revCount": 69, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_3": { + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "revCount": 69, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1760948891, + "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768135262, + "narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "crate2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768135262, + "narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_5": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_6": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "revCount": 442, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.442%2Brev-57928607ea566b5db3ad13af0e57e921e6b12381/019c1cea-7090-7d32-9a74-9794d2b26381/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1" + } + }, + "flake-root": { + "locked": { + "lastModified": 1723604017, + "narHash": "sha256-rBtQ8gg+Dn4Sx/s+pvjdq3CB2wQNzx9XGFq/JVGCB6k=", + "owner": "srid", + "repo": "flake-root", + "rev": "b759a56851e10cb13f6b8e5698af7b59c44be26e", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "flake-root", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "cachix", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "cachix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772665116, + "narHash": "sha256-XmjUDG/J8Z8lY5DVNVUf5aoZGc400FxcjsNCqHKiKtc=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "39f53203a8458c330f61cc0759fe243f0ac0d198", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat_5", + "gitignore": "gitignore_7", + "nixpkgs": "nixpkgs_6" + }, + "locked": { + "lastModified": 1774104215, + "narHash": "sha256-EAtviqz0sEAxdHS4crqu7JGR5oI3BwaqG0mw7CmXkO8=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "f799ae951fde0627157f40aec28dec27b22076d0", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks_2": { + "inputs": { + "flake-compat": [ + "devenv", + "crate2nix", + "cachix", + "flake-compat" + ], + "gitignore": "gitignore_2", + "nixpkgs": [ + "devenv", + "crate2nix", + "cachix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765404074, + "narHash": "sha256-+ZDU2d+vzWkEJiqprvV5PR26DVFN2vgddwG5SnPZcUM=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "2d6f58930fbcd82f6f9fd59fb6d13e37684ca529", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks_3": { + "inputs": { + "flake-compat": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "cachix", + "flake-compat" + ], + "gitignore": "gitignore_3", + "nixpkgs": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "cachix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765404074, + "narHash": "sha256-+ZDU2d+vzWkEJiqprvV5PR26DVFN2vgddwG5SnPZcUM=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "2d6f58930fbcd82f6f9fd59fb6d13e37684ca529", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks_4": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "gitignore": "gitignore_6", + "nixpkgs": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772893680, + "narHash": "sha256-JDqZMgxUTCq85ObSaFw0HhE+lvdOre1lx9iI6vYyOEs=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "8baab586afc9c9b57645a734c820e4ac0a604af9", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "github-actions-nix": { + "inputs": { + "flake-parts": "flake-parts_6", + "nixpkgs": "nixpkgs_7" + }, + "locked": { + "lastModified": 1773808042, + "narHash": "sha256-97K9g40SdtDVWslJG8ytpiC3+qgeQzftsZheGQ8qoGY=", + "owner": "synapdeck", + "repo": "github-actions-nix", + "rev": "805a4f69856e0f3d0bcd8ae916f1625f22b0578c", + "type": "github" + }, + "original": { + "owner": "synapdeck", + "repo": "github-actions-nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "cachix", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "devenv", + "crate2nix", + "cachix", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_3": { + "inputs": { + "nixpkgs": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "cachix", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_4": { + "inputs": { + "nixpkgs": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_5": { + "inputs": { + "nixpkgs": [ + "devenv", + "crate2nix", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_6": { + "inputs": { + "nixpkgs": [ + "devenv", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_7": { + "inputs": { + "nixpkgs": [ + "git-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": [ + "cachix", + "devenv", + "flake-compat" + ], + "flake-parts": [ + "cachix", + "devenv", + "flake-parts" + ], + "git-hooks-nix": [ + "cachix", + "devenv", + "git-hooks" + ], + "nixpkgs": [ + "cachix", + "devenv", + "nixpkgs" + ], + "nixpkgs-23-11": [ + "cachix", + "devenv" + ], + "nixpkgs-regression": [ + "cachix", + "devenv" + ] + }, + "locked": { + "lastModified": 1771532737, + "narHash": "sha256-H26FQmOyvIGnedfAioparJQD8Oe+/byD6OpUpnI/hkE=", + "owner": "cachix", + "repo": "nix", + "rev": "7eb6c427c7a86fdc3ebf9e6cbf2a84e80e8974fd", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "devenv-2.32", + "repo": "nix", + "type": "github" + } + }, + "nix-test-runner": { + "flake": false, + "locked": { + "lastModified": 1588761593, + "narHash": "sha256-FKJykltAN/g3eIceJl4SfDnnyuH2jHImhMrXS2KvGIs=", + "owner": "stoeffel", + "repo": "nix-test-runner", + "rev": "c45d45b11ecef3eb9d834c3b6304c05c49b06ca2", + "type": "github" + }, + "original": { + "owner": "stoeffel", + "repo": "nix-test-runner", + "type": "github" + } + }, + "nix-test-runner_2": { + "flake": false, + "locked": { + "lastModified": 1588761593, + "narHash": "sha256-FKJykltAN/g3eIceJl4SfDnnyuH2jHImhMrXS2KvGIs=", + "owner": "stoeffel", + "repo": "nix-test-runner", + "rev": "c45d45b11ecef3eb9d834c3b6304c05c49b06ca2", + "type": "github" + }, + "original": { + "owner": "stoeffel", + "repo": "nix-test-runner", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-parts": [ + "devenv", + "flake-parts" + ], + "git-hooks-nix": [ + "devenv", + "git-hooks" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-23-11": [ + "devenv" + ], + "nixpkgs-regression": [ + "devenv" + ] + }, + "locked": { + "lastModified": 1774103430, + "narHash": "sha256-MRNVInSmvhKIg3y0UdogQJXe+omvKijGszFtYpd5r9k=", + "owner": "cachix", + "repo": "nix", + "rev": "e127c1c94cefe02d8ca4cca79ef66be4c527510e", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "devenv-2.32", + "repo": "nix", + "type": "github" + } + }, + "nixd": { + "inputs": { + "flake-parts": [ + "cachix", + "devenv", + "flake-parts" + ], + "flake-root": "flake-root", + "nixpkgs": [ + "cachix", + "devenv", + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1763964548, + "narHash": "sha256-JTRoaEWvPsVIMFJWeS4G2isPo15wqXY/otsiHPN0zww=", + "owner": "nix-community", + "repo": "nixd", + "rev": "d4bf15e56540422e2acc7bc26b20b0a0934e3f5e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixd", + "type": "github" + } + }, + "nixd_2": { + "inputs": { + "flake-parts": [ + "devenv", + "flake-parts" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix_2" + }, + "locked": { + "lastModified": 1773634079, + "narHash": "sha256-49qb4QNMv77VOeEux+sMd0uBhPvvHgVc0r938Bulvbo=", + "owner": "nix-community", + "repo": "nixd", + "rev": "8ecf93d4d93745e05ea53534e8b94f5e9506e6bd", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixd", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1772624091, + "narHash": "sha256-QKyJ0QGWBn6r0invrMAK8dmJoBYWoOWy7lN+UHzW1jc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "80bdc1e5ce51f56b19791b52b2901187931f5353", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1772328832, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1769909678, + "narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "72716169fe93074c333e8d0173151350670b824c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-src": { + "flake": false, + "locked": { + "lastModified": 1773597492, + "narHash": "sha256-hQ284SkIeNaeyud+LS0WVLX+WL2rxcVZLFEaK0e03zg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a07d4ce6bee67d7c838a8a5796e75dff9caa21ef", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1765186076, + "narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1765186076, + "narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1769433173, + "narHash": "sha256-Gf1dFYgD344WZ3q0LPlRoWaNdNQq8kSBDLEWulRQSEs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "13b0f9e6ac78abbbb736c635d87845c4f4bee51b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "inputs": { + "nixpkgs-src": "nixpkgs-src" + }, + "locked": { + "lastModified": 1773704619, + "narHash": "sha256-LKtmit8Sr81z8+N2vpIaN/fyiQJ8f7XJ6tMSKyDVQ9s=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "906534d75b0e2fe74a719559dfb1ad3563485f43", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1770073757, + "narHash": "sha256-Vy+G+F+3E/Tl+GMNgiHl9Pah2DgShmIUBJXmbiQPHbI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "47472570b1e607482890801aeaf29bfb749884f6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { + "locked": { + "lastModified": 1770197578, + "narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=", + "rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2", + "revCount": 940249, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.940249%2Brev-00c21e4c93d963c50d4c0c89bfa84ed6e0694df2/019c2c37-21f9-727c-86c5-0523e601d163/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1" + } + }, + "nixpkgs_8": { + "locked": { + "lastModified": 1774386573, + "narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_9": { + "locked": { + "lastModified": 1770107345, + "narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4533d9293756b63904b7238acb84ac8fe4c8c2c4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "flake-compat" + ], + "gitignore": "gitignore_4", + "nixpkgs": [ + "devenv", + "crate2nix", + "crate2nix_stable", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769069492, + "narHash": "sha256-Efs3VUPelRduf3PpfPP2ovEB4CXT7vHf8W+xc49RL/U=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "a1ef738813b15cf8ec759bdff5761b027e3e1d23", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": [ + "devenv", + "crate2nix", + "flake-compat" + ], + "gitignore": "gitignore_5", + "nixpkgs": [ + "devenv", + "crate2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769069492, + "narHash": "sha256-Efs3VUPelRduf3PpfPP2ovEB4CXT7vHf8W+xc49RL/U=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "a1ef738813b15cf8ec759bdff5761b027e3e1d23", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "cachix": "cachix", + "devenv": "devenv_2", + "flake-parts": "flake-parts_5", + "git-hooks-nix": "git-hooks-nix", + "github-actions-nix": "github-actions-nix", + "nixpkgs": "nixpkgs_8", + "treefmt-nix": "treefmt-nix_3" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773630837, + "narHash": "sha256-zJhgAGnbVKeBMJOb9ctZm4BGS/Rnrz+5lfSXTVah4HQ=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f600ea449c7b5bb596fa1cf21c871cc5b9e31316", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "cachix", + "devenv", + "nixd", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1734704479, + "narHash": "sha256-MMi74+WckoyEWBRcg/oaGRvXC9BVVxDZNRMpL+72wBI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "65712f5af67234dad91a5a4baee986a8b62dbf8f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "devenv", + "nixd", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772660329, + "narHash": "sha256-IjU1FxYqm+VDe5qIOxoW+pISBlGvVApRjiw/Y/ttJzY=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "3710e0e1218041bbad640352a0440114b1e10428", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_3": { + "inputs": { + "nixpkgs": "nixpkgs_9" + }, + "locked": { + "lastModified": 1773297127, + "narHash": "sha256-6E/yhXP7Oy/NbXtf1ktzmU8SdVqJQ09HC/48ebEGBpk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "71b125cd05fbfd78cab3e070b73544abe24c5016", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c253b63 --- /dev/null +++ b/flake.nix @@ -0,0 +1,228 @@ +{ + 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"; + } + ]; + }; + }; + } + ]; + }; + }; + }; + }; +} diff --git a/lib/flakeModules.nix b/lib/flakeModules.nix new file mode 100644 index 0000000..541e5d8 --- /dev/null +++ b/lib/flakeModules.nix @@ -0,0 +1,181 @@ +{ + lib, + flake-parts-lib, + ... +}: { + options = { + perSystem = flake-parts-lib.mkPerSystemOption ( + { + config, + pkgs, + ... + }: { + options = { + kubeClusters = lib.mkOption { + default = {}; + description = "Attribute set of Kubernetes/Talos clusters."; + type = lib.types.attrsOf ( + lib.types.submodule ( + {config, ...}: { + config = { + toolchainPkgs = lib.pipe config.toolchain [ + builtins.attrValues + (builtins.filter (p: p != null)) + ]; + }; + + options = { + toolchainPkgs = lib.mkOption { + type = lib.types.listOf lib.types.package; + description = "Calculated toolchain packages for this cluster"; + readOnly = true; + }; + + objects = lib.mkOption { + default = []; + description = "List of cluster objects."; + type = lib.types.listOf ( + lib.types.submodule { + options = { + type = lib.mkOption { + description = "Object type."; + type = lib.types.enum [ + "kubeObject" + "talosObject" + "helmObject" + "helmfileObject" + ]; + }; + + content = lib.mkOption { + description = "Raw content, validated by kubeconform/talosctl."; + type = lib.types.anything; + }; + }; + } + ); + }; + + toolchain = lib.mkOption { + default = {}; + + type = lib.types.submodule { + options = { + kubePkg = lib.mkOption { + description = "Place for kubectl."; + type = lib.types.package; + default = pkgs.kubectl; + }; + + helmPkg = lib.mkOption { + description = "Place for helm."; + type = lib.types.package; + default = pkgs.kubernetes-helm; + }; + + talosPkg = lib.mkOption { + description = "Place for talosctl."; + type = lib.types.package; + default = pkgs.talosctl; + }; + + helmfilePkg = lib.mkOption { + description = "Place for helmfile"; + type = lib.types.package; + default = pkgs.helmfile; + }; + }; + }; + }; + }; + } + ) + ); + }; + }; + + config = { + apps = + lib.mapAttrs ( + name: cluster: { + type = "app"; + program = toString ( + pkgs.writeShellScript "apply-${name}" '' + # safe measures lol + # logic could be better + set -e + nix build .#${name} + cd result + + # pre-apply + # aka dry-run + + printf "validating " + + [ -d kube/ ] && \ + ${lib.getExe cluster.toolchain.kubePkg} apply \ + --dry-run=client --validate=true \ + -f kube/ + + [ -d talos/ ] && \ + ${lib.getExe cluster.toolchain.talosPkg} config validate \ + --file talos/ + + [ -d helmfile/ ] && \ + ${lib.getExe cluster.toolchain.helmfilePkg} lint + + # apply + # !!!! + + printf "applying 🤓" + + [ -d kube/ ] && \ + ${lib.getExe cluster.toolchain.kubePkg} apply -f kube/ + + [ -d helm/ ] && \ + ${lib.getExe cluster.toolchain.helmPkg} upgrade --install \ + --atomic --cleanup-on-fail --timeout 5m \ + "${name}" ./helm/ + + [ -d talos/ ] && \ + ${lib.getExe cluster.toolchain.talosPkg} apply-config -f talos/ + + [ -d helmfile/ ] && \ + ${lib.getExe cluster.toolchain.helmfilePkg} apply + '' + ); + } + ) + config.kubeClusters; + + packages = + lib.mapAttrs ( + name: cluster: + pkgs.symlinkJoin { + name = "kube-cluster-${name}"; + paths = + lib.concatMap ( + obj: + lib.toList ( + ( + import ./generators { + inherit + lib + ; + } + pkgs + ).${ + obj.type + } + obj.content + ) + ) + cluster.objects; + } + ) + config.kubeClusters; + }; + } + ); + }; +} diff --git a/lib/generators/default.nix b/lib/generators/default.nix new file mode 100644 index 0000000..3d9e2c2 --- /dev/null +++ b/lib/generators/default.nix @@ -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; +} diff --git a/lib/generators/helm.nix b/lib/generators/helm.nix new file mode 100644 index 0000000..4302182 --- /dev/null +++ b/lib/generators/helm.nix @@ -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 +'' diff --git a/lib/generators/helmfile.nix b/lib/generators/helmfile.nix new file mode 100644 index 0000000..5d6c9ca --- /dev/null +++ b/lib/generators/helmfile.nix @@ -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 +'' diff --git a/lib/generators/kube.nix b/lib/generators/kube.nix new file mode 100644 index 0000000..a1c698d --- /dev/null +++ b/lib/generators/kube.nix @@ -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)} +'' diff --git a/lib/generators/talos.nix b/lib/generators/talos.nix new file mode 100644 index 0000000..0a0fd7b --- /dev/null +++ b/lib/generators/talos.nix @@ -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)} +''