nix-tree icon indicating copy to clipboard operation
nix-tree copied to clipboard

Feature request: Display meta information

Open DavHau opened this issue 4 years ago • 3 comments

It would be nice if nix-tree would also display meta information for each package, like for example the license.

DavHau avatar Nov 19 '20 03:11 DavHau

Great idea! Just to start the brainstorming:

  • Should we simply have a "details" modal showing the meta information for the selected package, or is there any information we can/should show inline or in the modeline?
  • How do we get some useful metadata for store paths? The only thing nix-tree currently has access to is the metadata from nix path-info --json per every store path, but that doesn't contain much information:
% nix path-info --json /nix/store/zyvf9k2i8cma5pvb9mrvh7fsqjhbf5py-krb5-1.18 | jq .
[
  {
    "path": "/nix/store/zyvf9k2i8cma5pvb9mrvh7fsqjhbf5py-krb5-1.18",
    "narHash": "sha256-MKC140uRzp0Mvn5kZFKo1o/YKUtJJvt9n7eRc16gNCI=",
    "narSize": 4081944,
    "references": [
      "/nix/store/6rv3vhb87bgx7i205ngb4gz3gnzypnhl-keyutils-1.6.3-lib",
      "/nix/store/7figba9q8yrgz4gj9yhqgjri97h9snsb-openssl-1.1.1g",
      "/nix/store/bdf8iipzya03h2amgfncqpclf6bmy3a1-glibc-2.32",
      "/nix/store/k8p54jg8ipvnfz435mayf5bnqhw4qqap-bash-4.4-p23",
      "/nix/store/sbfj9lhpfi5v9vwrdf9my8l1m7cwbi37-libedit-20191231-3.1",
      "/nix/store/zyvf9k2i8cma5pvb9mrvh7fsqjhbf5py-krb5-1.18"
    ],
    "registrationTime": 1603836913,
    "signatures": [
      "cache.nixos.org-1:XoTFbWjf7GsVJsATyMZDBF4DUl7k/V/9GL/PZp+hbX/nQ7uT7Pjr0W0F75FTIMSdp5AojKp88c/OpZXJQ6SqBg=="
    ]
  }
]

Do you know a way to obtain that license information or any other metadata given a store path?

utdemir avatar Nov 19 '20 08:11 utdemir

I guess the bottom right corner of the screen could have enough space for it.

Getting the metadata could actually be a problem. The metadata is specified in the nixpkgs expression for every package and can be retrieved via pkgs.{package}.meta. But I don't know if there is a way to get the nix attribute for a store path.

Seems like the problem is a bit more complicated than originally thought.

DavHau avatar Nov 24 '20 04:11 DavHau

Getting the metadata could actually be a problem. The metadata is specified in the nixpkgs expression for every package and can be retrieved via pkgs.{package}.meta. But I don't know if there is a way to get the nix attribute for a store path.

Yeah, I couldn't find a solution for this either. I'm going to leave this issue open since I still think it would be a useful piece of information, and will come back to it if I can figure out a nice way. Please let me know if you can think of any!

Thanks again.

utdemir avatar Nov 24 '20 08:11 utdemir