|
| 1 | +"$schema": "http://json-schema.org/draft-04/schema" |
| 2 | +"$id": "https://nix.dev/manual/nix/latest/protocols/json/schema/derivation-options-v1.json" |
| 3 | +title: Derivation Options |
| 4 | +description: | |
| 5 | + JSON representation of Nix's `DerivationOptions` type. |
| 6 | +
|
| 7 | + This schema describes various build-time options and constraints that can be specified for a derivation. |
| 8 | +
|
| 9 | + > **Warning** |
| 10 | + > |
| 11 | + > This JSON format is currently |
| 12 | + > [**experimental**](@docroot@/development/experimental-features.md#xp-feature-nix-command) |
| 13 | + > and subject to change. |
| 14 | +
|
| 15 | +type: object |
| 16 | +required: |
| 17 | + - outputChecks |
| 18 | + - unsafeDiscardReferences |
| 19 | + - passAsFile |
| 20 | + - exportReferencesGraph |
| 21 | + - additionalSandboxProfile |
| 22 | + - noChroot |
| 23 | + - impureHostDeps |
| 24 | + - impureEnvVars |
| 25 | + - allowLocalNetworking |
| 26 | + - requiredSystemFeatures |
| 27 | + - preferLocalBuild |
| 28 | + - allowSubstitutes |
| 29 | +properties: |
| 30 | + outputChecks: |
| 31 | + type: object |
| 32 | + title: Output Check |
| 33 | + description: | |
| 34 | + Constraints on what the derivation's outputs can and cannot reference. |
| 35 | + Can either apply to all outputs or be specified per output. |
| 36 | + oneOf: |
| 37 | + - title: Output Checks For All Outputs |
| 38 | + description: | |
| 39 | + Output checks that apply to all outputs of the derivation. |
| 40 | + required: |
| 41 | + - forAllOutputs |
| 42 | + properties: |
| 43 | + forAllOutputs: |
| 44 | + "$ref": "#/$defs/outputCheckSpec" |
| 45 | + additionalProperties: false |
| 46 | + |
| 47 | + - title: Output Checks Per Output |
| 48 | + description: | |
| 49 | + Output checks specified individually for each output. |
| 50 | + required: |
| 51 | + - perOutput |
| 52 | + properties: |
| 53 | + perOutput: |
| 54 | + type: object |
| 55 | + additionalProperties: |
| 56 | + "$ref": "#/$defs/outputCheckSpec" |
| 57 | + additionalProperties: false |
| 58 | + |
| 59 | + unsafeDiscardReferences: |
| 60 | + type: object |
| 61 | + title: Unsafe Discard References |
| 62 | + description: | |
| 63 | + A map specifying which references should be unsafely discarded from each output. |
| 64 | + This is generally not recommended and requires special permissions. |
| 65 | + additionalProperties: |
| 66 | + type: array |
| 67 | + items: |
| 68 | + type: string |
| 69 | + |
| 70 | + passAsFile: |
| 71 | + type: array |
| 72 | + title: Pass As File |
| 73 | + description: | |
| 74 | + List of environment variable names whose values should be passed as files rather than directly. |
| 75 | + items: |
| 76 | + type: string |
| 77 | + |
| 78 | + exportReferencesGraph: |
| 79 | + type: object |
| 80 | + title: Export References Graph |
| 81 | + description: | |
| 82 | + Specify paths whose references graph should be exported to files. |
| 83 | + additionalProperties: |
| 84 | + type: array |
| 85 | + items: |
| 86 | + "$ref": "deriving-path-v1.yaml" |
| 87 | + |
| 88 | + additionalSandboxProfile: |
| 89 | + type: string |
| 90 | + title: Additional Sandbox Profile |
| 91 | + description: | |
| 92 | + Additional sandbox profile directives (macOS specific). |
| 93 | +
|
| 94 | + noChroot: |
| 95 | + type: boolean |
| 96 | + title: No Chroot |
| 97 | + description: | |
| 98 | + Whether to disable the build sandbox, if allowed. |
| 99 | +
|
| 100 | + impureHostDeps: |
| 101 | + type: array |
| 102 | + title: Impure Host Dependencies |
| 103 | + description: | |
| 104 | + List of host paths that the build can access. |
| 105 | + items: |
| 106 | + type: string |
| 107 | + |
| 108 | + impureEnvVars: |
| 109 | + type: array |
| 110 | + title: Impure Environment Variables |
| 111 | + description: | |
| 112 | + List of environment variable names that should be passed through to the build from the calling environment. |
| 113 | + items: |
| 114 | + type: string |
| 115 | + |
| 116 | + allowLocalNetworking: |
| 117 | + type: boolean |
| 118 | + title: Allow Local Networking |
| 119 | + description: | |
| 120 | + Whether the build should have access to local network (macOS specific). |
| 121 | +
|
| 122 | + requiredSystemFeatures: |
| 123 | + type: array |
| 124 | + title: Required System Features |
| 125 | + description: | |
| 126 | + List of system features required to build this derivation (e.g., "kvm", "nixos-test"). |
| 127 | + items: |
| 128 | + type: string |
| 129 | + |
| 130 | + preferLocalBuild: |
| 131 | + type: boolean |
| 132 | + title: Prefer Local Build |
| 133 | + description: | |
| 134 | + Whether this derivation should preferably be built locally rather than its outputs substituted. |
| 135 | +
|
| 136 | + allowSubstitutes: |
| 137 | + type: boolean |
| 138 | + title: Allow Substitutes |
| 139 | + description: | |
| 140 | + Whether substituting from other stores should be allowed for this derivation's outputs. |
| 141 | +
|
| 142 | +additionalProperties: false |
| 143 | + |
| 144 | +$defs: |
| 145 | + |
| 146 | + outputCheckSpec: |
| 147 | + type: object |
| 148 | + title: Output Check Specification |
| 149 | + description: | |
| 150 | + Constraints on what a specific output can reference. |
| 151 | + required: |
| 152 | + - ignoreSelfRefs |
| 153 | + - maxSize |
| 154 | + - maxClosureSize |
| 155 | + - allowedReferences |
| 156 | + - allowedRequisites |
| 157 | + - disallowedReferences |
| 158 | + - disallowedRequisites |
| 159 | + properties: |
| 160 | + ignoreSelfRefs: |
| 161 | + type: boolean |
| 162 | + title: Ignore Self References |
| 163 | + description: | |
| 164 | + Whether references from this output to itself should be ignored when checking references. |
| 165 | +
|
| 166 | + maxSize: |
| 167 | + type: ["integer", "null"] |
| 168 | + title: Maximum Size |
| 169 | + description: | |
| 170 | + Maximum allowed size of this output in bytes, or null for no limit. |
| 171 | + minimum: 0 |
| 172 | + |
| 173 | + maxClosureSize: |
| 174 | + type: ["integer", "null"] |
| 175 | + title: Maximum Closure Size |
| 176 | + description: | |
| 177 | + Maximum allowed size of this output's closure in bytes, or null for no limit. |
| 178 | + minimum: 0 |
| 179 | + |
| 180 | + allowedReferences: |
| 181 | + oneOf: |
| 182 | + - type: array |
| 183 | + items: |
| 184 | + "$ref": "#/$defs/drvRef" |
| 185 | + - type: "null" |
| 186 | + title: Allowed References |
| 187 | + description: | |
| 188 | + If set, the output can only reference paths in this list. |
| 189 | + If null, no restrictions apply. |
| 190 | +
|
| 191 | + allowedRequisites: |
| 192 | + oneOf: |
| 193 | + - type: array |
| 194 | + items: |
| 195 | + "$ref": "#/$defs/drvRef" |
| 196 | + - type: "null" |
| 197 | + title: Allowed Requisites |
| 198 | + description: | |
| 199 | + If set, the output's closure can only contain paths in this list. |
| 200 | + If null, no restrictions apply. |
| 201 | +
|
| 202 | + disallowedReferences: |
| 203 | + type: array |
| 204 | + title: Disallowed References |
| 205 | + description: | |
| 206 | + The output must not reference any paths in this list. |
| 207 | + items: |
| 208 | + "$ref": "#/$defs/drvRef" |
| 209 | + |
| 210 | + disallowedRequisites: |
| 211 | + type: array |
| 212 | + title: Disallowed Requisites |
| 213 | + description: | |
| 214 | + The output's closure must not contain any paths in this list. |
| 215 | + items: |
| 216 | + "$ref": "#/$defs/drvRef" |
| 217 | + additionalProperties: false |
| 218 | + |
| 219 | + drvRef: |
| 220 | + # TODO fix bug in checker, should be `oneOf` |
| 221 | + anyOf: |
| 222 | + - type: object |
| 223 | + title: Current derivation Output Reference |
| 224 | + description: | |
| 225 | + A reference to a specific output of the current derivation. |
| 226 | + required: |
| 227 | + - drvPath |
| 228 | + - output |
| 229 | + properties: |
| 230 | + drvPath: |
| 231 | + type: string |
| 232 | + const: "self" |
| 233 | + title: This derivation |
| 234 | + description: | |
| 235 | + Won't be confused for a deriving path |
| 236 | + output: |
| 237 | + type: string |
| 238 | + title: Output Name |
| 239 | + description: | |
| 240 | + The name of the output being referenced. |
| 241 | + additionalProperties: false |
| 242 | + - "$ref": "deriving-path-v1.yaml" |
0 commit comments