diff --git a/README.md b/README.md index 58a8941..b652f70 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,26 @@ make release-static -j$(nproc) Make the package: [p2pool-git](https://aur.archlinux.org/packages/p2pool-git/) +### [Nix/NixOS](https://nixos.org) + +This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install p2pool. +The commands below use the new flake specific reference-format, so be sure to also set `ca-references` in `--experimental-features`. + +Because this project has submodules which are not fixed in _nixUnstable_ yet you have to use the `nix/master` branch: +``` +nix shell github:nixos/nix/master +``` + +Run the binary: +``` +nix run git+https://github.com/SChernykh/p2pool?ref=master +``` + +Run the binary with arguments: +``` +nix run git+https://github.com/SChernykh/p2pool?ref=master -- --help +``` + ### macOS p2pool binary: diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..71b8480 --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1631368560, + "narHash": "sha256-JUx+2uf1C2dZ1n56hcy5gjPGh4UP0nQwIr+WbjaWaP4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "91333fe5c9212e1a0c587c8ce70b0571bf0b18bd", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..da81899 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "Decentralized pool for Monero mining."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + rec { + packages = utils.lib.flattenTree { + p2pool = pkgs.stdenv.mkDerivation { + pname = "p2pool"; + version = "0.0.1"; + src = self; + + nativeBuildInputs = builtins.attrValues { + inherit (pkgs) cmake pkg-config; + }; + + buildInputs = builtins.attrValues { + inherit (pkgs) libuv zeromq libsodium gss; + }; + + installPhase = '' + mkdir -p $out/bin + cp -r ./p2pool $out/bin/ + ''; + }; + }; + + defaultPackage = packages.p2pool; + } + ); +}