easykubenix/internal.nix
Carl Andersson 3103a2ad4c Initial commit
2025-10-13 16:25:19 +02:00

27 lines
661 B
Nix

{
config,
pkgs,
lib,
...
}:
{
options.internal = lib.mkOption {
type = lib.types.anything;
};
config.internal = rec {
manifestAttrs = {
apiVersion = "v1";
kind = "List";
items = config.kubernetes.generated;
};
manifestJSON = builtins.toJSON manifestAttrs;
manifestJSONFile = pkgs.writeText "manifest.json" manifestJSON;
# Beware that YAML rendering requires IFD
manifestYAML = builtins.readFile manifestYAMLFile;
manifestYAMLFile =
pkgs.runCommandNoCCLocal "manifest.yaml" { } # bash
''
${lib.getExe pkgs.yq} --yaml-output '.' ${manifestJSONFile} > $out
'';
};
}