From 8558cf781a17bd17ae93f3c5b5e49e0c7dfa7d5a Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Wed, 19 Nov 2025 23:43:01 +0100 Subject: [PATCH] libexpr/builtins: Document derivationStrict Co-authored-by: eldritch horrors Co-authored-by: Qyriad Change-Id: I4cf95683da54efe830514f3a6795057cadd223c6 --- lix/libexpr/builtins/derivationStrict.md | 22 ++++++++++++++++++++++ lix/libexpr/meson.build | 1 + lix/libexpr/primops.cc | 6 ------ 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 lix/libexpr/builtins/derivationStrict.md diff --git a/lix/libexpr/builtins/derivationStrict.md b/lix/libexpr/builtins/derivationStrict.md new file mode 100644 index 000000000..2260f0684 --- /dev/null +++ b/lix/libexpr/builtins/derivationStrict.md @@ -0,0 +1,22 @@ +--- +name: derivationStrict +args: [args] +renameInGlobalScope: false +--- + +Constructs a [store derivation](../glossary.md#gloss-store-derivation) from the attribute set `args` +(c.f. [derivation](#builtins-derivation). Unlike `derivation` the produced store derivation is placed +in the store *immediately* when this builtin is called, while `derivation` may defer placing store +derivations in the store until it is proven that they are used. + +It then returns a new attrset with *only* the following attributes: + +- `drvPath` containing the path of the store derivation; +- For each output of the derivation (`out`, `dev`, etc): an attribute named after that output containing the output path + +> **Note** +> +> In contrast to [`builtins.derivation`](#builtins-derivation), this computes +> the derivation set in a fully *strict* manner, i.e. the values of the attributes +> directly computed, whereas using `builtins.derivation` will produce an attrset +> whose values will be evaluated when they are used at a later point. diff --git a/lix/libexpr/meson.build b/lix/libexpr/meson.build index 13a8e5950..e1a51e940 100644 --- a/lix/libexpr/meson.build +++ b/lix/libexpr/meson.build @@ -68,6 +68,7 @@ builtin_definitions = files( 'builtins/concatMap.md', 'builtins/concatStringsSep.md', 'builtins/deepSeq.md', + 'builtins/derivationStrict.md', 'builtins/dirOf.md', 'builtins/div.md', 'builtins/elem.md', diff --git a/lix/libexpr/primops.cc b/lix/libexpr/primops.cc index 7340c2347..f4f15fdab 100644 --- a/lix/libexpr/primops.cc +++ b/lix/libexpr/primops.cc @@ -1227,12 +1227,6 @@ drvName, Bindings * attrs, Value & v) v.mkAttrs(result); } -static RegisterPrimOp primop_derivationStrict(PrimOp{{ - .name = "derivationStrict", - .arity = 1, - .fun = prim_derivationStrict, -}}); - /* Return a placeholder string for the specified output that will be substituted by the corresponding output path at build time. For example, 'placeholder "out"' returns the string