p2pool: init
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
./services/livekit.nix
|
||||
|
||||
./services/monero.nix
|
||||
./services/p2pool.nix
|
||||
./services/xmrig.nix
|
||||
|
||||
# KEEP UNTIL 2028
|
||||
|
||||
18
flake.lock
generated
18
flake.lock
generated
@@ -330,6 +330,23 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-p2pool-module": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1764744779,
|
||||
"narHash": "sha256-15mhGU8HZq4e6U2WnIhQvJNuUmU5aIO0RHMjzv9gVZs=",
|
||||
"owner": "JacoMalan1",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3784f8a0dc56806ffbc550701d3aa27436ebb3e5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "JacoMalan1",
|
||||
"ref": "create-p2pool-service",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764517877,
|
||||
@@ -381,6 +398,7 @@
|
||||
"nix-minecraft": "nix-minecraft",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-p2pool-module": "nixpkgs-p2pool-module",
|
||||
"senior_project-website": "senior_project-website",
|
||||
"srvos": "srvos",
|
||||
"trackerlist": "trackerlist",
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
url = "git+ssh://gitea@git.gardling.com/titaniumtown/arr-init";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixpkgs-p2pool-module = {
|
||||
url = "github:JacoMalan1/nixpkgs/create-p2pool-service";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
@@ -89,6 +94,7 @@
|
||||
deploy-rs,
|
||||
impermanence,
|
||||
arr-init,
|
||||
nixpkgs-p2pool-module,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
@@ -167,6 +173,8 @@
|
||||
|
||||
arr-init.nixosModules.default
|
||||
|
||||
(import "${nixpkgs-p2pool-module}/nixos/modules/services/networking/p2pool.nix")
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
(
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ rec {
|
||||
livekit = 7880; # TCP
|
||||
soulseek_listen = 50300; # TCP
|
||||
monero = 18080; # TCP
|
||||
p2pool_p2p = 37889; # TCP
|
||||
murmur = 64738; # TCP + UDP
|
||||
|
||||
# private
|
||||
@@ -41,6 +42,8 @@ rec {
|
||||
bazarr = 6767; # TCP
|
||||
jellyseerr = 5055; # TCP
|
||||
monero_rpc = 18081; # TCP
|
||||
monero_zmq = 18083; # TCP
|
||||
p2pool_stratum = 3334; # TCP
|
||||
};
|
||||
|
||||
https = {
|
||||
@@ -96,6 +99,10 @@ rec {
|
||||
dataDir = services_dir + "/monero";
|
||||
};
|
||||
|
||||
p2pool = {
|
||||
dataDir = services_dir + "/p2pool";
|
||||
};
|
||||
|
||||
matrix = {
|
||||
dataDir = "/var/lib/continuwuity";
|
||||
domain = "matrix.${https.domain}";
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
};
|
||||
extraConfig = ''
|
||||
p2p-bind-port=${builtins.toString service_configs.ports.monero}
|
||||
zmq-pub=tcp://127.0.0.1:${builtins.toString service_configs.ports.monero_zmq}
|
||||
db-sync-mode=fast:async:1000000000bytes
|
||||
public-node=1
|
||||
confirm-external-bind=1
|
||||
|
||||
48
services/p2pool.nix
Normal file
48
services/p2pool.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
config,
|
||||
service_configs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
walletAddress = lib.strings.trim (builtins.readFile ../secrets/xmrig-wallet);
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(lib.serviceMountWithZpool "p2pool" service_configs.zpool_hdds [
|
||||
service_configs.p2pool.dataDir
|
||||
])
|
||||
(lib.serviceFilePerms "p2pool" [
|
||||
"Z ${service_configs.p2pool.dataDir} 0700 p2pool p2pool"
|
||||
])
|
||||
];
|
||||
|
||||
services.p2pool = {
|
||||
enable = true;
|
||||
dataDir = service_configs.p2pool.dataDir;
|
||||
walletAddress = walletAddress;
|
||||
sidechain = "nano";
|
||||
host = "127.0.0.1";
|
||||
rpcPort = service_configs.ports.monero_rpc;
|
||||
zmqPort = service_configs.ports.monero_zmq;
|
||||
extraArgs = [
|
||||
"--stratum 0.0.0.0:${builtins.toString service_configs.ports.p2pool_stratum}"
|
||||
];
|
||||
};
|
||||
|
||||
# Ensure p2pool starts after monero is ready
|
||||
systemd.services.p2pool = {
|
||||
after = [ "monero.service" ];
|
||||
wants = [ "monero.service" ];
|
||||
};
|
||||
|
||||
# Stop p2pool on UPS battery to conserve power
|
||||
services.apcupsd.hooks = lib.mkIf config.services.apcupsd.enable {
|
||||
onbattery = "systemctl stop p2pool";
|
||||
offbattery = "systemctl start p2pool";
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
service_configs.ports.p2pool_p2p
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user