fork/home-manager
git clone https://git.julia.blue/fork/home-manager
b3498ccc
master
1# info.nix -- install texinfo and create `dir` file 2 3# This is a helper for the GNU info documentation system. By default, 4# the `info` command (and the Info subsystem within Emacs) gives easy 5# access to the info files stored system-wide, but not info files in 6# your ~/.nix-profile. 7 8# Specifically, although info can then find files when you explicitly 9# ask for them, it doesn't show them to you in the table of contents 10# on startup. To do that requires a `dir` file. NixOS keeps the 11# system-wide `dir` file up to date, but ignores files installed in 12# user profiles. 13 14# This module contains extra profile commands that generate the `dir` 15# for your home profile. Then when you start info (and both `dir` 16# files are in your $INFOPATH), it will *merge* the contents of the 17# two files, showing you a unified table of contents for all packages. 18# This is really nice. 19 20{ config , lib , pkgs , ...} : 21 22with lib ; 23 24let 25 26cfg = config . programs . info ; 27 28# Installs this package -- the interactive just means that it 29# includes the curses `info` program. We also use `install-info` 30# from this package in the activation script. 31infoPkg = pkgs . texinfoInteractive ; 32 33in { 34imports = [ 35( mkRemovedOptionModule [ "programs" "info" "homeInfoDirLocation" ] '' 36The `dir` file is now generated as part of the Home Manager profile and 37will no longer be placed in your home directory. 38'' ) 39]; 40 41options . programs . info . enable = mkEnableOption "GNU Info" ; 42 43config = mkIf cfg . enable { 44home . packages = [ 45infoPkg 46 47# Make sure the target directory is a real directory. 48( pkgs . runCommandLocal "dummy-info-dir1" { } "mkdir -p $out/share/info" ) 49( pkgs . runCommandLocal "dummy-info-dir2" { } "mkdir -p $out/share/info" ) 50]; 51 52home . extraOutputsToInstall = [ "info" ]; 53 54home . extraProfileCommands = let infoPath = "$out/share/info" ; 55in '' 56if [[ -w " ${ infoPath } " && ! -e " ${ infoPath } /dir" ]]; then 57PATH=" ${ lib . makeBinPath [ pkgs . gzip infoPkg ]} ''${PATH:+:}$PATH" \ 58find -L " ${ infoPath } " \( -name '*.info' -o -name '*.info.gz' \) \ 59-exec install-info '{}' " ${ infoPath } /dir" ';' 60fi 61'' ; 62}; 63}