• hallettj@leminal.space
      link
      fedilink
      English
      arrow-up
      5
      ·
      13 days ago

      The comma command is magic! Of course I use it often to run something that I don’t feel like I need listed in my main config - especially a command that I just want to run once. But there are also plenty of cases where I do want to add a package to a config, and I know the command that I want, but I don’t know which package it comes from. The comma is a real easy way to find out.

      I haven’t watched the video - maybe these tips are already in there. If you run a command like , dig you’ll often be prompted to choose which package to get the command from, if the same command is provided by multiple packages. So that’s one way to get a package name. If you don’t get that prompt you can use comma as a lookup tool like this:

      $ , --print-packages dig
      Packages that contain /bin/dig:
      - dig.dnsutils
      - bind.dnsutils
      

      Or you can ask comma to show you the path of the executable it would run, and infer the package name from the path:

      $ , --print-path dig
      /nix/store/qm1hvm2hfryx7xz9k3njsb6gksvs29is-bind-9.20.18-dnsutils/bin/dig
      

      The Nix store path format is /nix/store/<hash>-<pname>-<version>-<output> so that is the dnsutils output of bind, which is bind.dnsutils.

      So that gives me package names I can put in my NixOS config, or devshell, or whatever. In this case I could install any of dig, bind, dig.dnsutils, or bind.dnsutils. (They all end up pointing to that binary in bind.dnsutils.)