Home

gen @main - refs - log -
-
https://git.jolheiser.com/gen.git
Generate Go flags and Nix module
gen / testdata / kitchen.nix.golden
- raw -
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
# Code generated by gen from kitchen.cue; DO NOT EDIT.
{ lib, extra, kitchen }:
let
  inherit (lib) mkOption types;
in
{
  name = mkOption {
    type = types.str;
    description = "Service name, shown in logs.\n\nA second paragraph only goes into the Nix description.";
  };

  workers = mkOption {
    type = types.ints.between 1 64;
    default = 4;
    description = "Worker count.";
  };

  retries = mkOption {
    type = types.addCheck types.int (x: x >= -1);
    default = 3;
    description = "Retries; negative means forever.";
  };

  ratio = mkOption {
    type = types.addCheck types.float (x: x > 0 && x <= 1);
    default = 0.5;
    description = "Sampling ratio.";
  };

  scale = mkOption {
    type = types.number;
    default = 1;
    description = "Any number.";
  };

  timeout = mkOption {
    type = types.str;
    default = "30s";
    description = "Request timeout.";
  };

  backoff = mkOption {
    type = types.listOf types.str;
    default = [ "1s" "5s" ];
    description = "Backoff steps.";
  };

  priority = mkOption {
    type = types.enum [ 1 2 3 ];
    default = 2;
    description = "Priority.";
  };

  level = mkOption {
    type = types.enum [ "low" "mid" "high" ];
    default = "low";
  };

  tags = mkOption {
    type = types.listOf (types.strMatching "[a-z]+");
    default = [ ];
    description = "Tags to attach.";
  };

  probes = mkOption {
    type = types.listOf (types.ints.between 1 65535);
    default = [ 80 443 ];
    description = "Ports to probe.";
  };

  webhook = mkOption {
    type = types.nullOr (types.strMatching "https://.*");
    default = null;
    description = "Optional webhook.";
  };

  id = mkOption {
    # "^\\d+$" can't be expressed as a POSIX regex; checked by the application only.
    type = types.str;
    default = "1";
    description = "Uses an RE2-only pattern.";
  };

  owner = mkOption {
    type = types.nullOr kitchen.owner;
    default = null;
    apply = lib.mapNullable kitchen.ownerString;
    description = "Optional, with a field-level Nix type and apply.";
  };

  "with" = {
    "if" = mkOption {
      type = types.bool;
      description = "A Nix keyword as a key, and an `if` below it.";
    };
    "has space" = mkOption {
      type = types.str;
      default = "x";
      description = "A key that needs quoting in Nix.";
    };
  };

  db = {
    url = mkOption {
      type = types.str;
      default = "postgres:///app";
      description = "Database URL.";
    };
  };
}