{ lib, config, ... }: let cfg = config.apps; in { imports = []; options.apps = with lib; { env = mkOption { type = types.str; default = "prod"; description = "Enable"; }; autoSync = mkOption { type = types.bool; default = true; description = "Auto sync"; }; prune = mkOption { type = types.bool; default = false; description = "Prune"; }; selfHeal = mkOption { type = types.bool; default = false; description = "Self-heal"; }; serverSideDiff = mkOption { type = types.bool; default = true; description = "Enable server-side diffing"; }; }; config = { nixidy = { target = { repository = "https://gitlab.com/oveanbox/manifests.git"; branch = "main"; rootPath = "_manifests/${config.apps.env}"; }; resourceImports = [ ./cilium-crd.nix ./kyverno-crd.nix ]; chartsDir = ../charts; defaults = { syncPolicy = { autoSync = { enabled = cfg.autoSync; prune = cfg.prune; selfHeal = cfg.selfHeal; }; }; # Many helm chars will render all resources with the # following labels. # This produces huge diffs when the charts are updated # because the values of these labels change each release. # Here we add a transformer that strips them out after # templating the helm charts in each application. helm.transformer = map ( lib.kube.removeLabels [ "app.kubernetes.io/version" "helm.sh/chart" ] ); }; }; }; }