Merge pull request #23 from HaosGames/nix

Add build for Nix/NixOS
This commit is contained in:
SChernykh 2021-09-12 11:24:56 +03:00 committed by GitHub
commit ca976e5998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 101 additions and 0 deletions

View file

@ -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:

42
flake.lock Normal file
View file

@ -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
}

39
flake.nix Normal file
View file

@ -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;
}
);
}