Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Generators Reference

age

Generate an age private key.

Inputs:

  • pq - Whether to generate a post-quantum key (false by default).

Type: age :: { pq :: Bool; } -> Derivation

Examples:

generator = "age";
generator.age = {
  pq = true;
};

dkim

Generate a DKIM private key.

Short-hand for generator.ssh-rsa with format set to "PKCS8".

Inputs:

  • pq - Number of bits for the RSA key (2048 by default).

Type: dkim :: { bits :: (Int | Null); } -> AttrSet

Examples:

generator = "dkim";
generator.dkim = {
  bits = 4096;
};

ssh

Generate an SSH private key.

Inputs:

  • type - SSH key type ("ed25519" by default).
  • bits - Number of bits for the key (null by default).
  • comment - Comment to add to the public key (null by default).
  • format - Private key format (null by default).

Type: ssh :: { type :: String; bits :: (Int | Null); comment :: (String | Null); format :: (String | Null); } -> Derivation

Examples:

generator = "ssh";
generator.ssh = {
  type = "rsa";
  bits = 4096;
  comment = "user@host";
  format = "PEM";
};

ssh-ed25519

Generate an Ed25519 SSH private key.

Short-hand for generator.ssh with type set to "ed25519".

Inputs:

  • comment - Comment to add to the public key (null by default).
  • format - Private key format (null by default).

Type: ssh-ed25519 :: { comment :: (String | Null); format :: (String | Null); } -> AttrSet

Examples:

generator = "ssh-ed25519";
generator.ssh-ed25519 = {
  comment = "user@host";
  format = "PEM";
};

ssh-rsa

Generate an RSA SSH private key.

Short-hand for generator.ssh with type set to "rsa".

Inputs:

  • bits - Number of bits for the key (null by default).
  • comment - Comment to add to the public key (null by default).
  • format - Private key format (null by default).

Type: ssh-rsa :: { bits :: (Int | Null); comment :: (String | Null); format :: (String | Null); } -> AttrSet

Examples:

generator = "ssh-rsa";
generator.ssh-rsa = {
  bits = 4096;
  comment = "user@host";
  format = "PEM";
};

uuid

Generate random UUIDs.

Inputs:

  • count - Number of UUIDs to generate (1 by default).
  • raw - Whether to remove hyphens from generated UUIDs (false by default).

Type: uuid :: { count :: Int; raw :: Bool; } -> Derivation

Examples:

generator = "uuid";
generator.uuid = {
  count = 5;
  raw = true;
};