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/documentation: add option to generate caches #86489

Merged
merged 4 commits into from Jun 18, 2020
Merged

Conversation

rnhmjoj
Copy link
Contributor

@rnhmjoj rnhmjoj commented May 1, 2020

Motivation for this change

An alternative approach to #76841 to generate manual pages caches. This will fix #14472.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change (mass-rebuild)
  • Tested execution of all binary files (apropos, whatis, mandb works as intended)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented May 4, 2020

Some notes:

  • I tried to avoid using symlinkJoin by dumping all the paths in a man.conf inside the runCommandLocal and calling mandb -C man.con. However it kept overwriting the index for each path so that the index only contained the pages of the very last package.

  • Maybe the patch should use a custom name instead of man_db.conf if we want to avoid indexing non-Nix packages on the system. I'm not sure whether this is expected or advisable.

@matthewbauer matthewbauer mentioned this pull request May 9, 2020
10 tasks
nixos/modules/misc/documentation.nix Outdated Show resolved Hide resolved
nixos/modules/misc/documentation.nix Show resolved Hide resolved
Copy link
Member

@lheckemann lheckemann left a comment

Choose a reason for hiding this comment

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

I like this!

nixos/modules/misc/documentation.nix Outdated Show resolved Hide resolved
nixos/modules/misc/documentation.nix Show resolved Hide resolved
@eraserhd
Copy link
Contributor

Bump, this looks nice and has been idle for 23 days.

@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented Jun 15, 2020

@eraserhd: It's essentially ready. I'm waiting for @lheckemann and @infinisil to complete their review. If you want to try it out, cherry-pick the commits on master because staging is likely broken.

@lheckemann
Copy link
Member

Sorry, didn't realise you were waiting for approval! mind wanders to NixOS/rfcs#30

When using --with-config-file, all man-db programs completely ignore the
systemwide configuration in /etc/man_db.conf: it means on NixOS there is
no way to change the configuration without rebuilding man-db, which in
turn causes a mass-rebuild.

To solve this problem this commit removes the NixOS-specific
configuration in man-db, which wasn't the appropriate place to begin
with: the package is expected to work on non-NixOS systems as well. Also
a small patch now ensure /etc/man_db.conf is used, if available, before
the bundled configuration.
Previously the NixOS-specific configuration for man-db was in the
package itself and /etc/man.conf was completely ignored.
This change moves it to /etc/man_db.conf, making declarative
configuration practical again.

It's now possible to generate the mandb caches for all packages
installed through NixOS `environment.systemPackages` at build-time.
The standard location for the stateful cache (/var/cache/man) is also
configured to allow users to run `mandb` manually if they wish.

Since generating the cache can be expensive the option is off by
default.
@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented Jun 18, 2020

Documented the change in the 20.09 release notes.

@rnhmjoj rnhmjoj merged commit 7e57c52 into NixOS:staging Jun 18, 2020
@rnhmjoj rnhmjoj deleted the mandb branch June 19, 2020 08:11
@doronbehar
Copy link
Contributor

Thank you @rnhmjoj for tackling this ❤️, the issue has bothered since always.

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