Why devShell sometimes lose packages' man pages?

Why shellcheck has no man pages when made available via nix develop but has a man page with nix shell nixpkgs#shellcheck?

I have this flake.nix:

{
  description = "A shell with stuff";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      rec {
        devShell = pkgs.mkShell rec {
          packages = with pkgs; [
            shellcheck
          ];
        };
      });
}

And it works. But no man pages:

$ nix develop
warning: creating lock file '/tmp/test/flake.lock'

[h@desk03:/tmp/test]$ type shellcheck
shellcheck is /nix/store/8mpr0bjwmxli1hfjxap092hvb9r6vfzs-shellcheck-0.9.0-bin/bin/shellcheck

[h@desk03:/tmp/test]$ man shellcheck
No manual entry for shellcheck

[h@desk03:/tmp/test]$ manpath
/nix/store/2y0q33dmn7846bpqcnfch4a0q2q6dmya-patchelf-0.15.0/share/man:/nix/store/j5wraaxv16fcl10x11566a3807nr4nlr-findutils-4.9.0/share/man:/nix/store/q951w69v8kbdrw6shdpibnl594yfr0by-diffutils-3.9/share/man:/nix/store/93z4n7zy5hwpn06279jlmak75jmq1db1-gnused-4.9/share/man:/nix/store/c01b2gmx1fjjkpnvj6bxy9q49g8qkpka-gnugrep-3.7/share/man:/nix/store/lcfhnr6wrj9ssd3dxs39sprvz6qrxlj5-gnutar-1.34/share/man:/nix/store/swf1dckghdx7nza1lxz6s462pafwd7wa-patch-2.7.6/share/man:/nix/store/0xpv4lac3ybc6hm9gg7ywkdazs4vsj8l-file-5.44/share/man:/run/current-system/sw/share/man:/home/h/.nix-profile/share/man

But I do get my loved man pages via nix shell:

$ nix shell nixpkgs#shellcheck

[h@desk03:/tmp/test]$ type shellcheck
shellcheck is /nix/store/8mpr0bjwmxli1hfjxap092hvb9r6vfzs-shellcheck-0.9.0-bin/bin/shellcheck

[h@desk03:/tmp/test]$ man shellcheck
# I see the manpage

[h@desk03:/tmp/test]$ manpath
/nix/store/k6n4dgjv8cxhhvsvhlf7l0m2s5azg8v5-shellcheck-0.9.0-man/share/man:/run/current-system/sw/share/man:/home/h/.nix-profile/share/man

[h@desk03:/tmp/test]$ file /nix/store/k6n4dgjv8cxhhvsvhlf7l0m2s5azg8v5-shellcheck-0.9.0-man/share/man/man1/shellcheck.1.gz
/nix/store/k6n4dgjv8cxhhvsvhlf7l0m2s5azg8v5-shellcheck-0.9.0-man/share/man/man1/shellcheck.1.gz: gzip compressed data, from Unix, original size modulo 2^32 14750

But the weirder thing is: I get man pages in nix develop for other packages! If I add nmap to the Flake file above, I can read man nmap fine via nix develop and also via nix shell nixpkgs#nmap.

Why I’m losing parts of some packages in a devShell/nix develop? Is this a known caveat in devShells? Or is it a bug in my Flake file? Are there other parts of packages that also “disappear” if using nix shell or nix develop?

I’m new to all of this, but I thought I would get the same package regardless of how I “installed” it?

1 Like

Sometimes putting stuff in buildInputs instead of packages (as given to mkShell) works better. I have no idea why it what the difference is under the hood.