{ config, lib, pkgs, ... }: { options.clan.core.facts = { secretStore = lib.mkOption { type = lib.types.enum [ "sops" "password-store" "vm" "custom" ]; default = "sops"; description = '' method to store secret facts custom can be used to define a custom secret fact store. ''; }; secretModule = lib.mkOption { type = lib.types.str; internal = true; description = '' the python import path to the secret module ''; }; secretUploadDirectory = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; description = '' The directory where secrets are uploaded into, This is backend specific. ''; }; secretPathFunction = lib.mkOption { type = lib.types.raw; description = '' The function to use to generate the path for a secret. The default function will use the path attribute of the secret. The function will be called with the secret submodule as an argument. ''; }; publicStore = lib.mkOption { type = lib.types.enum [ "in_repo" "vm" "custom" ]; default = "in_repo"; description = '' method to store public facts. custom can be used to define a custom public fact store. ''; }; publicModule = lib.mkOption { type = lib.types.str; internal = true; description = '' the python import path to the public module ''; }; publicDirectory = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; }; services = lib.mkOption { default = { }; type = lib.types.attrsOf ( lib.types.submodule (service: { options = { name = lib.mkOption { type = lib.types.str; default = service.config._module.args.name; description = '' Namespace of the service ''; }; generator = lib.mkOption { type = lib.types.submodule ( { config, ... }: { options = { path = lib.mkOption { type = lib.types.listOf (lib.types.either lib.types.path lib.types.package); default = [ ]; description = '' Extra paths to add to the PATH environment variable when running the generator. ''; }; prompt = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = '' prompt text to ask for a value. This value will be passed to the script as the environment variable $prompt_value. ''; }; script = lib.mkOption { type = lib.types.str; description = '' Shell script snippet to generate the secrets and facts. The script has access to the following environment variables: - facts: path to a directory where facts can be stored - secrets: path to a directory where secrets can be stored The script is expected to generate all secrets and facts defined for this service. ''; }; finalScript = lib.mkOption { type = lib.types.str; readOnly = true; internal = true; defaultText = "read only script"; default = '' set -eu -o pipefail export PATH="${lib.makeBinPath config.path}:${pkgs.coreutils}/bin" # prepare sandbox user mkdir -p /etc cat > /etc/group < /etc/passwd < /etc/hosts <