Using Nix
We are beginning to support using the Nix package manager for setting up development environments, installing P2Poolv2 binaries, and deploying P2Poolv2 Nodes.
This section provides task-specific documentation on using these tools, a statement of design principles, and an overview of the P2Poolv2 ecosystem and its curated subset of the Nix ecosystem.
- NOTE
-
The use of Nix in P2Poolv2 is optional. For now, we only recommend it for experienced Nix users (or patient users who have a strong desire to learn Nix.) After we refine our tools and documentation, we will present Nix as an option for users without previous Nix experience.
Installing Nix
- WARN
-
At this time, we do not encourage new users of Nix or P2Poolv2 to install and use Nix for P2Poolv2.
Our documented Nix use cases require the Nix command and daemon (to manage the Nix store) installed on your system. Everything else will be installed automatically by Nix. We strongly recommend installing Nix with the nix-command and flakes features enabled — our documentation assumes they are enabled.
We also recommend using the Nix NG Installer (sometimes known as the Rust installer.) It offers many advantages over the shell-script installer including dry-runs, installation receipts, an uninstaller and improved reliability after macOS upgrades.
P2Poolv2 Nix Use Cases
P2Poolv2 Nix Development Environment
If you want to build P2Poolv2 from source, make changes to the code, or run tests on your development box, we provide a Nix development environment for this purpose.
It is as simple as:
git clone git@github.com:p2poolv2/p2poolv2.git cd p2poolv2 nix develop just build-release
You do not need to have anything other than Nix installed and when you exit the development environment nothing has been installed permanently and your system is unchanged.
Install P2Poolv2 Binaries
If you just want to install P2Poolv2 release binaries use:
nix profile install github:p2poolv2/p2poolv2/v0.18.0
This will install (building and caching locally, if necessary) the main p2poolv2 binaries into your user account on your system and will be added to your shell’s path.
To uninstall:
nix profile remove p2poolv2
There are many other ways to install and use Nix packages, but nix profile install is one of the simplest.
Automated P2Pool Deployment
We are working on tools to simplify and automate the deployment of P2Poolv2 to local and remote machines, VMs, and containers. This process is documented in Automated P2Pool Deployment.