{"id":13798573,"url":"https://github.com/hall/kubenix","last_synced_at":"2025-04-05T09:07:16.683Z","repository":{"id":56764400,"uuid":"523933676","full_name":"hall/kubenix","owner":"hall","description":"Kubernetes management with Nix","archived":false,"fork":false,"pushed_at":"2024-06-26T05:41:48.000Z","size":2735,"stargazers_count":341,"open_issues_count":25,"forks_count":32,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-29T08:06:01.511Z","etag":null,"topics":["helm","kube","kubectl","kubernetes","nix","nixos"],"latest_commit_sha":null,"homepage":"https://kubenix.org/","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hall.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-12T02:40:33.000Z","updated_at":"2025-03-23T19:08:38.000Z","dependencies_parsed_at":"2024-06-11T14:19:41.764Z","dependency_job_id":"004a87be-747d-49d0-ba77-10b4210ca09c","html_url":"https://github.com/hall/kubenix","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall%2Fkubenix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall%2Fkubenix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall%2Fkubenix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall%2Fkubenix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hall","download_url":"https://codeload.github.com/hall/kubenix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312078,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["helm","kube","kubectl","kubernetes","nix","nixos"],"created_at":"2024-08-04T00:00:46.229Z","updated_at":"2025-04-05T09:07:16.150Z","avatar_url":"https://github.com/hall.png","language":"Nix","readme":"# kubenix\n\nKubernetes management with Nix\n\n\u003cp align=\"center\" style=\"margin: 2em auto;\"\u003e\n  \u003cimg src=\"./docs/static/logo.svg\" alt=\"nixos logo in kubernetes blue\" width=\"350\"/\u003e\n\u003c/p\u003e\n\n\u003e **WARN**: this is a work in progress, expect breaking [changes](./CHANGELOG.md)\n\n## Usage\n\nA minimal example `flake.nix` (build with `nix build`):\n\n```nix\n{\n  inputs.kubenix.url = \"github:hall/kubenix\";\n  outputs = {self, kubenix, ... }@inputs: let\n    system = \"x86_64-linux\";\n  in {\n    packages.${system}.default = (kubenix.evalModules.${system} {\n      module = { kubenix, ... }: {\n        imports = [ kubenix.modules.k8s ];\n        kubernetes.resources.pods.example.spec.containers.nginx.image = \"nginx\";\n      };\n    }).config.kubernetes.result;\n  };\n}\n```\n\nOr, if you're not using flakes, a `default.nix` file (build with `nix-build`):\n\n```nix\n{ kubenix ? import (builtins.fetchGit {\n  url = \"https://github.com/hall/kubenix.git\";\n  ref = \"main\";\n}) }:\n(kubenix.evalModules.x86_64-linux {\n  module = { kubenix, ... }: {\n    imports = [ kubenix.modules.k8s ];\n    kubernetes.resources.pods.example.spec.containers.nginx.image = \"nginx\";\n  };\n}).config.kubernetes.result\n```\n\nEither way the JSON manifests will be written to `./result`.\n\nSee the [examples](https://kubenix.org/examples/pod) for more.\n\n## CLI\n\nWhile kubenix is compatible with just about any deployment system, there's a simple builtin CLI which can:\n\n- show a diff, prompt for confirmation, then apply\n- prune removed resources\n- pipe manifests through [vals](https://github.com/helmfile/vals) for the ability to inject secrets without writing them to the nix store\n\nTo configure this, override the default package, passing the arguments of [evalModules](https://nixos.org/manual/nixpkgs/stable/#module-system-lib-evalModules).\n\n```nix\n{\n  kubenix = inputs.kubenix.packages.${pkgs.system}.default.override {\n    module = import ./cluster;\n    # optional; pass custom values to the kubenix module\n    specialArgs = { flake = self; };\n  };\n}\n```\n\nThen apply the resources with\n\n    nix run '.#kubenix'\n\nwhich will print a diff and prompt for confirmation:\n\n```diff\ndiff -N -u -I ' kubenix/hash: ' -I ' generation: ' /tmp/LIVE-2503962153/apps.v1.Deployment.default.home-assistant /tmp/MERGED-231044561/apps.v1.Deployment.default.home-assistant\n--- /tmp/LIVE-2503962153/apps.v1.Deployment.default.home-assistant      2023-07-06 23:33:29.841771295 -0400\n+++ /tmp/MERGED-231044561/apps.v1.Deployment.default.home-assistant     2023-07-06 23:33:29.842771296 -0400\n@@ -43,7 +43,7 @@\n     spec:\n       automountServiceAccountToken: true\n       containers:\n-      - image: homeassistant/home-assistant:2023.5\n+      - image: homeassistant/home-assistant:2023.6\n         imagePullPolicy: IfNotPresent\n         livenessProbe:\n           failureThreshold: 3\napply? [y/N]:\n```\n\n\u003e **HINT**: use ` --help` for more commands\n\nOptionally, write the resources to `./result/manifests.json`:\n\n    nix build '.#kubenix'\n\n## Attribution\n\nThis project was forked from [GTrunSec](https://github.com/GTrunSec/kubenix), which was forked from [xtruder](https://github.com/xtruder/kubenix), with commits incorporated from [blaggacao](https://github.com/blaggacao/kubenix).\n\nLogo is a mishmash of the [Kubernetes wheel](https://github.com/kubernetes/kubernetes/blob/master/logo/logo.svg) and the [NixOs snowflake](https://github.com/NixOS/nixos-artwork/blob/master/logo/white.svg).\n","funding_links":[],"categories":["Deployment Tools","Configuration Management"],"sub_categories":["Discovery"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhall%2Fkubenix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhall%2Fkubenix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhall%2Fkubenix/lists"}