Skip to content

Configuration Options#

applications#

An application is a single Argo CD application that will be rendered by nixidy.

The resources will be rendered into it's own directory and an Argo CD application created for it.

Type: attribute set of (submodule)

Default: { }

Example:

{
  nginx = {
    namespace = "nginx";
    resources = {
      deployments = {
        nginx = {
          spec = {
            replicas = 3;
            selector = {
              matchLabels = {
                app = "nginx";
              };
            };
            template = {
              metadata = {
                labels = {
                  app = "nginx";
                };
              };
              spec = {
                containers = {
                  nginx = {
                    image = "nginx:1.25.1";
                    imagePullPolicy = "IfNotPresent";
                  };
                };
                securityContext = {
                  fsGroup = 1000;
                };
              };
            };
          };
        };
      };
      services = {
        nginx = {
          spec = {
            ports = {
              http = {
                port = 80;
              };
            };
            selector = {
              app = "nginx";
            };
          };
        };
      };
    };
  };
}

Declared by:

applications.<name>.createNamespace#

Whether or not a namespace resource should be automatically created.

Type: boolean

Default: false

Declared by:

applications.<name>.helm.releases#

Helm releases to template and add to the rendered application's resources.

Type: attribute set of (submodule)

Default: { }

Declared by:

applications.<name>.helm.releases.<name>.chart#

Derivation containing the helm chart for the release.

Type: package

Declared by:

applications.<name>.helm.releases.<name>.includeCRDs#

Whether or not to include CRDs in the helm release.

Type: boolean

Default: true

Declared by:

applications.<name>.helm.releases.<name>.name#

Name of the helm release.

Type: string

Default: "‹name›"

Declared by:

applications.<name>.helm.releases.<name>.namespace#

Namespace for the release.

Type: string

Default: config.applications.<name>.namespace

Declared by:

applications.<name>.helm.releases.<name>.transformer#

Function that will be applied to the list of rendered manifests after the helm templating.

Type: function that evaluates to a(n) list of attribute set of anything

Default: config.nixidy.defaults.helm.transformer

Example: map (lib.kube.removeLabels ["helm.sh/chart"])

Declared by:

applications.<name>.helm.releases.<name>.values#

Values to pass to the helm chart when rendering it.

Type: attribute set of anything

Default: { }

Declared by:

applications.<name>.kustomize.applications#

Kustomize applications to render and add to the rendered application's resources.

Type: attribute set of (submodule)

Default: { }

Example:

{
  argocd = {
    namespace = "argocd";
    # Equivalent to `github.com/argoproj/argo-cd/manifests/cluster-install?ref=v2.9.3`
    # in kustomization.yaml.
    kustomization = {
      src = pkgs.fetchFromGitHub {
        owner = "argoproj";
        repo = "argo-cd";
        rev = "v2.9.3";
        hash = "sha256-GaY4Cw/LlSwy35umbB4epXt6ev8ya19UjHRwhDwilqU=";
      };
      path = "manifests/cluster-install";
    };
  };
};

Declared by:

applications.<name>.kustomize.applications.<name>.kustomization.path#

Path relative to the base of src to the entrypoint kustomization directory.

Type: string

Declared by:

applications.<name>.kustomize.applications.<name>.kustomization.src#

Derivation containing all the kustomize bases and overlays.

Type: package

Declared by:

applications.<name>.kustomize.applications.<name>.name#

Name of the kustomize application.

Type: string

Default: "‹name›"

Declared by:

applications.<name>.kustomize.applications.<name>.namespace#

Namespace for the kustomize application.

Type: string

Default: config.applications.<name>.namespace

Declared by:

applications.<name>.kustomize.applications.<name>.transformer#

Function that will be applied to the list of rendered manifests from kustomize.

Type: function that evaluates to a(n) list of attribute set of anything

Default: config.nixidy.defaults.kustomize.transformer

Declared by:

applications.<name>.name#

Name of the application.

Type: string

Default: "‹name›"

Declared by:

applications.<name>.namespace#

Namespace to deploy application into (defaults to name).

Type: string

Default: "‹name›"

Declared by:

applications.<name>.output.path#

Name of the folder that contains all rendered resources for the application. Relative to the root of the repository.

Type: string

Default: "‹name›"

Declared by:

applications.<name>.project#

ArgoCD project to make application a part of.

Type: string

Default: "default"

Declared by:

applications.<name>.resources#

Resources for the application

Type: attribute set

Default: { }

Example:

{
  deployments = {
    nginx = {
      spec = {
        replicas = 3;
        selector = {
          matchLabels = {
            app = "nginx";
          };
        };
        template = {
          metadata = {
            labels = {
              app = "nginx";
            };
          };
          spec = {
            containers = {
              nginx = {
                image = "nginx:1.25.1";
                imagePullPolicy = "IfNotPresent";
              };
            };
            securityContext = {
              fsGroup = 1000;
            };
          };
        };
      };
    };
  };
  services = {
    nginx = {
      spec = {
        ports = {
          http = {
            port = 80;
          };
        };
        selector = {
          app = "nginx";
        };
      };
    };
  };
}

Declared by:

applications.<name>.syncPolicy.automated.prune#

Specifies if resources should be pruned during auto-syncing.

Type: boolean

Default: config.nixidy.defaults.syncPolicy.automated.prune

Declared by:

applications.<name>.syncPolicy.automated.selfHeal#

Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected.

Type: boolean

Default: config.nixidy.defaults.syncPolicy.automated.selfHeal

Declared by:

applications.<name>.yamls#

List of Kubernetes manifests declared in YAML strings. They will be parsed and added to the application's resources where they can be overwritten and modified.

Can be useful for reading existing YAML files (i.e. [(builtins.readFile ./deployment.yaml)]).

Type: list of string

Default: [ ]

Example:

[
  ''
    apiVersion: v1
    kind: Namespace
    metadata:
      name: default
  ''
]

Declared by:

nixidy.appOfApps.name#

Name of the application for bootstrapping all other applications (app of apps pattern).

Type: string

Default: "apps"

Declared by:

nixidy.appOfApps.namespace#

Destination namespace for generated Argo CD Applications in the app of apps applications.

Type: string

Default: "argocd"

Declared by:

nixidy.charts#

Attrset of derivations containing helm charts. This will be passed as charts to every module.

Type: attribute set of anything

Default: { }

Declared by:

nixidy.chartsDir#

Path to a directory containing sub-directory structure that can be used to build a charts attrset. This will be passed as charts to every module.

Type: null or path

Default: null

Declared by:

nixidy.defaults.helm.transformer#

Function that will be applied to the list of rendered manifests after the helm templating. This option applies to all helm releases in all applications unless explicitly specified there.

Type: function that evaluates to a(n) list of attribute set of anything

Default: res: res

Example: map (lib.kube.removeLabels ["helm.sh/chart"])

Declared by:

nixidy.defaults.kustomize.transformer#

Function that will be applied to the list of rendered manifests after kustomize rendering. This option applies to all kustomize applications in all nixidy applications unless explicitly specified there.

Type: function that evaluates to a(n) list of attribute set of anything

Default: res: res

Example: map (lib.kube.removeLabels ["app.kubernetes.io/version"])

Declared by:

nixidy.defaults.syncPolicy.automated.prune#

Specifies if resources should be pruned during auto-syncing. This is the default value for all applications if not explicitly set.

Type: boolean

Default: false

Declared by:

nixidy.defaults.syncPolicy.automated.selfHeal#

Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected. This is the default value for all applications if not explicitly set.

Type: boolean

Default: false

Declared by:

nixidy.extraFiles#

Extra files to write in the generated stage.

Type: attribute set of (submodule)

Default: { }

Declared by:

nixidy.extraFiles.<name>.path#

Path of output file.

Type: string

Default: "‹name›"

Declared by:

nixidy.extraFiles.<name>.text#

Text of the output file.

Type: strings concatenated with "\n"

Declared by:

nixidy.resourceImports#

List of modules to import for resource defintion options.

Type: list of (package or path or function that evaluates to a(n) (attribute set))

Default: [ ]

Declared by:

nixidy.target.branch#

The destination branch of the generated applications.

Type: string

Declared by:

nixidy.target.repository#

The repository URL to put in all generated applications.

Type: string

Declared by:

nixidy.target.rootPath#

The root path of all generated applications in the repository.

Type: string

Default: "./"

Declared by: