Request: Use Guix to report package count
I've noticed package counts on Guix are really high as it seems to just count directories inside the store which can also include dead directories that just haven't been garbage collected. I'm not sure exactly what constitutes an "installed package", and I'm guessing it varies from distro to distro, but Guix has a built in flag to report the list of installed packages.
Furthermore, one advantage of Guix is per-user packages, so even someone running the full GuixSD distro may have system packages and per-user packages installed separately and I think it might be nice to report the package counts separately in neofetch as well.
I have a patch to demonstrate, although I'm not sure if this would be your preferred way to handle it. But this will display both (guix-system) and (guix-user), as available (for instance if the user only uses Guix and not GuixSD then only the guix-user count will appear) (EDIT: actually it doesn't behave the way described in the previous parentheses yet) Patch file: https://gist.github.com/spacelike/84cd87a740cdda899840c277a037d197
Screenshot shows how it looks
(NOTE: Something similar could also be useful for Nix users although I'm not sure what the command would be)
Huh. That's actually neat. While I'm not familiar with Guix, Nix has a similar command in nix-store like this.
However, since both of these are symlink-heavy package managers, won't /run/current-system/ be a symlink? And should we follow the symlink (i.e. readlink or ls -dl) or the symlink itself is sufficient?
Yes it's a symlink. I'm not sure if neofetch needs to take that into account though, since the path to the symlink is just passed in to the "guix" command which automatically knows how to handle it. It prints out a formatted list with the package names, versions, and store path (one package per line).
For the record, I got the command for counting system packages off the guix mailing list. The per-user one is in the documentation though, so that should be fine. I just did a search on the system package counting command and it does seem to be recommended quite a bit on the IRC and mailing list though, so I would bet it's fine too. Also I'm not aware of any way for GuixSD to setup the system profile in a different path either. Just wanted to be clear about where the information is coming from.
Also, my patch isn't really working the way I described it (it'll fail to display the packages field if the user doesn't have both guix-system and guix-user). Sorry about that. But the important parts are just the command to list user packages: guix package -I and the command to list system packages guix package -p /run/current-system/profile -I and they list 1 per line so you can just count the lines
I'll still see if I can fix the patch later.
See #1245. I've changed it up a bit and use if instead of oneliners, it works on Nix so I hope it works on Guix.
It works for me on Guix. Thanks.
Merged :+1: