diff options
author | Valentin Gagarin <valentin.gagarin@tweag.io> | 2023-05-31 03:15:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 03:15:54 +0200 |
commit | 738c0d506452cd51037ed4d37b3d0b665f828987 (patch) | |
tree | 080818ce209ee73412ab29eed91f9d016bef0ee1 /doc/manual/src | |
parent | 52004696c080db6640af9a4e0d1e6f56d094cd2b (diff) | |
parent | 6a5a8f51bb9773ab4aeac8f508872bcf5ec6fda2 (diff) |
Merge pull request #8318 from fricklerhandwerk/doc-currentTime
document `builtins.currentTime`
Diffstat (limited to 'doc/manual/src')
-rw-r--r-- | doc/manual/src/language/builtin-constants.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/manual/src/language/builtin-constants.md b/doc/manual/src/language/builtin-constants.md index c6bc9b74c..e6bc7e915 100644 --- a/doc/manual/src/language/builtin-constants.md +++ b/doc/manual/src/language/builtin-constants.md @@ -17,3 +17,27 @@ These constants are built into the Nix language evaluator: The built-in value `currentSystem` evaluates to the Nix platform identifier for the Nix installation on which the expression is being evaluated, such as `"i686-linux"` or `"x86_64-darwin"`. + + Not available in [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval). + +- [`builtins.currentTime`]{#builtins-currentTime} (integer) + + Return the [Unix time](https://en.wikipedia.org/wiki/Unix_time) at first evaluation. + Repeated references to that name will re-use the initially obtained value. + + Example: + + ```console + $ nix repl + Welcome to Nix 2.15.1 Type :? for help. + + nix-repl> builtins.currentTime + 1683705525 + + nix-repl> builtins.currentTime + 1683705525 + ``` + + The [store path](@docroot@/glossary.md#gloss-store-path) of a derivation depending on `currentTime` will differ for each evaluation. + + Not available in [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval). |