Linux command
nix-env 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install package
nix-env -iA nixpkgs.[package]
Uninstall package
nix-env -e [package]
List installed packages
nix-env -q
Search packages
nix-env -qaP [pattern]
Upgrade all packages
nix-env -u
Rollback to previous generation
nix-env --rollback
List generations
nix-env --list-generations
说明
nix-env manages Nix user environments. It installs, upgrades, and removes packages in user profiles, with the ability to rollback to previous states. Each operation creates a new generation, preserving previous states.
参数
- -i, --install
- Install packages.
- -e, --uninstall
- Remove packages.
- -u, --upgrade
- Upgrade packages.
- -q, --query
- Query packages.
- -A, --attr
- Install by attribute.
- --rollback
- Rollback generation.
- -p _profile_
- Use profile.
FAQ
What is the nix-env command used for?
nix-env manages Nix user environments. It installs, upgrades, and removes packages in user profiles, with the ability to rollback to previous states. Each operation creates a new generation, preserving previous states.
How do I run a basic nix-env example?
Run `nix-env -iA nixpkgs.[package]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i, --install do in nix-env?
Install packages.