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

nixos: doc: implement related packages in the manual (again) #33898

Merged
merged 7 commits into from Feb 10, 2018

Conversation

oxij
Copy link
Member

@oxij oxij commented Jan 15, 2018

What is this?

#32424 reverted by #33006 brought back to you with laziness and meta.evaluates of #33057.
Closes #33007.

Things done
  • Seems to work.
  • configuration.nix(5) manual builds on x86_64-linux.
  • configuration.nix(5) manual builds on aarch64-linux.

Please check the last item with OfBorg before merging, I'm too lazy to rebuild aarch64 stdenv just to test this.


/cc @grahamc @vcunat

@oxij
Copy link
Member Author

oxij commented Jan 19, 2018

Well, it seems to work on my hacky cross-compiled aarch64 stdenv.

Ping @grahamc again because you was involved in 3 out of 4 related PRs.

reverseList listDfs toposort sort take drop sublist last init
crossLists unique intersectLists subtractLists
reverseList listDfs toposort sort compareLists take drop sublist
last init crossLists unique intersectLists subtractLists
Copy link
Member

Choose a reason for hiding this comment

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

One of the intentions behind making the inherits explicit here is so we don't need to make all the lib functions available in the top level, but instead say lib.lists.compareLists. If this seems like a reasonable thing to do, would you like to not inherit them here? It could be we're just not ready for that yet, seeing as I don't think many functions aren't exposed at the top level here.

lib/trivial.nix Outdated
compare elements of the same subtype with `yes` and `no`
comparisons respectively.
*/
splitByAndCompare = p: yes: no: a: b:
Copy link
Member

Choose a reason for hiding this comment

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

Please provide a usage example for these functions.

Copy link
Member

Choose a reason for hiding this comment

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

Also, is this really trivial?

# Convert the list of options into an XML file.
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList');
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList'');
Copy link
Member

Choose a reason for hiding this comment

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

I'm worried about the '' being confusing here, since it is identical to otherwise valid Nix syntax. Is there a better variable name you can imagine?

@grahamc
Copy link
Member

grahamc commented Jan 19, 2018

Will relatedPackages cover cases like python3Packages.requests? What will happen if a relatedPackage is deleted, and the reference is left dangling?

@oxij
Copy link
Member Author

oxij commented Jan 19, 2018 via email

@grahamc
Copy link
Member

grahamc commented Jan 19, 2018

I agree with everything you said, sounds great! I look forward to the few remaining fixes :)

@oxij
Copy link
Member Author

oxij commented Feb 5, 2018 via email

…f their option group

Why? Because this way configuration.nix(5) can be read linearly.

Before:

> virtualisation.xen.bootParams
> ...
> virtualisation.xen.enable
> ...
> virtualisation.xen.package
> ...

After:

> virtualisation.xen.enable
> virtualisation.xen.package
> virtualisation.xen.bootParams
> ...
This allows one to specify "related packages" in NixOS that get rendered into
the configuration.nix(5) man page. The interface philosophy is pretty much
stolen from TeX bibliography.

See the next several commits for examples.
This is a trivial example of `relatedPackages` option usage.
This is an attribute path example of `relatedPackages` option usage.
This is a custom attribute set example of `relatedPackages` option usage.
@oxij
Copy link
Member Author

oxij commented Feb 9, 2018

ping? Just as I said, its completely finished now.
I added a some more documentation beyond what was discussed and implemented the x.y.z with rename.nix-like lists. Seems perfect to me.

@oxij oxij mentioned this pull request Feb 10, 2018
1 task
@grahamc
Copy link
Member

grahamc commented Feb 10, 2018

image

😻

@grahamc grahamc merged commit 5aabf0f into NixOS:master Feb 10, 2018
@oxij
Copy link
Member Author

oxij commented Feb 10, 2018

Right :) Thanks!

in lib.compareLists cmp (splt a) (splt b) < 0;

# Customly sort option list for the man page.
optionsList = lib.sort (a: b: optionListLess a.name b.name) optionsListDesc;
Copy link
Member

Choose a reason for hiding this comment

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

this is the cause of the slowdown, the cost of sorting all of the options happens during every evaluation.

@oxij
Copy link
Member Author

oxij commented Feb 11, 2018 via email

@LnL7
Copy link
Member

LnL7 commented Feb 11, 2018

I used this and only checked the sort, it might be not be the sort itself but some other part.
Moving this sorting to the build should work, that way it will be sorted nicely for both the manual and manpages. But adding a flag that's only enabled for the manual also works as a workaround.

$ nix-build pkgs/top-level/release.nix -A metrics
$ grep .lapp result/nix-support/hydra-metrics
nixos.lapp.time 1.21916 s
nixos.lapp.maxresident 455256 KiB
nixos.lapp.allocations 273427272 B
nixos.lapp.values 4435159

@oxij
Copy link
Member Author

oxij commented Feb 11, 2018 via email

@LnL7
Copy link
Member

LnL7 commented Feb 11, 2018

Instead of sorting this in nix at evaluation time, it could be done in the docbook build or some other intermediate drv. Then the sorting only happens once and gets cached as part of the manual/manpages build.

@vcunat
Copy link
Member

vcunat commented Feb 11, 2018

https://nixos.org/nixos/manual/ shows the latest stable channel.

@vcunat
Copy link
Member

vcunat commented Feb 11, 2018

This significantly increased evaluation time

To be more explicit, it's basically a channel blocker for nixos-unstable ATM, as Hydra almost always runs out of memory during evaluation. Unless we can find a solution very fast, I'd temporarily revert the problematic part until we find a better way.

@oxij
Copy link
Member Author

oxij commented Feb 11, 2018 via email

@oxij
Copy link
Member Author

oxij commented Feb 11, 2018 via email

@oxij
Copy link
Member Author

oxij commented Feb 12, 2018 via email

@oxij
Copy link
Member Author

oxij commented Feb 12, 2018

PR for ofborg tests #34866.

@vcunat
Copy link
Member

vcunat commented Feb 12, 2018

Thanks for the quick reaction ❤️

vcunat added a commit that referenced this pull request Feb 12, 2018
This solves most of the performance regression from a7d75ab (#33898).
@oxij oxij deleted the nixos/related-packages-v5 branch September 8, 2018 22:16
@arianvp
Copy link
Member

arianvp commented Sep 22, 2018

I only get "related packages" for only 2 options in the entire manpage. Namely tmux and xen. Is this expected behaviour?

@oxij
Copy link
Member Author

oxij commented Sep 23, 2018 via email

@arianvp
Copy link
Member

arianvp commented Sep 23, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants