mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-22 13:14:15 +03:00
add nodeinfo package
This commit is contained in:
parent
14a073c35a
commit
986217d5d3
@ -3,10 +3,9 @@
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
|
||||
|
||||
let
|
||||
nodeinfo = (import pkgs/nodeinfo.nix);
|
||||
in {
|
||||
disabledModules = [ "services/security/tor.nix" ];
|
||||
|
||||
imports =
|
||||
@ -14,15 +13,18 @@
|
||||
./modules/default.nix
|
||||
./modules/tor.nix
|
||||
./modules/onionnode.nix
|
||||
|
||||
./modules/nodeinfo.nix
|
||||
];
|
||||
|
||||
networking.hostName = "nix-bitcoin"; # Define your hostname.
|
||||
time.timeZone = "UTC";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget vim tmux bitcoin git nginx
|
||||
wget vim tmux git nginx nodeinfo
|
||||
];
|
||||
nixpkgs.config.packageOverrides = pkgs: {
|
||||
inherit nodeinfo;
|
||||
};
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
|
17
modules/nodeinfo.nix
Normal file
17
modules/nodeinfo.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
systemd.services.nodeinfo = {
|
||||
description = "Get node info";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.bash}/bin/bash -c ${pkgs.nodeinfo}/bin/nodeinfo";
|
||||
user = "root";
|
||||
type = "oneshot";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
14
pkgs/nodeinfo.nix
Normal file
14
pkgs/nodeinfo.nix
Normal file
@ -0,0 +1,14 @@
|
||||
with import <nixpkgs> {}; # bring all of Nixpkgs into scope
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "nodeinfo";
|
||||
src = ./nodeinfo.sh;
|
||||
|
||||
unpackPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
mkdir -p $out/bin
|
||||
chmod +wx $src
|
||||
cp $src $out/bin/nodeinfo
|
||||
'';
|
||||
}
|
8
pkgs/nodeinfo.sh
Normal file
8
pkgs/nodeinfo.sh
Normal file
@ -0,0 +1,8 @@
|
||||
sleep 5
|
||||
OUTFILE=/var/lib/nodeinfo.nix
|
||||
rm -f $OUTFILE
|
||||
{
|
||||
echo \{
|
||||
echo " bitcoind_onion = \"$(cat /var/lib/tor/onion/bitcoind/hostname)\";"
|
||||
echo \}
|
||||
} > $OUTFILE
|
Loading…
Reference in New Issue
Block a user