How do I list all the packages installed through Guix? On Ubuntu this would be done through dpkg -l.
3 Answers
guix package --list-installed (guix package -I) is a valid answer to list the installed package on any linux distribution by the package managerguix.
But it is not the equivalent of dpkg -l. Why?
dpkg -l will list all the installed package on the system... guix isn't able to get information about the package installed through apt, dpkg ..., only the packages installed by the guix itself are accessed.
On GuixSD
GuixSD come with preinstalled packages; In addition of guix package --list-installed, to list the system wide package you need to set the --profile option:
guix package --list-installed --profile=/run/current-system/profile |awk '{print $1}'
e,g:
$ guix package --list-installed=zile
$
Dosn't return anything.
But:
$ guix package --list-installed --profile=/run/current-system/profile |awk '/zile/ {print $1,$2}'
zile 2.4.14
Package management (the emacs way):
- 63,407
- 31
- 131
- 192
-
Just for the record, another path to the system profile is `/var/guix/profiles/system/profile`, which I find easier to remember. – Roman Riabenko Feb 23 '22 at 20:33
You can use
guix package --list-installed
to list all the installed packages. Throw on a | grep name at the end to search for "name" in that list.
- 921
- 1
- 7
- 17
-
2No need for `grep`, you can match against a regex with `--list-installed=regex`. – Stephen Kitt Dec 27 '20 at 19:20
-
Huh, unusual. The `guix` command is not able to take the argument value like `--list-installed regex` which I did try before writing. – Rovanion Dec 28 '20 at 13:35
Other answers are correct about how to list the packages installed with guix in the user or the system profiles, but there are other packages which are installed to satisfy dependencies. Such packages are not listed by guix package, but they are installed in the store.
For comparison, dpkg -l lists all packages installed, whether they were installed specifically or automatically just to satisfy a dependency. I found myself looking for a similar list, first just for my general understanding, and later when I wanted to check that a driver package is present, even though I cannot tell by this whether such driver package is used.
Since all packages are installed to the store, one can look what directories are present in /gnu/store to determine which packages were installed. For myself, I came up with the following command, which finds directories immediately in /gnu/store with a dash in their names, then cuts away the part before the first dash, sorts them alphabetically, and removes duplicate entries. This is the closest to the list of installed packages that I could get so far.
$ find /gnu/store/ -maxdepth 1 -type d -iname '*-*' | cut -d '-' -f 2- | sort | uniq
Of course, this is a great feature of Guix to keep all of this hidden and allow the user to be concerned just with the packages shown by guix package --list-installed.
- 2,145
- 3
- 15
- 39