doc: fix example (#435473)

This commit is contained in:
Gergő Gutyina
2025-12-07 11:46:03 +00:00
committed by GitHub
8 changed files with 11 additions and 12 deletions

View File

@@ -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 [ ]`.

View File

@@ -765,7 +765,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.
@@ -1005,4 +1005,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.

View File

@@ -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=";
};

View File

@@ -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=";

View File

@@ -539,7 +539,7 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub {
owner = "...";
repo = "...";
rev = "v${finalAttrs.version}";
tag = "v${finalAttrs.version}";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};

View File

@@ -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=";
};

View File

@@ -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 ];

View File

@@ -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