Skip to content

Comments

Minor Nixpkgs doc improvements#319875

Merged
fricklerhandwerk merged 3 commits intoNixOS:masterfrom
tweag:doc-improvements
Jun 15, 2024
Merged

Minor Nixpkgs doc improvements#319875
fricklerhandwerk merged 3 commits intoNixOS:masterfrom
tweag:doc-improvements

Conversation

@infinisil
Copy link
Member

Description of changes

Things done

  • Built the manual successfully using nix-build doc
  • Checked that changing the Nix files doesn't cause a rebuild

Add a 👍 reaction to pull requests you find important.

Nix eval isn't made to patch stuff, it's more flexible to do it at build
time
All its files were removed years ago!
Especially when only Nix files are changed
@infinisil infinisil requested review from a team, DMills27 and philiptaron June 14, 2024 18:38
@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label Jun 14, 2024
Copy link
Member

@djacu djacu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3 filesets

Comment on lines 4 to +5
inherit (lib) hasPrefix removePrefix;
fs = lib.fileset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infinisil, I've seen this fs = lib.fileset idiom a couple times in your patches now -- interested in why you're doing it. fs.unions, fs.fileFilter don't look like better names to me than fileset.unions or fileset.fileFilter. I'm not strongly opposed or have something else to suggest, just that the choice doesn't yet make me go "heck yes."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fair, I think it's just smaller and I'm kind of used to it by now. It's like a qualified import (use foo::bar as fb in Rust, or import qualified Foo.Bar as FB in Haskell)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say let's keep it this way though, it's not a problem (unlike the with pattern!)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. Side note: I'm a filesystems engineer by trade, and so fs always means file system to me ;-)

Comment on lines +103 to +114
src = fs.toSource {
root = ./.;
fileset = fs.unions [
(fs.fileFilter (file:
file.hasExt "md"
|| file.hasExt "md.in"
) ./.)
./style.css
./anchor-use.js
./anchor.min.js
./manpage-urls.json
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was interested in the difference, so I built the derivation on master and on this PR:

$ $ diff -u4 -r /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc /nix/store/j1nq1anc8hc6gai6h7ib7rv9jjcs9aq5-source
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc: common.nix
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc: default.nix
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc: doc-support
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc/functions: library
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc: old
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc: shell.nix
Only in /nix/store/w483x0vv260dikx0wzl49kf6zkd5i673-doc: tests

This does make me think that this would be less error-prone to exclude the following file types:

  1. .nix
  2. .py
  3. .txt (but also: consider removing doc/old/cross.txt.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's cleaner to explicitly list what's needed, so that it's directly associated with the build instructions further down. Also this way we don't need to worry about new file types accidentally influencing the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, my thought is that it's expected in docs to have css, js, and json. Sort of the converse, where there's unexpected breakage due to needing to allowlist one sort of file (css, js) but not another (md).

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jun 14, 2024
@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 14, 2024
@fricklerhandwerk fricklerhandwerk merged commit 3da97e2 into NixOS:master Jun 15, 2024
@fricklerhandwerk fricklerhandwerk deleted the doc-improvements branch June 15, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants