Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixpkgs-manual: use injected revision only #330915

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

philiptaron
Copy link
Contributor

@philiptaron philiptaron commented Jul 29, 2024

Motivation for change

nixpkgs-manual is listed as a rebuild on every single PR since I introduced it to the top-level packages in #311459.

Description of change

The existing derivation used lib.trivial.revisionWithDefault in its build phase. Due to that, the derivation will change with every Git commit, which then causes the manual to be rebuilt on every single PR or commit.

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

The line this PR replaces was introduced in be4d19f by @pennae (#239636).

--revision ${pkgs.lib.trivial.revisionWithDefault (pkgs.rev or "master")} \

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested the look and feel of the Nixpkgs manual.
  • Made another commit and saw zero rebuilds.
  • Fits CONTRIBUTING.md.

`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.
@philiptaron philiptaron mentioned this pull request Jul 29, 2024
21 tasks
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Jul 29, 2024
@infinisil infinisil merged commit 18951e7 into NixOS:master Jul 30, 2024
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants