From 96ec8c7623f35840fbbcd1ee6581cfc73b059530 Mon Sep 17 00:00:00 2001 From: Jeff Huffman Date: Mon, 9 Jan 2023 15:36:28 -0500 Subject: [PATCH] nixos/documentation.man.mandb: Add skipPackages option, and include nixos-version prevents unnecessary recreation of man caches Fixes #209835 --- nixos/modules/installer/tools/tools.nix | 2 ++ nixos/modules/misc/man-db.nix | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index e46a2df8fa6a..caf97f66ef31 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -235,6 +235,8 @@ in nixos-enter ] ++ lib.optional (nixos-option != null) nixos-option; + documentation.man.man-db.skipPackages = [ nixos-version ]; + system.build = { inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-enter; }; diff --git a/nixos/modules/misc/man-db.nix b/nixos/modules/misc/man-db.nix index 299b11d1fcef..2b9805612186 100644 --- a/nixos/modules/misc/man-db.nix +++ b/nixos/modules/misc/man-db.nix @@ -13,11 +13,21 @@ in example = false; }; + skipPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = []; + internal = true; + description = lib.mdDoc '' + Packages to *not* include in the man-db. + This can be useful to avoid unnecessary rebuilds due to packages that change frequently, like nixos-version. + ''; + }; + manualPages = lib.mkOption { type = lib.types.path; default = pkgs.buildEnv { name = "man-paths"; - paths = config.environment.systemPackages; + paths = lib.subtractLists cfg.skipPackages config.environment.systemPackages; pathsToLink = [ "/share/man" ]; extraOutputsToInstall = [ "man" ] ++ lib.optionals config.documentation.dev.enable [ "devman" ];