From 910211f9ffba41f5fa269217192638773a0bf30c Mon Sep 17 00:00:00 2001 From: stuebinm Date: Fri, 5 Apr 2024 23:19:32 +0200 Subject: [PATCH] avoid markdown which the repl's :doc cannot handle code blocks, if not surrounded by empty lines, have the language tags (in these cases, always `nix`) show up in the output of :doc. for example: nix-repl> :doc builtins.parseFlakeRef Synopsis: builtins.parseFlakeRef flake-ref Parse a flake reference, and return its exploded form. For example: nix builtins.parseFlakeRef "github:NixOS/nixpkgs/23.05?dir=lib" evaluates to: nix { dir = "lib"; owner = "NixOS"; ref = "23.05"; repo = "nixpkgs"; type = "github"; } is now instead: nix-repl> :doc builtins.parseFlakeRef Synopsis: builtins.parseFlakeRef flake-ref Parse a flake reference, and return its exploded form. For example: | builtins.parseFlakeRef "github:NixOS/nixpkgs/23.05?dir=lib" evaluates to: | { dir = "lib"; owner = "NixOS"; ref = "23.05"; repo = "nixpkgs"; type = "github"; } --- src/libexpr/flake/flake.cc | 6 ++++++ src/libexpr/primops.cc | 2 ++ src/libexpr/primops/fetchTree.cc | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 4a781beb8..8fe3a1d74 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -868,10 +868,13 @@ static RegisterPrimOp r3({ Parse a flake reference, and return its exploded form. For example: + ```nix builtins.parseFlakeRef "github:NixOS/nixpkgs/23.05?dir=lib" ``` + evaluates to: + ```nix { dir = "lib"; owner = "NixOS"; ref = "23.05"; repo = "nixpkgs"; type = "github"; } ``` @@ -920,12 +923,15 @@ static RegisterPrimOp r4({ Convert a flake reference from attribute set format to URL format. For example: + ```nix builtins.flakeRefToString { dir = "lib"; owner = "NixOS"; ref = "23.05"; repo = "nixpkgs"; type = "github"; } ``` + evaluates to + ```nix "github:NixOS/nixpkgs/23.05?dir=lib" ``` diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 8e79f4953..8a2b3512b 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1915,11 +1915,13 @@ static RegisterPrimOp primop_outputOf({ *`derivation reference`* must be a string that may contain a regular store path to a derivation, or may be a placeholder reference. If the derivation is produced by a derivation, you must explicitly select `drv.outPath`. This primop can be chained arbitrarily deeply. For instance, + ```nix builtins.outputOf (builtins.outputOf myDrv "out") "out" ``` + will return a placeholder for the output of the output of `myDrv`. This primop corresponds to the `^` sigil for derivable paths, e.g. as part of installable syntax on the command line. diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 5061e40fd..7906f8ac3 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -650,12 +650,14 @@ static RegisterPrimOp primop_fetchGit({ The public keys against which `rev` is verified if `verifyCommit` is enabled. Must be given as a list of attribute sets with the following form: + ```nix { key = ""; type = ""; # optional, default: "ssh-ed25519" } ``` + Requires the [`verified-fetches` experimental feature](@docroot@/contributing/experimental-features.md#xp-feature-verified-fetches).