add flake demo

This commit is contained in:
lillecarl 2026-02-16 20:56:51 +00:00
commit 5387a1a4c5
3 changed files with 110 additions and 1 deletions

40
demo/flake.lock generated Normal file
View file

@ -0,0 +1,40 @@
{
"nodes": {
"easykubenix": {
"locked": {
"lastModified": 0,
"narHash": "sha256-ZtLBBABdyRw7QFEK1nOJlwc6PS2Rh5K3sLzgYcKAUi8=",
"path": "../",
"type": "path"
},
"original": {
"path": "../",
"type": "path"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1771008912,
"narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a82ccc39b39b621151d6732718e3e250109076fa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"easykubenix": "easykubenix",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

69
demo/flake.nix Normal file
View file

@ -0,0 +1,69 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
easykubenix.url = "path:../";
};
outputs =
inputs:
let
eachSys =
func:
inputs.nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] func;
in
{
packages = eachSys (
system:
let
pkgs = import inputs.nixpkgs { inherit system; };
inherit (pkgs) lib;
hello-bash = pkgs.writeShellApplication {
name = "hello-bash";
text = "echo Hello, world!";
};
eknEval = inputs.easykubenix.lib.easykubenix {
inherit pkgs;
modules = [
{
kubernetes.objects.namespace.ConfigMap.name = {
data = "I am a configMap";
};
kubernetes.objects.namespace.Pod.hello = {
spec.containers = [
{
name = "hello";
image = "gcr.io/distroless/static:latest";
command = lib.getExe hello-bash;
volumeMounts = [
{
name = "nix-store";
mountPath = "/nix";
subPath = "nix";
}
];
}
];
spec.volumes = [
{
name = "nix-store";
csi = {
driver = "nix.csi.store";
readOnly = true;
};
}
];
};
}
];
};
in
{
inherit (eknEval) manifestYAMLFile;
}
);
};
}

View file

@ -1,5 +1,5 @@
{
outputs = {
outputs = _: {
lib.easykubenix = import ./default.nix;
};
}