43 lines
864 B
Markdown
43 lines
864 B
Markdown
# Nix package manager cheatsheet
|
|
|
|
## Search for packages
|
|
|
|
```sh
|
|
nix search nixpkgs python
|
|
```
|
|
|
|
## Add packages to current shell
|
|
|
|
```sh
|
|
# single package
|
|
nix shell nixpkgs#python3
|
|
|
|
# multiple packages
|
|
nix shell nixpkgs#python3 nixpkgs#nodejs
|
|
```
|
|
|
|
## Run a command directly
|
|
|
|
```sh
|
|
nix run nixpkgs#python3 -- --version
|
|
```
|
|
|
|
## Install packages persistently (available in new SSH sessions)
|
|
|
|
```sh
|
|
# nix shell packages are lost when the session ends
|
|
# use profile install to persist across sessions
|
|
# packages use the nixpkgs# prefix
|
|
nix profile install nixpkgs#nodejs nixpkgs#pnpm nixpkgs#yarn
|
|
```
|
|
|
|
## Language stacks
|
|
|
|
| Stack | Packages |
|
|
|-------|----------|
|
|
| Node.js | `nodejs`, `pnpm`, `yarn` |
|
|
| Python | `python3`, `python3Packages.pip`, `python3Packages.virtualenv`, `uv` |
|
|
| Go | `go` |
|
|
| Rust | `cargo`, `rustc`, `rustfmt`, `clippy` |
|
|
| Foundry | `foundry` |
|