New in version 3008.0.
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under $HOME/.nix-profile/, and the nix store, unless specially
set up, should be in /nix. To easily use this with multiple users or a root
user, set up the nix-daemon.
This module is compatible with the pkg state, so you can use it with
pkg.installed, pkg.removed, pkg.latest, etc.
For more information on nix, see the nix documentation.
This function is an alias of latest_version.
Return the latest version of the named package available for upgrade or installation.
Since Nix doesn't have a simple way to query the latest available version without performing a search, this queries
nix searchfor each package.If the latest version of a given package is already installed, an empty string will be returned for that package.
CLI Example:
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package1> <package2> ...
Completely removed all currently 'uninstalled' packages in the nix store.
Tells the user how many store paths were removed and how much space was freed.
How much space was freed and how many derivations were removed
Warning
This is a destructive action on the nix store.
CLI Example:
salt '*' pkg.collect_garbage
Installs a single or multiple packages via nix profile
Installed packages. Example element: gcc-3.3.2
CLI Example:
salt '*' pkg.install vim
salt '*' pkg.install pkgs='[vim, git]'
Return the latest version of the named package available for upgrade or installation.
Since Nix doesn't have a simple way to query the latest available version
without performing a search, this queries nix search for each package.
If the latest version of a given package is already installed, an empty string will be returned for that package.
CLI Example:
salt '*' pkg.latest_version <package name>
salt '*' pkg.latest_version <package1> <package2> ...
Lists installed packages.
versions_as_list (bool) -- returns versions as lists, not strings. Default: False
Packages installed or available, along with their attributes.
CLI Example:
salt '*' pkg.list_pkgs
salt '*' pkg.list_pkgs versions_as_list=True
List all available package upgrades.
CLI Example:
salt '*' pkg.list_upgrades
Nix doesn't have a traditional package database to refresh, but this updates the flake registry / channel.
CLI Example:
salt '*' pkg.refresh_db
Removes packages with nix profile remove.
A dict containing the changes
CLI Example:
salt '*' pkg.remove vim
salt '*' pkg.remove pkgs='[vim, git]'
Erases a package from the current nix profile.
Nix uninstalls work differently than other package managers, and the symlinks in the profile are removed,
while the actual package remains.
There is also a pkg.purge function, to clear the package cache of unused packages.
Packages that have been uninstalled
CLI Example:
salt '*' pkg.uninstall vim
salt '*' pkg.uninstall vim git
Runs an update operation on the specified packages, or all packages if none is specified.
The upgraded packages. Example element: ['libxslt-1.1.0', 'libxslt-1.1.10']
CLI Example:
salt '*' pkg.upgrade
salt '*' pkg.upgrade pkgs=one,two
Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
CLI Example:
salt '*' pkg.version <package name>
salt '*' pkg.version <package1> <package2> <package3> ...