1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-01 08:49:44 +01:00
home-manager/modules/programs/info.nix
Emily 9f9e277b60 treewide: remove now-redundant lib.mdDoc calls
These (and the `*MD` functions apart from `literalMD`) are now no-ops
in nixpkgs and serve no purpose other than to add additional noise and
potentially mislead people into thinking unmarked DocBook documentation
will still be accepted.

Note that if backporting changes including documentation to 23.05,
the `mdDoc` calls will need to be re-added.

To reproduce this commit, run:

    $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
      nix shell nixpkgs#coreutils \
      -c find . -name '*.nix' \
      -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
      --strip {} +
    $ ./format
2023-07-17 18:49:09 +01:00

63 lines
2.1 KiB
Nix

# info.nix -- install texinfo and create `dir` file
# This is a helper for the GNU info documentation system. By default,
# the `info` command (and the Info subsystem within Emacs) gives easy
# access to the info files stored system-wide, but not info files in
# your ~/.nix-profile.
# Specifically, although info can then find files when you explicitly
# ask for them, it doesn't show them to you in the table of contents
# on startup. To do that requires a `dir` file. NixOS keeps the
# system-wide `dir` file up to date, but ignores files installed in
# user profiles.
# This module contains extra profile commands that generate the `dir`
# for your home profile. Then when you start info (and both `dir`
# files are in your $INFOPATH), it will *merge* the contents of the
# two files, showing you a unified table of contents for all packages.
# This is really nice.
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.info;
# Installs this package -- the interactive just means that it
# includes the curses `info` program. We also use `install-info`
# from this package in the activation script.
infoPkg = pkgs.texinfoInteractive;
in {
imports = [
(mkRemovedOptionModule [ "programs" "info" "homeInfoDirLocation" ] ''
The `dir` file is now generated as part of the Home Manager profile and
will no longer be placed in your home directory.
'')
];
options.programs.info.enable = mkEnableOption "GNU Info";
config = mkIf cfg.enable {
home.packages = [
infoPkg
# Make sure the target directory is a real directory.
(pkgs.runCommandLocal "dummy-info-dir1" { } "mkdir -p $out/share/info")
(pkgs.runCommandLocal "dummy-info-dir2" { } "mkdir -p $out/share/info")
];
home.extraOutputsToInstall = [ "info" ];
home.extraProfileCommands = let infoPath = "$out/share/info";
in ''
if [[ -w "${infoPath}" && ! -e "${infoPath}/dir" ]]; then
PATH="${lib.makeBinPath [ pkgs.gzip infoPkg ]}''${PATH:+:}$PATH" \
find -L "${infoPath}" \( -name '*.info' -o -name '*.info.gz' \) \
-exec install-info '{}' "${infoPath}/dir" ';'
fi
'';
};
}