Nix is a package manager, like `apt`,`yum`,`dnf`,`pip`, etc. It can be installed in any operating system, although there is a Linux distribution that uses it by default: NixOS.
When installed independently, it doesn't interfere with the system's package manager (e.g. `apt`), as it uses a separate directory for everything: `/nix`.
## Why nix?
It allows for creating *reproducible* environments. This means that once someone creates a development environment, its configuration can be shared with other developers on the team, and have it work exactly the same way!
* Not every developer needs to struggle with installing every package from their distribution's repositories one-by-one, take care of incompatible versions, missing packages, add third-party repositories (e.g PPAs for Ubuntu), etc
* Easy on-boarding: new contributors can start working right away!
## Why not...
* Docker/Podman:
* It's not reproducible!
* The versions for every package installed depends on what was available the day the image was built. Some distribution package managers support version pinning, but that might not always work as expected.
* Nix references packages not only by version, but also by the hash of its contents, and one can also even reference the `nixpkgs` repository's snapshot at a specific point in time (it's a git repository == commit!). This also means that multiple versions of the same package can be installed at the same time.
* Inconvenient for everyday use: A large image will take a few seconds to start; the user needs to mount every directory needed as volumes; UID, file permissions and ownership inconsistencies; the user's system's familiar shell configuration, aliases, and utilities, are not available inside the container, etc
* Is language-specific; nix can manage *everything*, so the way it is used across multiple projects would be more uniform and familiar, both for developers working in multiple projects and for groups
curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate
```
### `devbox`
As using nix by its own can be daunting for new users, we can use [devbox](https://jetify-com.vercel.app/docs/devbox/) (think of it as a wrapper for nix, which can be used like python/pip but for any package we need!)
`devbox` also supports various programming languages. For example, [Python](https://jetify-com.vercel.app/docs/devbox/devbox_examples/languages/python/):
once you add it as a dependency, devbox will also manage and activate a Python virtual environment for you:
[devbox](https://jetify-com.vercel.app/docs/devbox/ide_configuration/direnv/) can also be used with [direnv](https://direnv.net/#basic-installation) (highly recommended!):
You could also use `devbox` as a [general package manager](https://jetify-com.vercel.app/docs/devbox/devbox_global/), without needing to `devbox shell` in a project to keep software available: