From 587f64a26459ffb7f2af0a7a0d454b4a6a76aec4 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Mon, 29 Jul 2024 11:28:26 -0700 Subject: [PATCH] nixpkgs-manual: use injected revision only `lib.trivial.revisionWithDefault` will change with every Git commit, which causes the manual to be rebuilt on every since PR. Using `nixpkgs.rev` (or the dummy value "master" if it's not present) means that the manual will contain the revision if built on Hydra, but will not otherwise. Why? 1. https://hydra.nixos.org/jobset/nixos/trunk-combined#tabs-configuration shows that `pkgs/top-level/release.nix` is passed the `nixpkgs` attrset, which is a "Git checkout". 2. Git checkouts come from [`builtins.fetchGit`](https://nix.dev/manual/nix/2.18/language/builtins#builtins-fetchGit) and include the `rev` attribute. 3. The `rev` attribute is what `lib.trivial.revisionWithDefault` would have returned. So, using `nixpkgs.rev or "master"` exclusively will cause the rebuilds on every commit to cease, but will allow "official" nixpkgs manual built on Hydra to continue to reference a specific commit. --- doc/doc-support/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc-support/package.nix b/doc/doc-support/package.nix index 602cef59677e..ca4694f3d11c 100644 --- a/doc/doc-support/package.nix +++ b/doc/doc-support/package.nix @@ -60,7 +60,7 @@ stdenvNoCC.mkDerivation ( nixos-render-docs manual html \ --manpage-urls ./manpage-urls.json \ - --revision ${lib.trivial.revisionWithDefault (nixpkgs.rev or "master")} \ + --revision ${nixpkgs.rev or "master"} \ --stylesheet style.css \ --stylesheet highlightjs/mono-blue.css \ --script ./highlightjs/highlight.pack.js \