-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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: init #311459
nixpkgs-manual: init #311459
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should not add the docs with pkgs-by-name, but via an overlay or add an exclude from checks since it will always import files from /doc ?
I've put this PR in draft mode while figuring out the way forward with I'm going to have better availability to contribute to open source during the summer. That's when I plan on re-engaging with this. |
@hsjobeki said:
This is the direction I went. The current
This is now ready for review, I think. |
There is one thing I could do that would satisfy |
This comment was marked as outdated.
This comment was marked as outdated.
Re-doing the construction to be |
pkgs/data/documentation/nixpkgs-manual/lib-function-locations.nix
Outdated
Show resolved
Hide resolved
Can we add a symlink? (doc/nixpkgs-manual -> pkgs/.../nixpkgs-manual) Even the GH web ui can follow symlinks. |
This it what I suggested in #311459 (comment) -- and yeah, it's quite possible, I believe. |
Move `libsets` over to it, since it's the only user. Format with `nixfmt` since we're changing it so dramatically.
Before, it produced a string, not a derivation.
Also, use `finalAttrs` style and pass through all the helper derivations.
You have my blessing to ignore the The real solution imo is to get away from the messy single |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed all commits, looking good except one thing!
assert lib.hasPrefix root declStr; | ||
{ | ||
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; | ||
name = subpath; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed you changed this to an assert
when it was this before:
Lines 89 to 93 in 6a03708
if hasPrefix (toString ../..) (toString decl) | |
then | |
let subpath = removePrefix "/" (removePrefix (toString ../.) (toString decl)); | |
in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; } | |
else decl) |
Notably I'd expect this to break manual rendering when building non-Nixpkgs modules using documentation.nixos.includeAllModules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I thought that for the nixpkgs manual, there wouldn't be ... non-nixpkgs modules. Am I wrong there?
Notably this would be terribly incorrect for the NixOS manual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes you're right! Mixed things up here :)
assert lib.hasPrefix root declStr; | ||
{ | ||
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; | ||
name = subpath; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes you're right! Mixed things up here :)
Thank you as always @infinisil! |
This shows up in the rebuild count by ofborg in unrelated packages https://gist.github.com/GrahamcOfBorg/e02bf2c3d2c6a52e1bfb155f6462a9a4 |
I'll be able to take a look tomorrow. Likely something is taking a dependency on the whole Nixpkgs tree somewhere. |
OK, I root-caused this rebuild. Step to repro, in the nixpkgs root:
Here's the diff: - ./result-on-master:{out}
+ ./result:{out}
• The environments do not match:
buildPhase=''
/nix/store/k26j1ix7r2sj83f7rdrjjnsw3gb0zfyi-documentation-highlighter/loader.js
cp -t out ./style.css ./anchor.min.js ./anchor-use.js
nixos-render-docs manual html \
--manpage-urls ./manpage-urls.json \
- --revision f4f322d1424aa547eba9cb092f905f5ceb9b639c \
+ --revision 65abf7019bd37b6ad20ea008843ab4a9d316eaa5 \
--stylesheet style.css \
--stylesheet highlightjs/mono-blue.css \
--script ./highlightjs/highlight.pack.js \
--script ./highlightjs/loader.js \
'' The revision is being incorporated with these lines: nixpkgs/doc/doc-support/package.nix Lines 61 to 65 in 4089e29
Lines 437 to 445 in 4089e29
Which makes the whole thing make sense. Every git revision makes this rebuild, because the documentation includes the git revision it was built with. No other package includes the git revision it was built with in nixpkgs; the other usage is in |
My proposed fix is here: |
Motivation
Make it easier and more natural to build the contents of the
doc/
directory.Description of changes
doc/
tocallPackage
style.nixpkgs-manual
name.doc/default.nix
anddoc/shell.nix
forward to them.The diff is pretty chunky, but it's not too bad when you have the old and new side by side... sadly GitHub makes this pretty impossible.
Incidental changes:
nixfmt
on new filesstdenvNoCC
instead ofstdenv
as appropriatepassthru
Why not
pkgs/by-name
?Because it has a rule that packages in
pkgs/by-name
cannot refer to files outside their own directory, which this obviously needs to do. I've opened NixOS/nixpkgs-vet#64 to ideate about this use case -- it's not broad, but it would be nice -- but in the meantime, this derivation can't usepkgs/by-name
.The CI failure says that merging won't break the main branch.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-build doc/
nix-build -A nixpkgs-manual
pushd doc/ && nix-shell
nix-build doc/
, on branchnix-build doc/
, and thendiffoscope <original> <new>
(no changes exceptnix-support/hydra-build-products
)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)