From 5c57c4d0d88efa73d2921a7b51a2e50b8e30ceff Mon Sep 17 00:00:00 2001 From: Thorsten Schindler Date: Sat, 11 Sep 2021 16:22:47 +0200 Subject: [PATCH 1/5] added nix flake --- flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..944d0b4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..570b6a6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Decentralized pool for Monero mining."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + }; + + outputs = { self, nixpkgs }: { + packages.x86_64-linux.p2pool = with import nixpkgs { system = "x86_64-linux";}; stdenv.mkDerivation { + pname = "p2pool"; + version = "0.0.1"; + src = self; + + nativeBuildInputs = [ cmake pkg-config ]; + + buildInputs = [ + libuv zeromq + libsodium gss + ]; + + installPhase = '' + mkdir -p $out/bin + cp -r ./p2pool $out/bin/ + ''; + }; + + defaultPackage.x86_64-linux = self.packages.x86_64-linux.p2pool; + }; +} From 830531791d46ed8a230a1685db93007ef2e708f8 Mon Sep 17 00:00:00 2001 From: Thorsten Schindler Date: Sat, 11 Sep 2021 17:00:58 +0200 Subject: [PATCH 2/5] added nix build instructions --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 58a8941..b50d321 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-refernces` 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 github:SChernykh/p2pool +``` + +Run the binary with arguments: +``` +nix run github:SChernykh/p2pool -- --help +``` + ### macOS p2pool binary: From 8c5cd198e0333b5e9e9ad32d5711be3abe2c4159 Mon Sep 17 00:00:00 2001 From: Thorsten Schindler Date: Sat, 11 Sep 2021 18:50:44 +0200 Subject: [PATCH 3/5] changed from using fetchFromGitHub to fetchgit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b50d321..8ec487b 100644 --- a/README.md +++ b/README.md @@ -93,12 +93,12 @@ nix shell github:nixos/nix/master Run the binary: ``` -nix run github:SChernykh/p2pool +nix run git+https://github.com/SChernykh/p2pool?ref=master ``` Run the binary with arguments: ``` -nix run github:SChernykh/p2pool -- --help +nix run git+https://github.com/SChernykh/p2pool?ref=master -- --help ``` ### macOS From 14a828618b23cd5f46de6718ff6ba4c2982c697a Mon Sep 17 00:00:00 2001 From: Thorsten Schindler Date: Sat, 11 Sep 2021 21:41:38 +0200 Subject: [PATCH 4/5] support build for all nixpkgs default systems --- flake.lock | 18 +++++++++++++++++- flake.nix | 44 +++++++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 944d0b4..71b8480 100644 --- a/flake.lock +++ b/flake.lock @@ -17,7 +17,23 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "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" } } }, diff --git a/flake.nix b/flake.nix index 570b6a6..da81899 100644 --- a/flake.nix +++ b/flake.nix @@ -3,27 +3,37 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs"; + utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }: { - packages.x86_64-linux.p2pool = with import nixpkgs { system = "x86_64-linux";}; stdenv.mkDerivation { - pname = "p2pool"; - version = "0.0.1"; - src = self; + 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 = [ cmake pkg-config ]; + nativeBuildInputs = builtins.attrValues { + inherit (pkgs) cmake pkg-config; + }; - buildInputs = [ - libuv zeromq - libsodium gss - ]; + buildInputs = builtins.attrValues { + inherit (pkgs) libuv zeromq libsodium gss; + }; - installPhase = '' - mkdir -p $out/bin - cp -r ./p2pool $out/bin/ - ''; - }; + installPhase = '' + mkdir -p $out/bin + cp -r ./p2pool $out/bin/ + ''; + }; + }; - defaultPackage.x86_64-linux = self.packages.x86_64-linux.p2pool; - }; + defaultPackage = packages.p2pool; + } + ); } From a16f614cee1dd0c1a0b403ec7f42cc45975b4757 Mon Sep 17 00:00:00 2001 From: Thorsten Schindler Date: Sun, 12 Sep 2021 09:32:23 +0200 Subject: [PATCH 5/5] fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ec487b..b652f70 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ 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-refernces` in `--experimental-features`. +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: ```