From eafa2f536f8574fbc0c9dd5dcf732a13a15f2461 Mon Sep 17 00:00:00 2001 From: Yiyu Zhou Date: Tue, 19 Aug 2025 08:10:37 -0700 Subject: [PATCH] doc: fix examples --- CONTRIBUTING.md | 4 ++-- doc/build-helpers/fetchers.chapter.md | 3 +-- doc/languages-frameworks/crystal.section.md | 4 ++-- doc/languages-frameworks/go.section.md | 2 +- doc/languages-frameworks/javascript.section.md | 2 +- doc/languages-frameworks/maven.section.md | 2 +- doc/languages-frameworks/nim.section.md | 4 ++-- doc/languages-frameworks/php.section.md | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7a59925f5b0..83d43122d91c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -659,13 +659,13 @@ If you have any problems with formatting, please ping the [formatting team](http Do ```nix - { rev = version; } + { tag = version; } ``` instead of ```nix - { rev = "${version}"; } + { tag = "${version}"; } ``` - Building lists conditionally _should_ be done with `lib.optional(s)` instead of using `if cond then [ ... ] else null` or `if cond then [ ... ] else [ ]`. diff --git a/doc/build-helpers/fetchers.chapter.md b/doc/build-helpers/fetchers.chapter.md index e5ec5f93888b..b7d8d8fb5123 100644 --- a/doc/build-helpers/fetchers.chapter.md +++ b/doc/build-helpers/fetchers.chapter.md @@ -763,7 +763,7 @@ Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `hash` ## `fetchgit` {#fetchgit} -Used with Git. Expects `url` to a Git repo, `rev`, and `hash`. `rev` in this case can be full the git commit id (SHA1 hash) or a tag name like `refs/tags/v1.0`. +Used with Git. Expects `url` to a Git repo, `rev` or `tag`, and `hash`. `rev` in this case can be full the git commit id (SHA1 hash), or use `tag` for a tag name like `refs/tags/v1.0`. If you want to fetch a tag you should pass the `tag` parameter instead of `rev` which has the same effect as setting `rev = "refs/tags"/${version}"`. This is safer than just setting `rev = version` w.r.t. possible branch and tag name conflicts. @@ -1003,4 +1003,3 @@ fetchtorrent { - `config`: When using `transmission` as the `backend`, a json configuration can be supplied to transmission. Refer to the [upstream documentation](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md) for information on how to configure. - diff --git a/doc/languages-frameworks/crystal.section.md b/doc/languages-frameworks/crystal.section.md index 5ea70319dd49..64c72385fb35 100644 --- a/doc/languages-frameworks/crystal.section.md +++ b/doc/languages-frameworks/crystal.section.md @@ -26,7 +26,7 @@ crystal.buildCrystalPackage rec { src = fetchFromGitHub { owner = "mint-lang"; repo = "mint"; - rev = version; + tag = version; hash = "sha256-dFN9l5fgrM/TtOPqlQvUYgixE4KPr629aBmkwdDoq28="; }; @@ -68,7 +68,7 @@ crystal.buildCrystalPackage rec { src = fetchFromGitHub { owner = "mint-lang"; repo = "mint"; - rev = version; + tag = version; hash = "sha256-dFN9l5fgrM/TtOPqlQvUYgixE4KPr629aBmkwdDoq28="; }; diff --git a/doc/languages-frameworks/go.section.md b/doc/languages-frameworks/go.section.md index 9b5d104469e3..77b6d67e83d5 100644 --- a/doc/languages-frameworks/go.section.md +++ b/doc/languages-frameworks/go.section.md @@ -84,7 +84,7 @@ nix-prefetch -E "{ sha256 }: ((import ./. { }).my-package.overrideAttrs { vendor version = "0.4.0"; src = fetchFromGitHub { inherit (previousAttrs.src) owner repo; - rev = "v${finalAttrs.version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-gVTpzmXekQxGMucDKskGi+e+34nJwwsXwvQTjRO6Gdg="; }; vendorHash = "sha256-dUvp7FEW09V0xMuhewPGw3TuAic/sD7xyXEYviZ2Ivs="; diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md index d19884154438..fd9ebd3465e0 100644 --- a/doc/languages-frameworks/javascript.section.md +++ b/doc/languages-frameworks/javascript.section.md @@ -626,7 +626,7 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "..."; repo = "..."; - rev = "v${finalAttrs.version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }; diff --git a/doc/languages-frameworks/maven.section.md b/doc/languages-frameworks/maven.section.md index 095eaba4e648..33579f70e41b 100644 --- a/doc/languages-frameworks/maven.section.md +++ b/doc/languages-frameworks/maven.section.md @@ -86,7 +86,7 @@ jd-cli.overrideMavenAttrs (old: rec { src = fetchFromGitHub { owner = old.src.owner; repo = old.src.repo; - rev = "${old.pname}-${version}"; + tag = "${old.pname}-${version}"; # old source hash of 1.2.0 version hash = "sha256-US7j6tQ6mh1libeHnQdFxPGoxHzbZHqehWSgCYynKx8="; }; diff --git a/doc/languages-frameworks/nim.section.md b/doc/languages-frameworks/nim.section.md index 465aa9cdf16c..49870b166154 100644 --- a/doc/languages-frameworks/nim.section.md +++ b/doc/languages-frameworks/nim.section.md @@ -20,7 +20,7 @@ buildNimPackage (finalAttrs: { src = fetchFromGitHub { owner = "inv2004"; repo = "ttop"; - rev = "v${finalAttrs.version}"; + tag = "v${finalAttrs.version}"; hash = lib.fakeHash; }; @@ -74,7 +74,7 @@ buildNimSbom (finalAttrs: { src = fetchFromSourcehut { owner = "~ehmry"; repo = "nim_lk"; - rev = finalAttrs.version; + tag = finalAttrs.version; hash = lib.fakeHash; }; buildInputs = [ openssl ]; diff --git a/doc/languages-frameworks/php.section.md b/doc/languages-frameworks/php.section.md index 988fa659f0aa..a78bbf724206 100644 --- a/doc/languages-frameworks/php.section.md +++ b/doc/languages-frameworks/php.section.md @@ -307,7 +307,7 @@ stdenvNoCC.mkDerivation ( src = fetchFromGitHub { owner = "git-owner"; repo = "git-repo"; - rev = finalAttrs.version; + tag = finalAttrs.version; hash = "sha256-VcQRSss2dssfkJ+iUb5qT+FJ10GHiFDzySigcmuVI+8="; }; in